Rule
0 installs · 0 said it worked
Cursor rules enforcing FastAPI and Python 3.12 best practices
A Cursor rules file that tells the assistant to write Python 3.12 FastAPI code using pydantic, sqlalchemy, alembic, and related libraries, and to follow general Python style, typing, docstring, and testing practices.
People use this for
- fastapi cursor rules
- python fastapi coding standards
- write fastapi code with pydantic
- cursor rules for python web api
- make ai assistant follow fastapi best practices
- Name
cursor-rules-enforcing-fastapi-and-python-312-best-practices- Works with
- Cursor
- License
- CC0(as observed at the source)
- Version
- v1 · updated Nov 29, 2026
Imported on Nov 29, 2026 from github.com . License observed at the source on Nov 29, 2026: CC0.
Are you the author?Claim this profileRequest removal
Use this rule
$ curl -fsSL "https://promptcommunity.dev/api/v1/posts/cursor-rules-enforcing-fastapi-and-python-312-best-practices-ysne/export/mdc" -o .cursor/rules/cursor-rules-enforcing-fastapi-and-python-312-best-practices.mdcThen open a new session; Cursor picks it up from .cursor/rules/.
Manual install
Save cursor-rules-enforcing-fastapi-and-python-312-best-practices.mdc as .cursor/rules/cursor-rules-enforcing-fastapi-and-python-312-best-practices.mdc for this project or ~/.cursor/rules/cursor-rules-enforcing-fastapi-and-python-312-best-practices.mdc for every project, then start a new session.
Rule
description: "Cursor rules for Python FastAPI development with best practices." globs: */ alwaysApply: false
Here are some best practices and rules you must follow:
- You use Python 3.12
- Frameworks:
- pydantic
- fastapi
- sqlalchemy
- You use poetry for dependency management
- You use alembic for database migrations
- You use fastapi-users for user management
- You use fastapi-jwt-auth for authentication
- You use fastapi-mail for email sending
- You use fastapi-cache for caching
- You use fastapi-limiter for rate limiting
- You use fastapi-pagination for pagination
- Use Meaningful Names: Choose descriptive variable, function, and class names.
- Follow PEP 8: Adhere to the Python Enhancement Proposal 8 style guide for formatting.
- Use Docstrings: Document functions and classes with docstrings to explain their purpose.
- Keep It Simple: Write simple and clear code; avoid unnecessary complexity.
- Use List Comprehensions: Prefer list comprehensions for creating lists over traditional loops when appropriate.
- Handle Exceptions: Use try-except blocks to handle exceptions gracefully.
- Use Virtual Environments: Isolate project dependencies using virtual environments (e.g.,
venv). - Write Tests: Implement unit tests to ensure code reliability.
- Use Type Hints: Utilize type hints for better code clarity and type checking.
- Avoid Global Variables: Limit the use of global variables to reduce side effects.
These rules will help you write clean, efficient, and maintainable Python code.
No result recorded yet. Added it? File a Tried-it report so the next person knows how it went in your editor.
Tried it
Reports from people who added this rule to their editor. They roll up into the badges above.
No one has filed a report yet. Try the prompt and be the first.
Related rules
- Python docstring coverage and drift checker for code review
A skill-style system prompt that makes the assistant measure Python docstring coverage via AST analysis, flag stale or missing docstrings, and plan a CI-gated documentation fix.
Coding · @f
- Claude api: reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming,…
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER — read BEFORE opening the target file; don't skip because it "looks like a one-liner" — whenever: the prompt names Claude/Anthropic in any fo
Coding · @anthropic
- Cursor rules for writing and testing Xian smart contracts in Python
A Cursor rules file that guides the assistant through writing Xian blockchain smart contracts in Python, covering naming, state, context variables, events, error handling, and unittest-based testing with security checks.
Coding · @patrickjs
- Agent role that turns TypeScript typing work into a tracked TODO plan
A senior TypeScript type-expert role prompt covering type design, generics, narrowing, and migration, with a required output of TODO_ts-type-expert.md containing checkable task items.
Coding · @wkaandemir
- Context7 agent that answers library questions from up-to-date docs
Agent instructions that force lookup of current library documentation via Context7 before answering framework or package questions, and check workspace versions for upgrades.
Coding · @joembolinas
License: CC0v1 · published Nov 29, 2026
Comments
No comments yet. If you tried this prompt, say how it went.