fastapi-patterns
SKILL.md
FastAPI / Modern Python API
When to use this skill
- Building high-performance APIs with FastAPI.
- Defining Pydantic models.
- Structuring API projects.
1. Structure
- Routers: Split routes into modules (
app/routers/users.py) and include them inmain.py. - Dependencies: Use Dependency Injection (
Depends()) for DB sessions, auth, and shared logic.
2. Pydantic Models
- Separation: Create separate models for Input (
UserCreate), Output (UserResponse), and Database (UserDB). - Validation: Use strict Types and
Field(...)for validation metadata.
3. Async
- Def vs Async Def: Use
async deffor endpoints that await I/O (DB, HTTP). Usedefonly if blocking CPU.
Weekly Installs
3
Repository
sraloff/gravitybootsGitHub Stars
2
First Seen
Feb 21, 2026
Security Audits
Installed on
opencode3
gemini-cli3
github-copilot3
codex3
kimi-cli3
amp3