flutter-ai-starter / rules
Cursor rule0 starsChanged 5 months agoMITView on GitHub
Testing requirements — unit, widget, provider, golden, integration
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 1,533 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository26 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/000-project.mdcCursor rule
- .cursor/rules/accessibility.mdcCursor rule
- .cursor/rules/api-integration.mdcCursor rule
- .cursor/rules/architecture.mdcCursor rule
- .cursor/rules/dart-style.mdcCursor rule
- .cursor/rules/design-system.mdcCursor rule
- .cursor/rules/flutter-ui.mdcCursor rule
- .cursor/rules/security.mdcCursor rule
- .cursor/rules/state-management.mdcCursor rule
- doubt-reviewSkill
- fix-dependenciesSkill
- flutter-componentSkill
- flutter-implementSkill
- generate-mocksSkill
- grind-until-greenSkill
- implement-tddSkill
- monitor-terminalSkill
- plan-featureSkill
- repo-navigatorSkill
- review-codeSkill
- save-contextSkill
- suggest-ruleSkill
- write-commitSkill
- write-readmeSkill
The file
We split this testing.mdc into the rules it gives an agent
5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 9
All code units below require tests: No skipping. Use implement-tdd for red-green-refactor workflow.
- Distinctive: line 32
Prefer fakes over mocks for code you own (repositories injected into ViewModels).
- Very specific: line 33
Use Mockito (generate-mocks skill) for external I/O boundaries only.
- Distinctive: line 34
Never mock internal collaborators to test implementation details.
- Very specific: line 67
Use the implement-tdd skill for red-green-refactor workflow.
≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
--- description: Testing requirements — unit, widget, provider, golden, integration globs: ["test/**/*.dart", "lib/**/*.dart", "supabase/**/*"] alwaysApply: false --- # Testing requirements **All code units below require tests.** No skipping. Use `implement-tdd` for red-green-refactor workflow. ## What must be tested | Code unit | Test type | Tool | |---|---|---| | Pure function / mapper / util | Unit | `package:test` | | Repository | Unit with fake client | `package:test` | | ViewModel (`ChangeNotifier`) | Unit test (fake repos) | `package:test` | | Design-system widget | Widget + golden (light + dark) | `flutter_test` | | Screen | Widget (happy + one error path) | `flutter_test` | | Critical flow | Integration | `integration_test` | | Supabase table | RLS | pgTAP (when using Supabase) | ## Testing strategy (fake vs mock) | Layer | Approach | Why | |---|---|---| | ViewModel unit tests | **Fake repositories** (hand-written stubs) | Test behavior through public ViewModel API | | Repository unit tests | **Mockito** for dio / Supabase client at the boundary | Verify HTTP/query calls without real network | | ViewModel `notifyListeners` | Optional **listener** on the ViewModel | Assert UI refresh signal only — not business logic | | Internal private methods | **Do not test directly** | Test via public methods; refactor if untestable | - Prefer fakes over mocks for code you own (repositories injected into ViewModels). - Use Mockito (`generate-mocks` skill) for external I/O boundaries only. - Never mock internal collaborators to test implementation details. ## Layout Mirror source tree under `test/`: ``` test/ core/... design_system/components/... features/<feature>/... integration/ ``` ## Naming - Files: `<unit>_test.dart` - Cases: `<unit> <does what> when <state>` ## CI expectations - `dart format --set-exit-if-changed .` - `flutter analyze --fatal-infos` - `flutter test` - `dart run build_runner build` must produce no diff when codegen is used ## Forbidden - `skip: true` without documented reason - Shipping new/changed code without the tests required by the table above - Tests hitting prod Supabase or real AI vendor APIs - Asserting behavior through private implementation details Use the `implement-tdd` skill for red-green-refactor workflow.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

