Home / Cursor rules / Python Fastapi
Python Fastapi
Cursor rules for Python Fastapi.
Cursor rules (.mdc)Public domain (CC0)
–unranked
Install
mkdir -p .cursor/rules && curl -sL https://raw.githubusercontent.com/PatrickJS/awesome-cursorrules/b044f956f021b6e8877f16781bcfc466a6a120e9/rules/python-fastapi-cursorrules-prompt-file.mdc -o .cursor/rules/python-fastapi.mdcDownloads the file at commit b044f956f021 into .cursor/rules/.
To remove it later:
rm .cursor/rules/python-fastapi.mdcContext cost: ≈273 tokens when used.
Rules file
---
description: "Cursor rules for Python Fastapi."
globs: **/*
alwaysApply: false
---
# Python FastAPI .cursorrules
# FastAPI best practices
fastapi_best_practices = [
"Use Pydantic models for request and response schemas",
"Implement dependency injection for shared resources",
"Utilize async/await for non-blocking operations",
"Use path operations decorators (@app.get, @app.post, etc.)",
"Implement proper error handling with HTTPException",
"Use FastAPI's built-in OpenAPI and JSON Schema support",
]
# Folder structure
folder_structure = """
app/
main.py
models/
schemas/
routers/
dependencies/
services/
tests/
"""
# Additional instructions
additional_instructions = """
1. Use type hints for all function parameters and return values
2. Implement proper input validation using Pydantic
3. Use FastAPI's background tasks for long-running operations
4. Implement proper CORS handling
5. Use FastAPI's security utilities for authentication
6. Follow PEP 8 style guide for Python code
7. Implement comprehensive unit and integration tests
"""
Security
Scanned Nov 4, 2026 at commit b044f956f021, with Cisco's open-source skill-scanner.
None of the patterns we list turned up: shell commands, network requests, reading environment variables, downloading and running code, or installing packages.
A scan lists patterns in the code. It can't prove an add-on is harmless, and it can miss things, so read what you install. How we scan