Agent skill · software engineering · aiskillstore
python-fastapi
Python FastAPI development with uv package manager, modular project structure, SQLAlchemy ORM, and production-ready patterns.
Why this skill is useful
Provides a modular project structure and specific commands for setting up FastAPI with SQLAlchemy that the AI wouldn't reliably generate on its own.
What it needs
Requires uv installed locally. About 7k tokens when loaded. Last updated 2026-08-07. 405 stars on the source repository.
What this skill does
Python FastAPI Development Expert patterns for building Python APIs with FastAPI, uv package manager, modular architecture, and SQLAlchemy database integration. Technology Stack Runtime: Python 3.12+ Package Manager: uv (fast, Rust-based) Framework: FastAPI ORM: SQLAlchemy 2.0 (async) Validation: Pydantic v2 Database: PostgreSQL (or SQLite for dev) Migrations: Alembic Testing: pytest, pytest-asyncio Linting: ruff Project Structure Feature-based modular architecture - code organized by domain, not by layer: Quick Setup with uv Core Patterns pyproject.toml Configuration (src/app/config.py) Database Setup (src/app/database.py) SQLAlchemy Base Model (src/app/models/base.py) Feature Module Pattern Each feature is self-contained with its own api, schemas, services, models, and utils. Feature: users/schemas.py Feature: users/models.py Feature: users/repository.py Feature: users/services.py Feature: users/api.py Feature: users/init.py (exports) Main Router (src/app/api/router.py) FastAPI App (src/app/main.py) Database Migrations with Alembic Async Alembic env.py Testing conftest.py Example Test Running the Application Best Practices 1. Layered Architecture Routes: Handle HTTP, validation, response formatting Services: Business logic, orchestration Repositories: Data access, queries 2. Dependency Injection Use FastAPI's Depends() for clean DI Inject database sessions, services, configs 3. Type Safety Use Pydantic for all request/response schemas Use SQLAlchemy 2.0 mapped columns with types Enable strict mypy 4. Async First Use async/await throughout Use asyncpg for PostgreSQL Use aiosqlite for testing 5. Configuration Use pydantic-settings for type-safe config Load from environment variables Never commit secrets 6. Testing Use in-memory SQLite for unit tests Use test containers for integration tests Mock external services
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills aiskillstore/python-fastapi