A repository of guidance for AI agents building Flutter and Dart code.
This is an experimental repository, which means the things will change (sometimes drastically). Feedback very welcome!
See CONTRIBUTING.md
This extension provides a set of commands to help you work with Dart and Flutter projects. It will be installed in your ~/.gemini/extensions directory.
First, make sure you are on the preview build of Gemini CLI, by installing it:
npm install -g @google/gemini-cli@preview
Next, enable it in your ~/.gemini/settings.json
file by adding the following "experimental" section:
{
// ...other settings
"experimental": {
"extensionManagement": true
}
}
Now install the extension:
gemini extensions install --source https://github.com/flutter/ai-guidance.git
Once installed, run this to update it:
gemini extensions update flutter
To uninstall it:
gemini extensions uninstall flutter
The flutter.md file contains a bunch of rules for writing Dart code. Some are very opinionated, so you should probably review them and make sure they agree with your style.
The override file contains some rules that are appended to the end of all of Gemini's rules so that they have more weight.
This extension adds some commands, all of which can be run with our without the "flutter:" prefix (as long as there isn't a name collision with another extension).
Initializes the agent to work on Dart code. It will summarize the coding guidelines, documentation rules, and the tools it has available for Dart development. Use this command at the beginning of a session to ensure the agent is primed with the correct context.
Starts the process of creating a new Dart or Flutter package. The agent will:
- Ask for the package's purpose, details, and location.
- Create a new project with recommended settings, including linter rules.
- Set up the initial
pubspec.yaml
,README.md
, andCHANGELOG.md
. - Create a detailed
DESIGN.md
andIMPLEMENTATION.md
for your review and approval before writing code.
This command is ideal for bootstrapping a new project with best practices from the start.
Initiates a guided refactoring session for existing code. The agent will:
- Ask for the refactoring goals and what you want to accomplish.
- Offer to create a new branch for the refactoring work.
- Generate a
REFACTOR.md
design document outlining the proposed changes. - Create a detailed, phased
REFACTOR_IMPLEMENTATION.md
plan for your review and approval.
This command helps structure complex refactoring tasks, ensuring they are well-planned and executed.
Prepares your current changes for a git commit. The agent will:
- Run
dart fix
anddart format
to clean up the code. - Run the analyzer to check for any issues.
- Run tests to ensure everything is passing.
- Generate a descriptive commit message based on the changes for you to review and approve.
This command helps maintain code quality and consistency in your commit history.