fastapilisted
Install: claude install-skill arbazkhan971/godmode
# FastAPI — FastAPI Mastery
## Activate When
- User invokes `/godmode:fastapi`
- User says "build a FastAPI app", "async API"
- User asks about Pydantic, DI, async endpoints
- When working with Python async backend services
- User says "fastapi route", "FastAPI endpoint", "route for orders"
## Workflow
### Step 1: Project Assessment
```bash
# Detect FastAPI project
grep -l "fastapi" pyproject.toml requirements.txt \
setup.py 2>/dev/null
# Check Python version
python3 --version
# Detect package manager
ls uv.lock poetry.lock Pipfile.lock 2>/dev/null
```
```
FASTAPI ASSESSMENT:
FastAPI version: <0.115.x>
Python: <3.12+ recommended>
ORM: SQLAlchemy 2.0 async | Tortoise | SQLModel
Auth: JWT | OAuth2 | API keys
Package manager: uv (preferred) | Poetry | pip
IF Python < 3.12: recommend upgrade for performance
IF using sync psycopg2: must migrate to asyncpg
IF no Alembic: add migration support immediately
```
```
PROJECT STRUCTURE:
app/
├── main.py # FastAPI app factory
├── config.py # pydantic-settings
├── dependencies.py # Shared DI (DB, auth)
├── api/v1/
│ ├── router.py # Aggregates all v1 routes
│ ├── orders.py # Order endpoints
│ └── customers.py # Customer endpoints
├── models/ # SQLAlchemy models
├── schemas/ # Pydantic schemas
├── services/ # Business logic
└── tests/
```
### Step 2: Pydantic Model Design
```
PYDANTIC PATTERNS:
| Pattern | Usage |
|----------------------