Agent skill · software engineering · davila7
fastapi-endpoint
Plan and build production-ready FastAPI endpoints with async SQLAlchemy, Pydantic v2 models, dependency injection for auth, and pytest tests. Uses interview-driven planning to clarify data models, authentication method, pagination strategy, and caching before writing any code.
Why this skill is useful
Provides specific patterns and practices for building FastAPI endpoints with async SQLAlchemy and Pydantic that the AI wouldn't reliably generate on its own.
What it needs
Requires fastapi, pytest, python, sqlalchemy installed locally. About 7k tokens when loaded. Last updated 2026-08-06. 30,138 stars on the source repository.
What this skill does
FastAPI Endpoint Builder When to use Use this skill when you need to: Add new API endpoints to an existing FastAPI project Build CRUD operations with proper validation and error handling Set up authenticated endpoints with dependency injection Create async database queries with SQLAlchemy 2.0 Generate complete test coverage for API routes Phase 1: Explore (Plan Mode) Enter plan mode. Before writing any code, explore the existing project to understand: Project structure Find the FastAPI app entry point (main.py, app.py, or app/init.py) Identify the router organization pattern (single file vs routers/ directory) Check for existing models/, schemas/, crud/, or services/ directories Look at pyproject.toml or requirements.txt for installed dependencies Existing patterns How are existing endpoints structured? (function-based vs class-based) What ORM is used? (SQLAlchemy 2.0 async, Tortoise, raw SQL, none) How is the database session managed? (Depends(getdb), middleware, other) What auth pattern exists? (OAuth2PasswordBearer, API key header, custom) Are there existing Pydantic base models or shared schemas? What response format is standard? (direct model, wrapped {"data": ..., "meta": ...}) Test patterns Where do tests live? (tests/, test.py, test.py) What test client is used? (httpx AsyncClient, TestClient, pytest-asyncio) Are there test fixtures for database and auth? Phase 2: Interview (AskUserQuestion) Use AskUserQuestion to clarify requirements. Ask in rounds — do NOT dump all questions at once. Round 1: Core endpoint Round 2: Data model (if new resource) Round 3: Auth and access control Round 4: Pagination, filtering, caching Phase 3: Plan (ExitPlanMode) Write a concrete implementation plan covering: 1. Files to create/modify — exact paths based on project structure discovered in Phase 1 2. Pydantic schemas — Create, Update, Response, and List schemas with field types 3. SQLAlchemy model — table name, columns, relationships, indexes 4. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills davila7/fastapi-endpoint