From fastapi-pro
FastAPI patterns, Pydantic, async SQL, dependency injection, WebSocket, testing. Use when building or reviewing FastAPI services.
How this skill is triggered — by the user, by Claude, or both
Slash command
/fastapi-pro:fastapi-proThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Build production-grade FastAPI applications with proper dependency injection, async patterns, validation, testing, and OpenAPI documentation.
Build production-grade FastAPI applications with proper dependency injection, async patterns, validation, testing, and OpenAPI documentation.
Use this when:
Use this ESPECIALLY when:
Don't skip when:
BackgroundTasks and Celery has operational consequencesCanonical layout: app/main.py (factory + lifespan), config.py (pydantic-settings), dependencies.py (shared DI), models/, schemas/, routers/, services/, tasks/, tests/, migrations/. See REFERENCE.md for the full directory tree.
Use pydantic-settings BaseSettings with a singleton settings = Settings(). Fields: database_url, redis_url, jwt_secret, jwt_algorithm, access_token_expire_minutes, environment. See REFERENCE.md for the full config.py snippet.
Chain get_db → get_current_user → get_admin_user using Depends. Each dependency yields an AsyncSession or raises HTTPException. See REFERENCE.md for the full dependencies.py example with JWT verification.
Routers declare prefix, tags, and inject db/user via Depends. Paginated list endpoints take page/per_page/filter Query params and return a PaginatedResponse. See REFERENCE.md for list_projects and create_project examples.
Request schemas use Field validators; response schemas set model_config = ConfigDict(from_attributes=True) for ORM serialization. Wrap list endpoints in a generic PaginatedResponse[T]. See REFERENCE.md for CreateProjectRequest, ProjectResponse, and PaginatedResponse definitions.
Business logic lives in services/, separate from routers. Services receive an AsyncSession and return typed results. Count queries use func.count() with a matching WHERE clause. See REFERENCE.md for the ProjectService.list example with offset pagination.
Define an AppError(Exception) with code, message, status, and register a global @app.exception_handler(AppError) that returns a consistent {"error": {"code": ..., "message": ...}} JSON shape. See REFERENCE.md for the handler and usage examples.
Use httpx.AsyncClient with ASGITransport against the real app and a real test DB. Fixtures: app, client, db_session — all async. Mark tests with @pytest.mark.asyncio. See REFERENCE.md for the full conftest.py and a sample test.
Use FastAPI's BackgroundTasks for lightweight async work (e.g. welcome emails). Use Celery for heavy production work (e.g. report generation). See REFERENCE.md for both patterns with code examples.
from_attributes=True for ORM* in production)/health)npx claudepluginhub haj1t/senior-dev-squad-skills --plugin fastapi-proSearches MemPalace before answering questions about past work, people, projects, or prior decisions. Returns verbatim stored content instead of guessing from model memory.
Guides Payload CMS config (payload.config.ts), collections, fields, hooks, access control, APIs. Debugs validation errors, security, relationships, queries, transactions, hook behavior.
Implements vector databases with Pinecone, Weaviate, Qdrant, Milvus, pgvector for semantic search, RAG, recommendations, and similarity systems. Optimizes embeddings, indexing, and hybrid search.