Back to Discover

#flutter

1 prompt found

Cursor Rules for Flutter: Project .mdc Rule Set Generator
📁 Agents

Cursor Rules for Flutter: Project .mdc Rule Set Generator

Ppromptstudio·Oct 10, 2026
No rating

Generate Cursor rules for a Flutter app from your real pubspec and folder layout: scoped .mdc files for widgets, state, routing, tests, and generated code.

Act as a senior Flutter engineer who writes Cursor project rules (.mdc files in .cursor/rules) for Flutter and Dart codebases, so the Cursor agent follows the team's real architecture instead of generic Flutter habits. Inputs: - pubspec.yaml dependencies and dev_dependencies, pasted as is: [Pubspec] - analysis_options.yaml, pasted as is: [AnalysisOptions] - Folder structure of lib/ and test/ two levels deep: [FolderTree] - State management, routing, and data layer the app actually uses (for example Riverpod, Bloc, Provider; go_router; Dio, http, Drift): [ArchitectureChoices] - Code generation in use (freezed, json_serializable, build_runner) and which files are generated: [Codegen] - Team conventions that are not written down anywhere yet: [Conventions] - Things the agent keeps getting wrong in this repo: [AgentMistakes] - Output format: [Format] Generate: 1. An evidence check: list every package and convention you will reference and where it came from (Pubspec, AnalysisOptions, FolderTree, or my notes). Anything not found is left out of the rules, not guessed. 2. A rule plan: a table of 5 to 7 .mdc files with file name, rule type (always apply, auto attached by globs, agent requested by description, or manual), globs, and a one line purpose. 3. The always apply core rule (under 40 lines): project summary, folder map from FolderTree, the commands to run after edits (flutter analyze, dart format, flutter test) and the build_runner command if Codegen uses it. 4. A widgets rule scoped to the UI folders: composition over deep widget trees, const constructors where possible, no business logic in build methods, and context use after await only behind a mounted check. 5. A state management rule written for the exact library in ArchitectureChoices, with the file naming and provider or bloc placement used in FolderTree. 6. A routing and navigation rule for the routing package in Pubspec, or skip it if there is none. 7. A data and models rule that covers Codegen: never hand edit generated files, regenerate after model changes, and where models and repositories live. 8. A testing rule scoped to test/: where tests go, naming, which test types the repo uses, and what to mock. 9. A rule for AgentMistakes: each mistake turned into a short do and do not pair. 10. Full .mdc file contents for every rule with front matter (description, globs, alwaysApply), ready to save. Constraints: - Only reference packages present in Pubspec and lints present in AnalysisOptions. - Keep each rule short and specific; no generic Dart style guide filler. - Do not invent folder paths; use FolderTree exactly. - No em dashes.