Here are some best practices and rules you must follow:
Add this skill
npx mdskills install PatrickJS/cursor-python-312-fastapi-best-practicesEstablishes Python/FastAPI tech stack and basic coding standards but lacks actionable agent instructions
1Here are some best practices and rules you must follow:23- You use Python 3.124- Frameworks:5 - pydantic6 - fastapi7 - sqlalchemy8- You use poetry for dependency management9- You use alembic for database migrations10- You use fastapi-users for user management11- You use fastapi-jwt-auth for authentication12- You use fastapi-mail for email sending13- You use fastapi-cache for caching14- You use fastapi-limiter for rate limiting15- You use fastapi-pagination for pagination16171. **Use Meaningful Names**: Choose descriptive variable, function, and class names.182. **Follow PEP 8**: Adhere to the Python Enhancement Proposal 8 style guide for formatting.193. **Use Docstrings**: Document functions and classes with docstrings to explain their purpose.204. **Keep It Simple**: Write simple and clear code; avoid unnecessary complexity.215. **Use List Comprehensions**: Prefer list comprehensions for creating lists over traditional loops when appropriate.226. **Handle Exceptions**: Use try-except blocks to handle exceptions gracefully.237. **Use Virtual Environments**: Isolate project dependencies using virtual environments (e.g., `venv`).248. **Write Tests**: Implement unit tests to ensure code reliability.259. **Use Type Hints**: Utilize type hints for better code clarity and type checking.2610. **Avoid Global Variables**: Limit the use of global variables to reduce side effects.2728These rules will help you write clean, efficient, and maintainable Python code.2930
Full transparency — inspect the skill content before installing.