Fastapi Expert
Use when building high-performance async Python APIs with FastAPI and Pydantic V2.
Before & after
Same prompt, same agent — the only difference is the skill.
FastAPI is a great framework for building APIs in Python. You'll want to set up a basic FastAPI app with some endpoints. For authentication, you should use JWT tokens. You'll need to create Pydantic models to define your request and response schemas. For database operations, you should use an async-compatible library like SQLAlchemy with async mode. You might want to add error handling and validation to your endpoints. OpenAPI documentation is automatically generated by FastAPI, which is helpful. You should test your endpoints to make sure they work correctly. It's also good to think about deployment and how you'll run the API in production. Would you like help with any specific part of setting up the API?
FASTAPI ENDPOINT: /api/v1/tasks (with JWT + Async DB)
PYDANTIC MODELS
class TaskCreate(BaseModel):
title: str (min_length=1, max_length=255)
description: Optional(str) = None
priority: Literal['low', 'medium', 'high']
class TaskResponse(BaseModel):
id: int
title: str
created_at: datetime
model_config = ConfigDict(from_attributes=True)
ENDPOINT DEFINITION
@app.post('/api/v1/tasks', response_model=TaskResponse, status_code=201)
async def create_task(
task: TaskCreate,
current_user: User = Depends(get_current_user),
db: AsyncSession = Depends(get_db)
) -> TaskResponse:
db_task = Task(title=task.title, user_id=current_user.id)
db.add(db_task)
await db.commit()
await db.refresh(db_task)
return db_task
ASYNC DATABASE SETUP
engine = create_async_engine('postgresql+asyncpg://user:pass@localhost/db')
async_session = sessionmaker(engine, class_=AsyncSession, expire_on_commit=False)
async def get_db():
async with async_session() as session:
yield session
JWT AUTHENTICATION
SECRET_KEY = 'your-secret-key'
ALGORITHM = 'HS256'
def create_access_token(data: dict, expires_delta: timedelta):
to_encode = data.copy()
to_encode.update({'exp': datetime.utcnow() + expires_delta})
return jwt.encode(to_encode, SECRET_KEY, algorithm=ALGORITHM)
ERROR HANDLING
@app.exception_handler(ValueError)
async def value_error_handler(request: Request, exc: ValueError):
return JSONResponse(status_code=400, content={'detail': str(exc)})
OPENAPI DOCUMENTATION (auto-generated)
Visible at: /docs (Swagger UI)
Includes: All endpoints, schemas, auth requirements
Export: /openapi.json for client code generationAbout this skill
name: fastapi-expert description: Use when Use when building high-performance async Python APIs with FastAPI and Pydantic V2.
Fastapi Expert
Use when building high-performance async Python APIs with FastAPI and Pydantic V2. Invoke to create REST endpoints, define Pydantic models, implement authentication flows, set up async SQLAlchemy database operations, add JWT authentication, build WebSocket endpoints, or generate OpenAPI documentation. Trigger terms: FastAPI, Pydantic, async Python, Python API, REST API Python, SQLAlchemy async, JWT authentication, OpenAPI, Swagger Python.
What you get
- Public GitHub repo
- the skills/fastapi-expert folder with SKILL.md and references.
Customize your output
- Fork the repo and extend the skill's reference files for your own stack conventions.
Example output
Activates on a matching request (e.g. building or reviewing Fastapi Expert code) and can chain with other skills in the pack.
Best for
Full-stack developers and engineering teams using Claude Code.
SKILL.md preview
---
name: fastapi-expert
description: Use this skill when building high-performance async Python APIs with FastAPI and Pydantic V2, including auth, database integration, and WebSockets.
version: 1.0.0
category: Development / Backend
author: AgentVolt
license: proprietary
tags:
- development
- backend
---
# Fastapi Expert
Builds high-performance async Python APIs with FastAPI and Pydantic V2, covering endpoint design, authentication, async database access, and real-time features.
## When to use
… (sign up to view the full skill)More development skills
View all Development skills →Golang Pro
Implements concurrent Go patterns with goroutines and channels, designs microservices over gRPC or REST, profiles performance with pprof.
Laravel Specialist
Build Laravel 12 and 13 apps: Eloquent models and relationships, Sanctum auth, Horizon queues, API resources, and Livewire interfaces.
API Designer
Use when designing REST or GraphQL APIs, creating OpenAPI specifications, or planning API architecture.
Django Expert
Use when building Django web applications or REST APIs with Django REST Framework.