feat(agents): add flutter-reviewer agent and skill#716
Conversation
Library-agnostic Flutter/Dart code reviewer that adapts to the project's chosen state management solution (BLoC, Riverpod, Provider, GetX, MobX, Signals) and architecture pattern (Clean Architecture, MVVM, feature-first). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughTwo new markdown files introduce a Flutter/Dart code review agent configuration and comprehensive best-practices checklist. The agent defines a structured workflow for reviewing Flutter and Dart code, covering architecture, state management, performance, security, and accessibility concerns. The checklist provides library-agnostic guidance across project health, language idioms, widgets, testing, and related domains. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip You can customize the high-level summary generated by CodeRabbit.Configure the |
Greptile SummaryThis PR introduces a Key observations:
Confidence Score: 3/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A([Invoked]) --> B[Step 1: git diff / git log\nIdentify changed Dart files]
B --> C[Step 2: Read project config\npubspec.yaml · analysis_options.yaml\nCLAUDE.md · melos · state mgmt · DI/routing]
C --> D[Step 2b: Security Pre-check\nHardcoded secrets · insecure storage\ncleartext HTTP · exported components]
D --> E{CRITICAL\nsecurity\nfound?}
E -- Yes --> F([Hand off to security-reviewer\nSTOP])
E -- No --> G[Step 3: Read changed files fully\nApply 13-section review checklist]
G --> H[Step 4: Report findings\n>80% confidence only\nConsolidate similar issues]
H --> I([Output: findings + Review Summary table\nVerdict: APPROVE / BLOCK])
style F fill:#ff4444,color:#fff
style I fill:#22aa44,color:#fff
Last reviewed commit: "feat(agents): add fl..." |
| --- | ||
| name: flutter-reviewer | ||
| description: Flutter and Dart code reviewer. Reviews Flutter code for widget best practices, state management patterns, Dart idioms, performance pitfalls, accessibility, and clean architecture violations. Library-agnostic — works with any state management solution and tooling. | ||
| tools: ["Read", "Grep", "Glob", "Bash"] | ||
| model: sonnet | ||
| --- |
There was a problem hiding this comment.
Agent not registered in AGENTS.md
The root AGENTS.md file is the single source of truth for agent discovery and orchestration — it's what Claude uses to decide when to delegate to a specialized agent. Every other language reviewer (kotlin-reviewer, go-reviewer, python-reviewer, java-reviewer, rust-reviewer, typescript-reviewer, etc.) is listed there with a clear purpose and "When to Use" column. flutter-reviewer is missing entirely.
Additionally, the preamble in AGENTS.md currently reads:
"providing 27 specialized agents, 114 skills, 59 commands…"
This count needs to be updated to 28 after this PR merges.
Without adding the entry to AGENTS.md, the orchestration system has no signal to invoke this agent for Flutter projects, making it effectively invisible to the pipeline.
Suggested addition to the Available Agents table in AGENTS.md:
| flutter-reviewer | Flutter/Dart code review | Flutter/Dart projects |
| --- | ||
| name: flutter-dart-code-review | ||
| description: Library-agnostic Flutter/Dart code review checklist covering widget best practices, state management patterns (BLoC, Riverpod, Provider, GetX, MobX, Signals), Dart idioms, performance, accessibility, security, and clean architecture. | ||
| origin: ECC | ||
| --- | ||
|
|
||
| # Flutter/Dart Code Review Best Practices | ||
|
|
||
| Comprehensive, library-agnostic checklist for reviewing Flutter/Dart applications. These principles apply regardless of which state management solution, routing library, or DI framework is used. | ||
|
|
||
| --- |
There was a problem hiding this comment.
Skill format diverges from project convention
CLAUDE.md documents the expected skill format as:
"Skills: Clear sections (When to Use, How It Works, Examples)"
All skills are expected to open with those three standard sections so consumers know at a glance when the skill applies and how to invoke it. This file opens directly with a flat checklist under ## 1. General Project Health — there is no ## When to Use, ## How It Works, or ## Examples section.
While the checklist content is thorough, omitting the standard preamble sections means this skill doesn't follow the same discoverability contract as the rest of the skill library. Consider adding the three standard sections (even if brief) before the numbered checklist to keep the format consistent.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| ### Step 2b: Security Review | ||
|
|
||
| Check before continuing — if any CRITICAL security issue is found, stop and hand off to `security-reviewer`: | ||
| - Hardcoded API keys, tokens, or secrets in Dart source | ||
| - Sensitive data in plaintext storage instead of platform-secure storage | ||
| - Missing input validation on user input and deep link URLs | ||
| - Cleartext HTTP traffic; sensitive data logged via `print()`/`debugPrint()` | ||
| - Exported Android components and iOS URL schemes without proper guards | ||
|
|
||
| ### Step 3: Read and Review |
There was a problem hiding this comment.
Step numbering skips "Step 2a"
The workflow goes Step 2 → Step 2b with no Step 2a in between. While functionally harmless (the intent is clear), the label 2b strongly implies a 2a exists somewhere. Readers may scan upward looking for it.
The kotlin-reviewer.md has the same pattern, so this is an inherited inconsistency in the project. Consider either renaming Step 2b to Step 3 and re-numbering subsequent steps, or labelling the preceding step Step 2a explicitly — whichever aligns with the pattern you'd prefer to standardise across all language reviewers.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
🧹 Nitpick comments (1)
skills/flutter-dart-code-review/SKILL.md (1)
1-10: Consider adding standard skill sections.The skill is formatted as a comprehensive checklist, which is well-organized and appropriate for a review rubric. However, coding guidelines specify that skills should include "When to Use, How It Works, and Examples" sections. Consider adding a brief introductory section that explains:
- When to Use: When reviewing Flutter/Dart code in PRs, before commits, or during code audits
- How It Works: Apply the 15-section checklist systematically to the codebase
- Examples: Could reference the code examples already present (lines 113-137)
This would make the skill more accessible to users unfamiliar with Flutter review practices while maintaining the checklist format.
As per coding guidelines: "Skills should be formatted as Markdown with clear sections for When to Use, How It Works, and Examples."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@skills/flutter-dart-code-review/SKILL.md` around lines 1 - 10, Add the required "When to Use", "How It Works", and "Examples" sections to the flutter-dart-code-review skill (SKILL.md): create a brief "When to Use" describing contexts (PR reviews, pre-commit, audits), a concise "How It Works" instructing users to apply the 15-section checklist systematically, and an "Examples" section that references and links to the existing code examples already in the document (the examples block near the checklist). Ensure headings match the specified titles and keep each section short and actionable so the checklist remains the primary content.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@skills/flutter-dart-code-review/SKILL.md`:
- Around line 1-10: Add the required "When to Use", "How It Works", and
"Examples" sections to the flutter-dart-code-review skill (SKILL.md): create a
brief "When to Use" describing contexts (PR reviews, pre-commit, audits), a
concise "How It Works" instructing users to apply the 15-section checklist
systematically, and an "Examples" section that references and links to the
existing code examples already in the document (the examples block near the
checklist). Ensure headings match the specified titles and keep each section
short and actionable so the checklist remains the primary content.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6d3ba204-8034-499d-9f3c-557e96d7400f
📒 Files selected for processing (2)
agents/flutter-reviewer.mdskills/flutter-dart-code-review/SKILL.md
There was a problem hiding this comment.
2 issues found across 2 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="agents/flutter-reviewer.md">
<violation number="1" location="agents/flutter-reviewer.md:122">
P1: The Dart Idioms section incorrectly lists `requireNotNull` as a preferred null-safety alternative. This is a Kotlin function that does not exist in Dart's standard library. The agent will recommend invalid code to Flutter/Dart developers.</violation>
</file>
<file name="skills/flutter-dart-code-review/SKILL.md">
<violation number="1" location="skills/flutter-dart-code-review/SKILL.md:419">
P2: Provider disposal documentation is oversimplified - disposal is only automatic with `create` constructor, not with `.value` which requires manual disposal</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Add one-off context when rerunning by tagging
@cubic-dev-aiwith guidance or docs links (includingllms.txt) - Ask questions if you need clarification on any suggestion
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| ### Dart Idioms (MEDIUM) | ||
|
|
||
| - **Missing type annotations / implicit `dynamic`** — Enable `strict-casts`, `strict-inference`, `strict-raw-types` to catch these | ||
| - **`!` bang overuse** — Prefer `?.`, `??`, `case var v?`, or `requireNotNull` |
There was a problem hiding this comment.
P1: The Dart Idioms section incorrectly lists requireNotNull as a preferred null-safety alternative. This is a Kotlin function that does not exist in Dart's standard library. The agent will recommend invalid code to Flutter/Dart developers.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At agents/flutter-reviewer.md, line 122:
<comment>The Dart Idioms section incorrectly lists `requireNotNull` as a preferred null-safety alternative. This is a Kotlin function that does not exist in Dart's standard library. The agent will recommend invalid code to Flutter/Dart developers.</comment>
<file context>
@@ -0,0 +1,243 @@
+### Dart Idioms (MEDIUM)
+
+- **Missing type annotations / implicit `dynamic`** — Enable `strict-casts`, `strict-inference`, `strict-raw-types` to catch these
+- **`!` bang overuse** — Prefer `?.`, `??`, `case var v?`, or `requireNotNull`
+- **Broad exception catching** — `catch (e)` without `on` clause; specify exception types
+- **Catching `Error` subtypes** — `Error` indicates bugs, not recoverable conditions
</file context>
| | UI consumer | `BlocBuilder` | `ConsumerWidget` | `Consumer` | `Obx`/`GetBuilder` | `Observer` | `Watch` | `setState` | | ||
| | Selector | `BlocSelector`/`buildWhen` | `ref.watch(p.select(...))` | `Selector` | N/A | computed | `computed()` | N/A | | ||
| | Side effects | `BlocListener` | `ref.listen` | `Consumer` callback | `ever()`/`once()` | `reaction` | `effect()` | callbacks | | ||
| | Disposal | auto via `BlocProvider` | `.autoDispose` | auto via `Provider` | `onClose()` | `ReactionDisposer` | manual | `dispose()` | |
There was a problem hiding this comment.
P2: Provider disposal documentation is oversimplified - disposal is only automatic with create constructor, not with .value which requires manual disposal
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At skills/flutter-dart-code-review/SKILL.md, line 419:
<comment>Provider disposal documentation is oversimplified - disposal is only automatic with `create` constructor, not with `.value` which requires manual disposal</comment>
<file context>
@@ -0,0 +1,435 @@
+| UI consumer | `BlocBuilder` | `ConsumerWidget` | `Consumer` | `Obx`/`GetBuilder` | `Observer` | `Watch` | `setState` |
+| Selector | `BlocSelector`/`buildWhen` | `ref.watch(p.select(...))` | `Selector` | N/A | computed | `computed()` | N/A |
+| Side effects | `BlocListener` | `ref.listen` | `Consumer` callback | `ever()`/`once()` | `reaction` | `effect()` | callbacks |
+| Disposal | auto via `BlocProvider` | `.autoDispose` | auto via `Provider` | `onClose()` | `ReactionDisposer` | manual | `dispose()` |
+| Testing | `blocTest()` | `ProviderContainer` | `ChangeNotifier` directly | `Get.put` in test | store directly | signal directly | widget test |
+
</file context>
Library-agnostic Flutter/Dart code reviewer that adapts to the project's chosen state management solution (BLoC, Riverpod, Provider, GetX, MobX, Signals) and architecture pattern (Clean Architecture, MVVM, feature-first). Co-authored-by: Maciej Starosielec <maciej@code-snap.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
Adds a library-agnostic Flutter/Dart code reviewer agent and companion skill:
agents/flutter-reviewer.md— Reviews Flutter code for widget best practices, state management patterns, Dart idioms, performance, accessibility, security, and architecture. Adapts to the project's chosen state management solution (BLoC, Riverpod, Provider, GetX, MobX, Signals, or built-in).skills/flutter-dart-code-review/SKILL.md— Comprehensive 15-section review checklist with a state management quick reference table mapping universal principles to solution-specific implementations.Key design decisions:
security-revieweron CRITICAL findingsType
Testing
Checklist
Summary by cubic
Adds a library-agnostic Flutter/Dart code reviewer agent with a companion checklist skill. Improves review quality across widgets, state, performance, accessibility, security, and architecture, regardless of the chosen libraries.
agents/flutter-reviewer.md: Adaptive reviewer for any state management (BLoC, Riverpod, Provider, GetX, MobX, Signals) and architecture. Includes a clear workflow, concise reporting format, approval criteria, noise control, and CRITICAL security escalation tosecurity-reviewer.skills/flutter-dart-code-review/SKILL.md: 15-section checklist with a quick reference mapping universal principles to popular solutions. Covers widgets, Dart idioms, performance, testing, accessibility, i18n, security, DI, navigation, and dependencies.Written for commit cb3da81. Summary will update on new commits.
Summary by CodeRabbit