dart-mobile-game-studio / rules
Cursor rule1 starsChanged 5 months agoMITView on GitHub
Architecture rules for Dart/Flutter game source — separate game logic from rendering, state machine, modular layout, mode decision.
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,531 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 repository21 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/agents/art-director.mdcCursor rule
- .cursor/rules/agents/balance-economist.mdcCursor rule
- .cursor/rules/agents/code-auditor.mdcCursor rule
- .cursor/rules/agents/code-reviewer.mdcCursor rule
- .cursor/rules/agents/engine-architect.mdcCursor rule
- .cursor/rules/agents/game-coordinator.mdcCursor rule
- .cursor/rules/agents/game-designer.mdcCursor rule
- .cursor/rules/agents/gameplay-programmer.mdcCursor rule
- .cursor/rules/agents/legal-compliance.mdcCursor rule
- .cursor/rules/agents/narrative-writer.mdcCursor rule
- .cursor/rules/agents/performance-auditor.mdcCursor rule
- .cursor/rules/agents/qa-tester.mdcCursor rule
- .cursor/rules/agents/release-engineer.mdcCursor rule
- .cursor/rules/agents/security-auditor.mdcCursor rule
- .cursor/rules/dart-flutter-testing.mdcCursor rule
- .cursor/rules/dart-mobile-game-studio.mdcCursor rule
- dart-mobile-game-studioSkill
- dart-mobile-game-studioSkill
- dart-mobile-game-studioSkill
The file
We split this dart-flutter-architecture.mdc into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 24
Don't mix Flutter-UI and Flame in one screen without this decision (flutter-game-architecture.md).
≈ “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: Architecture rules for Dart/Flutter game source — separate game logic from rendering, state machine, modular layout, mode decision. globs: **/*.dart alwaysApply: false --- # Dart/Flutter game architecture rules Applies to Dart source. Keep games testable, adaptable, and small. ## Separate logic from rendering (3 layers) - **Game logic** lives in pure Dart with **no `package:flutter` import** (`lib/models/`, `lib/systems/`). It runs and is unit-tested on the Dart VM with `dart test` — no device, no widget pump. A `package:flutter` import in `lib/models/` is a bug. - **UI** (`lib/widgets/`) and the **engine layer** (Flame in `lib/game/`) are **thin**: they render the model and translate input into model intents. No game rules in widgets/components. ## Mode decision (pick one; justify) - **Flutter-widgets-only** — static/turn-based; `CustomPainter`/`Canvas`, `GestureDetector`/`Draggable`, repaint via `ValueNotifier`/`ListenableBuilder`. - **Flame** — continuous motion/physics; `FlameGame` + `Component`/`PositionComponent`, `update(dt)`/`render`, `HasGameReference<MyGame>`, `CollisionCallbacks`; Forge2D for real physics. - **Hybrid** — `GameWidget` + overlays for menus/HUD over Flame gameplay. Don't mix Flutter-UI and Flame in one screen without this decision (`flutter-game-architecture.md`). ## State machine & state management - Explicit `menu → playing → paused → won/lose → menu` as an `enum`/sealed class; transitions are pure methods returning the next state. Test every transition. - Shell state: `ValueNotifier`/`ChangeNotifier` is enough for most games; Provider/Riverpod/Bloc only if genuinely needed. The model holds truth; the notifier republishes it. ## Time, determinism, layout - Advance by a **clamped** `dt` (`dt.clamp(0.0, 1/30)`); Flame does NOT cap `dt` for you. - Inject a seeded `Random` (`assets/seeded_random.dart`); never global `Random()` in game logic. - Layout with `LayoutBuilder`/`MediaQuery`/`SafeArea` for phones + tablets; support both orientations. ## Code shape - `const` constructors; immutable value-typed models (`final`, `==`/`hashCode`, `copyWith`); small single-purpose files; dispose controllers/notifiers/subscriptions; `flutter analyze`-clean. - Levels are JSON **data**, not code (validate vs `assets/level-schema-template.json`). - Dependencies via `references/package-policy.md` — justify each; default to none. Reference: `references/flutter-game-architecture.md`, `references/flutter-flame-patterns.md`, `references/dart/README.md`, `references/quality-policy.md`.
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.

