Skip to content
Agent Friendly Code

What to put in an AGENTS.md for Flutter

Flutter publishes AI rules, agent skills and a Dart and Flutter MCP server (dart mcp-server), so point to those and keep AGENTS.md to this repo. The common slip is editing a generated *.g.dart file instead of rerunning build_runner.

Which commands should it list?

  • flutter pub getafter any pubspec.yaml change
  • flutter analyzenot dart analyze
  • flutter testunit and widget tests; not dart test
  • dart format .format
  • dart run build_runner build --delete-conflicting-outputsregenerate *.g.dart

Write them as your repo runs them, with its package manager and flags, plus how to run one test.

What layout should it explain?

  • Which directory holds the app and its pubspec.yaml, in a repo with several packages.
  • Which packages use code generation, and which part '*.g.dart' files come from it.
  • Where integration tests live (integration_test/) and what device they need.

What do agents get wrong?

  • Use flutter analyze, flutter test and flutter pub, not the bare dart commands.
  • *.g.dart files come from build_runner; change the source and regenerate them.
  • Integration tests run on a device: flutter test integration_test/<file>.dart from the project root.

From the official docs: docs.flutter.dev/get-started (new tab) · docs.flutter.dev/flutter-cli (new tab) · docs.flutter.dev/json (new tab) · docs.flutter.dev/integration-tests (new tab) · docs.flutter.dev/formatting (new tab). The rest of the file is the same for any project: what goes in an AGENTS.md.

Flutter repos with an AGENTS.md or CLAUDE.md (3)

Built on Flutter; 3 pass the AGENTS.md check in full.

Flutter repos with an AGENTS.md or CLAUDE.md
RepoFileLength
localsend/localsendAGENTS.md 12,267
rustdesk/rustdeskAGENTS.md 18,208
immich-app/immichAGENTS.md 2,449

More examples: Next.js · React · FastAPI · Django · Rails · Vue · Laravel · Android · all examples