fastapi-expert

Implements async FastAPI endpoints with Pydantic V2 schemas, JWT authentication, and async SQLAlchemy.

1|Updated Jul 2, 2026
One-click install
npx skills add https://github.com/filippolmt/skills --skill fastapi-expert-filippolmt
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fastapi-expert
Source: https://github.com/filippolmt/skills/tree/main/skills/fastapi-expert
Command: npx skills add https://github.com/filippolmt/skills --skill fastapi-expert-filippolmt

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Building production-grade async Python APIs requires coordinating many moving parts—Pydantic V2 validation, async SQLAlchemy sessions, JWT authentication, dependency injection, and async testing—and getting any of them wrong leads to subtle bugs like session leaks, lazy-loading errors, or insecure endpoints. ## Core Features & Use Cases - Endpoint & Schema Implementation: Generates APIRouter endpoints with Pydantic V2 models using field_validator, model_config, and the Annotated dependency-injection pattern. - Authentication & Database Workflows: Provides JWT/OAuth2 flows with role-based access control and async SQLAlchemy 2.0 CRUD operations with proper session management. - Async Testing & Django Migration: Includes pytest-asyncio/httpx test fixtures and a full Django/DRF-to-FastAPI migration guide with concept mapping and incremental strategies. - Use Case: Ask it to build a user registration API, and it produces the Pydantic schemas, router endpoints, CRUD layer, and JWT-protected routes as one cohesive unit. ## Quick Start Ask the assistant to create a FastAPI endpoint for user registration with Pydantic V2 validation, async SQLAlchemy persistence, and JWT authentication.

Frequently Asked Questions about fastapi-expert

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a REST API with FastAPI and Pydantic V2?

Define Pydantic V2 schemas with field_validator and model_config, then create APIRouter endpoints using the Annotated pattern for dependency injection. Return proper HTTP status codes and let FastAPI auto-generate OpenAPI docs at /docs.

How to add JWT authentication to FastAPI endpoints?

Use OAuth2PasswordBearer with python-jose to encode and decode JWT tokens, then create a get_current_user dependency that validates the token. Protect routes by injecting CurrentUser via Annotated[User, Depends(get_current_user)].

Does FastAPI work with async SQLAlchemy for database operations?

Yes, SQLAlchemy 2.0 provides AsyncSession and create_async_engine for fully async database access. Use select() with await db.execute(), eager-load relationships with selectinload, and manage sessions through a get_db dependency.

What is the difference between Pydantic V1 and V2 syntax?

Pydantic V2 replaces @validator with @field_validator, @root_validator with @model_validator, and class Config with model_config. It also uses model_dump() instead of dict() and from_attributes instead of orm_mode.

Why does lazy loading fail in async SQLAlchemy?

Async SQLAlchemy does not support implicit lazy loading because accessing an unloaded relationship requires I/O outside an await context. Eager-load relationships upfront using selectinload or joinedload in your query options.

When should I not migrate from Django to FastAPI?

Avoid migrating when you rely heavily on Django admin, use complex Django ORM model inheritance, need server-side template rendering, or your team lacks async Python experience. Migration cost should not exceed business value.