mcp_flutter / rules
Cursor rule385 starsChanged 5 months agoMITView on GitHub
when creating or modifing flutter widgets
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 repository31 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/app_architecture.guide.mdcCursor rule
- .cursor/rules/ask_file_by_file_actions.mdcCursor rule
- .cursor/rules/ask_follow_up.mdcCursor rule
- .cursor/rules/ask_step_by_step_plan.mdcCursor rule
- .cursor/rules/command_resource.pattern.mdCursor rule
- .cursor/rules/create_test_rule.mdcCursor rule
- .cursor/rules/dart_dev.mdcCursor rule
- .cursor/rules/dart_doc.mdcCursor rule
- .cursor/rules/dart_extension_type_const_models.mdcCursor rule
- .cursor/rules/faq_usage.mdcCursor rule
- .cursor/rules/key_design_decisions.mdcCursor rule
- .cursor/rules/mermaid_rule.mdcCursor rule
- .cursor/rules/steward.mdcCursor rule
- .cursor/rules/test_guide.mdcCursor rule
- .cursor/rules/test_use_tdd.mdcCursor rule
- .cursor/rules/think_hard.mdcCursor rule
- .cursor/rules/training.mdcCursor rule
- .cursor/rules/typescript.mdcCursor rule
- .cursor/rules/writing_code_protocol.mdcCursor rule
- harness-engineering-lifecycleSkill
- mcp-harness-repo-maintainerSkill
- mixture-of-expertsSkill
- multi-agent-handoffSkill
- plugin-marketplace-setupSkill
- release-changelog-harnessSkill
- repository-governance-lifecycleSkill
- skill-authoring-lifecycleSkill
- skill-eval-improveSkill
- skill-source-citationsSkill
The file
We split this flutter_ui_dev.mdc into the rules it gives an agent
5 rules. About 0 are common, 5 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 18
Prefer fewer, more cohesive widgets over many tiny widgets
- Distinctive: line 31
Use section comments to delineate logical UI parts:
- Distinctive: line 53
Prefer fewer widgets for simpler screens
- Distinctive: line 54
Use const constructors aggressively
- Distinctive: line 59
Document the "why" more than the "what" when using comments
≈ “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: when creating or modifing flutter widgets
alwaysApply: false
---
# Flutter widgets and concepts:
- Dart 3.11 syntax for null safety, pattern matching, and more
- Appropriate use of StatelessWidget, or Stateful widgets (NO riverpod)
- Custom reusable widgets (use ui_kit) instead of methods
- Cupertino or Material Design as appropriate
- Proper error handling and async/await for asynchronous operations
- flutter_animate for animations
# Widget Composition Guidelines:
1. **Appropriate Widget Granularity**:
- Prefer fewer, more cohesive widgets over many tiny widgets
- Extract new widget classes only when they are:
- Reused in multiple places
- Complex enough to warrant separation (>10 lines)
- Logically independent with clear boundaries
- For simpler UIs, use a single widget with well-commented sections
2. **Code Organization Hierarchy**:
- First preference: Use comments to separate logical sections within a widget
- Second preference: Extract logical methods for complex sections (>10 && <30 lines)
- Last preference: Create new widget classes
3. **Comment-Based Structure**:
- Use section comments to delineate logical UI parts:
```dart
// Header section
Column(
children: [
// Title
Text('Title'),
// Subtitle
Text('Subtitle'),
],
),
```
4. **Refactoring Decision Tree**:
- Is the component reused? → Extract widget
- Is the component >50 lines? → Consider extraction
- Is the component logically independent? → Consider extraction
- Otherwise → Keep in parent with comments
5. **Performance Considerations**:
- Be mindful that each widget adds overhead
- Prefer fewer widgets for simpler screens
- Use const constructors aggressively
6. **Documentation Balance**:
- For single-class approaches, use inline comments instead of class-level docs
- Reserve detailed documentation for public APIs and complex widgets
- Document the "why" more than the "what" when using comments
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.

