Python FastAPI CLAUDE.md
RulesAgent rules for FastAPI projects with SQLAlchemy, Alembic, and pytest.
2103/23/2026
markdown1 file
CLAUDE.md850 B
CLAUDE.md
Project
Python FastAPI application with SQLAlchemy ORM, Alembic migrations, and pytest.
Commands
uv run fastapi dev— start dev serveruv run pytest— run testsuv run alembic upgrade head— run migrationsuv run ruff check .— lintuv run ruff format .— format
Code Style
- Use type hints everywhere
- Use Pydantic models for request/response schemas
- Use dependency injection for database sessions
- Follow Google Python style guide
- Keep functions under 30 lines
Architecture
- app/api/ — route handlers
- app/models/ — SQLAlchemy models
- app/schemas/ — Pydantic schemas
- app/services/ — business logic
- app/core/ — config, security, deps
Database
- Always create Alembic migrations for schema changes
- Use async SQLAlchemy sessions
- Never use raw SQL — use the ORM