Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
git clone --depth 1 https://github.com/nedcodes-ok/cursor-doctorWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/rules/nedcodes-ok/cursor-doctor/flask)<a href="https://agentmods.dev/rules/nedcodes-ok/cursor-doctor/flask"><img src="https://agentmods.dev/badge/rules/nedcodes-ok/cursor-doctor/flask/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/rules/nedcodes-ok/cursor-doctor/flask"><img src="https://agentmods.dev/badge/rules/nedcodes-ok/cursor-doctor/flask.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00465 | $0.00465 |
| Opus 5.5 | $0.00186 | $0.00186 |
| Sonnet 5.5 | $0.00093 | $0.00093 |
| Haiku 4.5 | $0.00047 | $0.00047 |
Grade A, and why
flask scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
This is a copy
100% identical to flask — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.
How it starts
The opening of the file, as written. The whole thing — 45 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Flask Cursor Rules
You are an expert Flask developer. Follow these rules:
Application Structure
- Application factory pattern (create_app) for all projects. No module-level app instances
- One Blueprint per feature domain. Register in create_app, not at import time
- Config classes per environment: DevelopmentConfig, ProductionConfig, TestingConfig
- Store secrets in environment variables, load via os.environ.get() with no defaults for required values
Blueprints & Routes
- Prefix all blueprint URLs: bp = Blueprint('auth', name, url_prefix='/auth')
- Use @bp.before_request for blueprint-scoped middleware (auth checks, rate limiting)
- Return consistent JSON responses: {"data": ..., "error": null} or {"data": null, "error": {...}}
- Use flask.abort() with custom error messages, never raise raw HTTP exceptions
Error Handling
- Register @app.errorhandler for 400, 401, 403, 404, 422, 500 globally
- Return JSON error responses with status code, message, and request_id
- Log exceptions with app.logger, not print(). Configure structured logging
- Never expose stack traces in production responses
Database (SQLAlchemy)
- Use Flask-SQLAlchemy with scoped sessions. Call db.session.remove() in teardown
- Models in app/models/, one file per domain entity
- Always db.session.commit() in try/except with db.session.rollback() in except
- Use Flask-Migrate for all schema changes, never db.create_all() in production
Request Handling
- Validate request data with marshmallow or pydantic, not manual dict checks
- Use @login_required decorator, never check session manually in route body
- File uploads: validate content type and size before saving. Use secure_filename()
- Set CSRF protection on all forms. Use Flask-WTF or manual token validation
Testing
- Use app.test_client() with application context. Fixture: yield create_app('testing')
- Separate test database. Use transactions for test isolation, rollback after each test
- Test error handlers explicitly — don't assume Flask defaults are correct
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 1mo ago First seen · 45 lines · 465 tokens per session scan A 3ea930bb0550
flask is a cursor rule published in the GitHub repository nedcodes-ok/cursor-doctor (9 stars, last pushed 7mo ago), licensed MIT. It adds 465 tokens to every session, about $0.0019 per session on Opus 5.5. A static security scan graded it A with 0 findings. It is 100% identical to flask, differing in 0 lines, and is treated as a copy.
Other cursor rules, from other repositories
django
Django: models, views, ORM best practices.
cursorrules
You are building an AI/ML project with Python. The project uses PyTorch for model training, handles data pipelines with proper validation, tracks experiments systematically, and follows production ML engineering practices. Code is type-hinted, tested, and reproducible.
10-backend-fastapi
FastAPI backend rules.
spring-boot
Spring Boot: annotations, dependency injection, JPA patterns.
python
Python best practices: type hints, pathlib, pytest, clean error handling.
bun
Bun runtime: Bun.serve, Bun.file, bundler, test runner.