Skip to content

[rules] Add packages/flutter_tools/gradle/AGENTS.md rules - #191486

Merged
auto-submit[bot] merged 2 commits into
flutter:masterfrom
reidbaker-agent:fgp-agent-rules
Aug 21, 2026
Merged

auto-submit[bot] merged 2 commits into
flutter:masterfrom
reidbaker-agent:fgp-agent-rules

Conversation

@reidbaker-agent

@reidbaker-agent reidbaker-agent commented Aug 21, 2026 •

Copy link
Copy Markdown
Contributor

This work came in response to pr #191218 and a conversation with @gmackall about how I did not think the new dsl migration counted as "agentic engineering" because I was not doing the work like we have as part of project one shot in camera_android_camerax. Really the new dsl work is a great opportunity to lay out some of the patterns we have found.

@gmackall to double check the engineering principals and add any others he thinks are important.
@camsim99 to help review agents.md. @camsim99 we have no skills or really much documentation so the agents.md file has more primary logic than I would normally like but I think in this case it is ok.

The purpose is to give agents working on the flutter gradle plugin guidance for what we consider important and how we want to architect work.

There are no evals in flutter/flutter so I have not written any. This is acknowledged technical debt so we can get the benefit of this steering on follow-up new dsl prs (4-11).

I consider this newDsl pr 3.1.


Agent authored description

Description

This PR introduces packages/flutter_tools/gradle/AGENTS.md following Jetski's directory-scoped AGENTS.md standard. This defines workspace architectural rules, configuration cache compatibility, and development practices for the Flutter Gradle Plugin (FGP).

Key Rules Included:

  1. Zero Pollution of Customer-Facing Build Scripts: Enforces consumer build isolation in composite builds (includeBuild); forbids contributor verification tasks or lifecycle hooks (check.dependsOn/test.dependsOn) in build.gradle.kts, requiring standard JUnit tests or CI shards instead.
  2. Type-Safe AGP & Gradle API Usage (No @Suppress): Prohibits raw wildcard casts and @Suppress("UNCHECKED_CAST") when dealing with AGP domain objects; mandates type-safe APIs and compatibility bridges.
  3. Lazy Configuration & Execution Avoidance: Prohibits eager .get() during configuration phase; requires Gradle Lazy Provider chaining.
  4. Strict Configuration Cache Compatibility: Forbids storing Project, SourceSet, or Configuration references in task instances.
  5. Build Avoidance & Path Normalization: Requires @PathSensitive(RELATIVE) or NAME_ONLY to maximize local and remote cache hits across machines.
  6. Worker API for Heavy Computation: Decouples heavy computation, parsing, and tooling execution to non-blocking worker threads.
  7. Namespace & Environment Hygiene: Enforces flutter.internal. property prefixing and full matrix verification across supported AGP/Gradle versions.
  8. Scope & Legacy Code Policy (The Ratchet Principle): Enforces compliance on all new and modified code while preventing unapproved scope expansion on legacy code, while instructing agents to surface adjacent improvement opportunities to the user.

Related Issues

  • Related to FGP architecture, AGP 8/9 compatibility, and Jetski agent directory rules.

Tests

  • Documentation and rule file only (test-exempt).

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I signed the [CLA].
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • All existing and new tests are passing.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new rules and best practices document for the Flutter Gradle Plugin, covering configuration cache compatibility, build performance, and lazy configuration. The review feedback suggests expanding the lazy configuration guidelines to include lazy collection properties, adding a rule to use Gradle service injection instead of Project helper methods for configuration cache compliance, and clarifying the syntax and usage of path normalization annotations.

Comment thread packages/flutter_tools/gradle/AGENTS.md Outdated
Comment thread packages/flutter_tools/gradle/AGENTS.md Outdated
Comment thread packages/flutter_tools/gradle/AGENTS.md Outdated
@reidbaker
reidbaker requested a review from a team as a code owner August 21, 2026 16:10
@reidbaker
reidbaker requested review from gmackall and removed request for a team August 21, 2026 16:10
@reidbaker-agent reidbaker-agent changed the title [rules] Add Flutter Gradle Plugin development and architecture rules [rules] Add packages/flutter_tools/gradle/AGENTS.md rules Aug 21, 2026
@github-actions github-actions Bot added platform-android Android applications specifically tool Affects the "flutter" command-line tool. See also t: labels. labels Aug 21, 2026
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@reidbaker
reidbaker requested review from camsim99 and mboetger and removed request for mboetger August 21, 2026 16:13
@reidbaker reidbaker added CICD Run CI/CD autosubmit Merge PR when tree becomes green via auto submit App labels Aug 21, 2026
@reidbaker

Copy link
Copy Markdown
Contributor

Whelp @gmackall and @camsim99 are both ooo today. Going to land as is and get feedback from them next week.

@auto-submit
auto-submit Bot added this pull request to the merge queue Aug 21, 2026
Merged via the queue into flutter:master with commit 7c25794 Aug 21, 2026
30 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 21, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Aug 22, 2026
Roll Flutter from c2437523d308 to 65c9a8dc60bc (195 revisions)

flutter/flutter@c243752...65c9a8d

2026-08-22 [email protected] Roll ICU from d578f2e8b7bd to 8cc91d9b6ab9 (1 revision) (flutter/flutter#191542)
2026-08-22 [email protected] Roll Skia from 666a9b3d5cf0 to ad2106c0bb64 (3 revisions) (flutter/flutter#191527)
2026-08-22 [email protected] Roll Fuchsia Test Scripts from KaOq3EE4qJ9fnaaaK... to 0iCv10IlKfiilEBOU... (flutter/flutter#191524)
2026-08-22 [email protected] [flutter_tools] Add tests for negative lookahead regex in test runner and batch entrypoints (flutter/flutter#191438)
2026-08-22 [email protected] Roll Skia from 0c37868737fa to 666a9b3d5cf0 (2 revisions) (flutter/flutter#191518)
2026-08-21 [email protected] Revert "[input] Migrate fuchsia.ui.pointerinjector to TouchSource (#190855) (flutter/flutter#191509)
2026-08-21 [email protected] Fixes windows gallery benchmarks by forcing mobile layout (flutter/flutter#191507)
2026-08-21 [email protected] [flutter_tools] Restrict WebAssetServer source resolution to source map extensions (flutter/flutter#191501)
2026-08-21 [email protected] Roll Skia from f6900c5b8439 to 0c37868737fa (2 revisions) (flutter/flutter#191504)
2026-08-21 [email protected] Refactor `FlutterDevice.connect` and VM service discovery (flutter/flutter#191221)
2026-08-21 [email protected] [flutter_tools] Fix crash when migrating flow-style exclude lists in analysis_options.yaml (flutter/flutter#191269)
2026-08-21 [email protected] [rules] Add packages/flutter_tools/gradle/AGENTS.md rules (flutter/flutter#191486)
2026-08-21 [email protected] [flutter_tools] refactor CLI argument architecture with typed option descriptors and bundles (PoC) (flutter/flutter#191018)
2026-08-21 [email protected] tools: Extract Dart SDK to temp directory before moving to final location (flutter/flutter#191263)
2026-08-21 [email protected] [web] Move CanvasKit fragment shader classes to canvaskit/fragment_shader.dart (flutter/flutter#191451)
2026-08-21 [email protected] Roll Fuchsia Linux SDK from GCQlmt6h-esJsNubS... to ic6GjOSn-KN508XyK... (flutter/flutter#191485)
2026-08-21 [email protected] [Widget Preview] Isolate PageStorage scope in widget preview group expansion tile (flutter/flutter#191378)
2026-08-21 [email protected] [flutter_tools] Deprecate --build and --no-build flags on flutter run (flutter/flutter#191358)
2026-08-21 [email protected] Roll Skia from 70988bed1b3b to f6900c5b8439 (2 revisions) (flutter/flutter#191481)
2026-08-21 [email protected] Roll Packages from 1785501 to 252bb33 (6 revisions) (flutter/flutter#191480)
2026-08-21 [email protected] Roll Fuchsia Linux SDK from 20IJas24bZiNmCZTK... to GCQlmt6h-esJsNubS... (flutter/flutter#191415)
2026-08-21 [email protected] Roll Skia from 2ba6971bd0d1 to 70988bed1b3b (2 revisions) (flutter/flutter#191476)
2026-08-21 [email protected] Roll Skia from 1d5f72537ba6 to 2ba6971bd0d1 (2 revisions) (flutter/flutter#191473)
2026-08-21 [email protected] Roll Skia from 2c25efd2e369 to 1d5f72537ba6 (1 revision) (flutter/flutter#191472)
2026-08-21 [email protected] Roll Skia from 09b1b810850a to 2c25efd2e369 (9 revisions) (flutter/flutter#191470)
2026-08-21 [email protected] [Impeller] fix position of cached single glyph text shadows (flutter/flutter#191325)
2026-08-21 [email protected] Roll Skia from abdf8821f313 to 09b1b810850a (15 revisions) (flutter/flutter#191458)
2026-08-21 [email protected] Document that programmatic TextEditingController changes do not run input formatters (flutter/flutter#190166)
2026-08-21 [email protected] Adds new gallery benchmarks to windows (skia and impeller) (flutter/flutter#191454)
2026-08-21 [email protected] iOS: Deprecate FlutterEngine.isGpuDisabled (flutter/flutter#191393)
2026-08-21 [email protected] Revert: [web] Unskip decoration image lerp tests (flutter/flutter#191462)
2026-08-20 [email protected] android_hardware_smoke_test: Improve reliability (flutter/flutter#191374)
2026-08-20 [email protected] Don't size or offset the Android platform view before it is laid out (flutter/flutter#190895)
2026-08-20 [email protected] [iOS][add2app] Skip building SwiftPM plugins when generating CocoaPods artifacts (flutter/flutter#190736)
2026-08-20 [email protected] Optimize JSONMessageCodec UTF-8 conversion (flutter/flutter#190529)
2026-08-20 [email protected] [FML] Replace deprecated wstring_convert with Win32 APIs (flutter/flutter#191394)
2026-08-20 [email protected] SliverFillRemaining extends beyond viewport size when fillOverscroll is true (flutter/flutter#191236)
2026-08-20 [email protected] [flutter_tools] Update argParser usageLineLength when --wrap-column is passed (flutter/flutter#191264)
2026-08-20 [email protected] [flutter_tools] Fix UNC path resolution in depfile parsing on Windows (flutter/flutter#191265)
2026-08-20 [email protected] [web] Unskip decoration image lerp tests (flutter/flutter#191426)
2026-08-20 [email protected] Do not inject 'type' and 'method' into service extension responses (flutter/flutter#190946)
2026-08-20 [email protected] [flutter_tools] Fix crash in symbolize command on stream error (flutter/flutter#191273)
2026-08-20 [email protected] [flutter_tools] Prevent deletion of shared native asset hooks outputs as stale (flutter/flutter#191272)
2026-08-20 [email protected] [flutter_tools] Support package wildcard assets in app pubspec (flutter/flutter#191266)
2026-08-20 [email protected] Add SliverClipRect and SliverClipRRect (flutter/flutter#179003)
2026-08-20 [email protected] [flutter_tools] Implement Diagnostics extension slice and doctor integration (flutter/flutter#191162)
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD platform-android Android applications specifically tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants