Engineering FastAPIPydanticAsync Python

FastAPI Developer

FastAPI development: Pydantic v2 models, dependency injection, async patterns, background tasks, WebSocket endpoints, OpenAPI customization, and deployment.

A FastAPI expert covering Pydantic v2's model validators and computed fields, FastAPI's dependency injection for database sessions and auth, background task patterns with asyncio and Celery, and production deployment on gunicorn+uvicorn. Designs type-safe APIs where the OpenAPI schema and the Python types are always in sync.

Added Mar 20, 2026

$npx skills add johnefemer/skillfish --skill fastapi-developer

What This Skill Can Do

Concrete capabilities you get when you install this skill.

Design Pydantic v2 models with field validators, model validators, and computed fields

Implement dependency injection for DB sessions, auth tokens, and feature flags

Build async endpoints with asyncpg or SQLAlchemy async and proper connection pooling

Add background tasks with FastAPI BackgroundTasks or Celery for long-running jobs

Implement WebSocket endpoints with connection management and pub/sub patterns

Deploy FastAPI with gunicorn + uvicorn workers, health checks, and Prometheus metrics

Real Conversations

See how the FastAPI Developer skill responds to actual requests. These are representative examples of what your AI agent will produce.

You

I want to implement JWT bearer token authentication in FastAPI using a dependency so I can protect routes with just Depends(get_current_user). How do I set this up?

Agent

Here's a complete JWT auth dependency using python-jose:

from fastapi import Depends, HTTPException, status
from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
from jose import JWTError, jwt
from pydantic import BaseModel
import os

JWT_SECRET = os.environ["JWT_SECRET"]
ALGORITHM = "HS256"

bearer_scheme = HTTPBearer()

class TokenPayload(BaseModel):
    sub: str
    exp: int

async def get_current_user(
    credentials: HTTPAuthorizationCredentials = Depends(bearer_scheme),
    db: AsyncSession = Depends(get_db),
) -> User:
    token = credentials.credentials
    try:
        payload = jwt.decode(token, JWT_SECRET, algorithms=[ALGORITHM])
        data = TokenPayload(**payload)
    except (JWTError, ValueError):
        raise HTTPException(
            status_code=status.HTTP_401_UNAUTHORIZED,
            detail="Invalid or expired token",
            headers={"WWW-Authenticate": "Bearer"},
        )
    user = await db.get(User, data.sub)
    if user is None:
        raise HTTPException(status_code=404, detail="User not found")
    return user

# Route usage — inject the dependency
@router.get("/me", response_model=UserResponse)
async def get_me(current_user: User = Depends(get_current_user)):
    return current_user

# Admin route — compose dependencies
async def require_admin(user: User = Depends(get_current_user)) -> User:
    if not user.is_admin:
        raise HTTPException(status_code=403, detail="Admin required")
    return user

The HTTPBearer scheme auto-populates the OpenAPI docs with a Bearer token input. Compose require_admin on top of get_current_user without duplicating auth logic.

Get Started

How to install and use this skill in your preferred environment.

Skills are designed for AI coding agents (Claude Code, Cursor, Windsurf) and IDE-based workflows where the agent can read files, run scripts, and act on your codebase.

Models & Context

Which AI models and context windows work best with this skill.

Recommended Models

Claude Sonnet 4 or GPT-4o for FastAPI patterns and Pydantic v2 validators. Pydantic v2 has breaking changes from v1 — verify model syntax against the v2 migration guide.

Context Window

SKILL.md ~4KB. Fits in 32K context; large multi-router app structures benefit from 64K+.

Pro tips for best results

1

Be specific

Include numbers — users, budget, RPS — so the skill can size the architecture.

2

Share constraints

Compliance needs, team size, and existing stack all improve the output.

3

Iterate

Start with a high-level design, then ask follow-ups for IaC, cost analysis, or security review.

4

Combine skills

Pair with companion skills below for end-to-end coverage.

Works Great With

These skills complement FastAPI Developer for end-to-end coverage. Install them together for better results.

$ skillfish add johnefemer/skillfish --all # install all skills at once

Ready to try FastAPI Developer?

Install the skill and start getting expert-level guidance in your workflow — any agent, any IDE.

$npx skills add johnefemer/skillfish --skill fastapi-developer
← Browse all skills