fastapi-expert

Builds async FastAPI endpoints with Pydantic V2 schemas, JWT authentication, and SQLAlchemy database operations.

Updated Mar 9, 2026
One-click install
npx skills add https://github.com/ArMaTeC/Redball --skill fastapi-expert-armatec
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: fastapi-expert
Source: https://github.com/ArMaTeC/Redball/tree/main/.devin/skills/fastapi-expert
Command: npx skills add https://github.com/ArMaTeC/Redball --skill fastapi-expert-armatec

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. This Skill provides structured guidance and working code patterns so you avoid common mistakes like mixing sync and async code, using deprecated Pydantic V1 syntax, or leaking database sessions. ## Core Features & Use Cases - Endpoint & Schema Implementation: Generate APIRouter endpoints with Pydantic V2 models using field_validator, model_config, and the Annotated dependency injection pattern. - Authentication & Authorization: Implement OAuth2 password flow, JWT access/refresh tokens, password hashing with bcrypt, and role-based access control. - Async Database Operations: Set up async SQLAlchemy 2.0 engines, sessions, models, and CRUD operations with proper eager loading via selectinload. - Use Case: You need to add a user registration endpoint to an existing FastAPI service. The Skill produces the Pydantic schema with password validation, the async CRUD function, and the router endpoint returning a 201 status, plus async pytest tests with httpx. ## Quick Start Ask the AI to create a FastAPI endpoint with Pydantic V2 validation and async SQLAlchemy database access for your resource.

Frequently Asked Questions about fastapi-expert

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

FAQPage Schema
How do I create a FastAPI endpoint with Pydantic V2 validation?▼

Define a Pydantic BaseModel with field_validator methods for custom rules, then use it as the request body type in an APIRouter endpoint. Use the Annotated pattern with Depends for injecting the database session, and set response_model to control the output schema.

How to implement JWT authentication in FastAPI?▼

Use OAuth2PasswordBearer to extract tokens, python-jose to encode and decode JWTs, and passlib with bcrypt for password hashing. Create a get_current_user dependency that decodes the token and loads the user, then inject it into protected endpoints with Annotated.

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 dictionaries. ORM support changes from orm_mode to from_attributes, and .dict() becomes .model_dump().

Does async SQLAlchemy support lazy loading relationships?▼

No, lazy loading raises errors in async SQLAlchemy because it triggers implicit I/O. Use eager loading with selectinload or joinedload in your select queries to load relationships before accessing them.

How do I test FastAPI endpoints asynchronously?▼

Use httpx AsyncClient with ASGITransport pointed at your FastAPI app, and override the database dependency with app.dependency_overrides to inject a test session. Mark tests with pytest.mark.asyncio and create fixtures for test users and auth headers.

When should I not migrate from Django to FastAPI?▼

Avoid migrating when you rely heavily on the Django admin interface, use complex Django ORM model inheritance, need server-side template rendering, or your team lacks async Python experience. Migration is best suited for I/O-bound API workloads needing async performance.