This README explains the Cursor Rules defined in flask_architecture_rules.mdc and how they keep your Flask codebase clean, layered, and consistent.
Cursor Rules are version‑controlled system prompts that Cursor automatically injects into the AI context whenever you work inside this repository. They make sure every contributor—and the AI assistant—follows the same architecture guidelines without copy‑pasting reminders into each chat.
Put the rule file under
.cursor/rules/so it is committed with the code and shared with the whole team.
The Rules enforce the import flow → routes → services → integrations|models (no upward or circular imports).
- No data‑access code outside
app/models/. - No business logic inside
app/routes/. - Public functions must include type hints and docstrings.
- Custom
AppErrorexceptions propagate upward;routestranslate them into HTTP responses. - Unit tests should mock lower layers to keep boundaries clear.
These checks are applied automatically when AI generates or edits code in matching globs declared in the .mdc file.
project_root/
│ README.md ← you are here
│
└─ .cursor/
└─ rules/
├─ flask_architecture_rules.mdc ← actual rule definitions
└─ … (add more rule files as needed)
Add more rule files for other concerns (frontend, CI workflows, coding style guides). Cursor will merge all active rules into the context.
- Edit
flask_architecture_rules.mdcto tweak responsibilities, add new globs, or change descriptions. - Commit changes so every team member benefits.
- (Optional) Run
/Generate Cursor Rulesin a Cursor chat to let the AI summarize new decisions into a fresh rule file.
If the AI suggests code that violates these rules, remind it by referencing the rule file in chat: @flask_architecture_rules. Cursor will re‑inject the rule into the context for that conversation.
Enjoy a predictable, clean Flask codebase! ✨
