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/mrharishkumar/fastapi-cursor-boilerplateWrote 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/mrharishkumar/fastapi-cursor-boilerplate/api-design-and-implementation)<a href="https://agentmods.dev/rules/mrharishkumar/fastapi-cursor-boilerplate/api-design-and-implementation"><img src="https://agentmods.dev/badge/rules/mrharishkumar/fastapi-cursor-boilerplate/api-design-and-implementation/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/mrharishkumar/fastapi-cursor-boilerplate/api-design-and-implementation"><img src="https://agentmods.dev/badge/rules/mrharishkumar/fastapi-cursor-boilerplate/api-design-and-implementation.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.00434 | $0.00434 |
| Opus 5.5 | $0.00174 | $0.00174 |
| Sonnet 5.5 | $0.00087 | $0.00087 |
| Haiku 4.5 | $0.00043 | $0.00043 |
Grade A, and why
api-design-and-implementation 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.
What it actually says
API Design and Implementation
1. Pydantic Validation
- Use Pydantic models for all incoming request bodies and outgoing responses. This ensures automatic data validation and clear API contracts.
- Use
response_modelto define the schema for successful responses. - Use separate Pydantic schemas for creating, updating, and reading resources (e.g., UserCreate, UserUpdate, UserRead).
2. Router Structure
- Create a single
APIRouterinstance per endpoint file. - Use descriptive prefixes when including routers in the main API router.
- Always include proper HTTP status codes, response models, and documentation.
- Use tags to group related endpoints in the API documentation.
- Include docstrings for all endpoint functions.
- Follow RESTful conventions for endpoint paths and HTTP methods.
3. API Router Aggregation
- Import all endpoint routers in
app/api/v1/api.py. - Use meaningful prefixes that match the feature domain.
- Keep the main API router clean and focused on aggregation only.
- Ensure all routers are properly included with appropriate prefixes.
4. Database Configuration and Connection Management
- Database configuration is stored in
app/core/config.pyusing Pydantic Settings. - Use database connection and session management from
app/db/__init__.py. - Use SQLAlchemy's
create_engine()with connection pooling for production. - Implement proper session lifecycle management with dependency injection.
- Use
get_db()dependency function for database sessions in endpoints. - Use database migrations with Alembic for schema changes.
- Implement proper error handling for database connection failures.
5. Logging Standards
- Use module-based naming:
get_logger(__name__)for general module logging.
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 · 39 lines · 434 tokens per session scan A 7ef2c7ed94fd
api-design-and-implementation is a cursor rule published in the GitHub repository mrharishkumar/fastapi-cursor-boilerplate (3 stars, last pushed 1y ago), licensed MIT. It adds 434 tokens to every session, about $0.0017 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other cursor rules, from other repositories
django
Django: models, views, ORM best practices.
django
Django: models, views, ORM best practices.
fastapi
FastAPI: Pydantic v2, dependency injection, async.
flask
Flask: blueprints, error handling, config patterns.
project-main-rules
You are an expert in building production-ready AI agent applications using Python, FastAPI, LangGraph, and LangChain.
python-flask-json-guide-cursorrules-prompt-file
Cursor rules for Python Flask development with JSON guide.