Guide · Agent skill
How to use the FastAPI Expert agent skill
Updated · written with AI from the project's own documentation and checked against our catalogue data
The FastAPI Expert skill (fastapi-expert) is an agent skill that gives an AI coding agent a structured playbook for building Python web APIs with FastAPI, Pydantic V2 and async SQLAlchemy. It is aimed at Python developers starting or extending a FastAPI backend, and at teams moving an existing Django or DRF project toward async FastAPI. After this guide you will know what the skill changes about the agent's behaviour, how to install it, how to trigger it, and what to check before anything it writes goes near production.
Quick start
- 1Download the ZIP. Download the fastapi-expert ZIP from this page.
- 2Unzip into a skills folder. Unzip it into ~/.claude/skills/ for personal use, or into your project's .claude/skills/ folder for one project.
- 3Or upload it in the Claude apps. In the Claude apps, go to Settings → Capabilities → Skills and upload the ZIP.
- 4Make a specific request. Describe the endpoint, model or auth flow you need and mention FastAPI or Pydantic.
- 5Run the tests. Ask the agent to write pytest tests with httpx and run them after each endpoint group.
- 6Review before deploying. Check the auth code, secret handling and configuration yourself before any production use.
What is an agent skill and what does this one make the agent do?
An agent skill is a folder containing a SKILL.md file and optional reference files. When it is installed, the agent can load it and follow its instructions for matching tasks, instead of relying only on general knowledge. The skill is described as an expert playbook for production-style FastAPI work.
With this skill installed, the agent follows a core workflow: analyse requirements (endpoints, data models, auth needs), design Pydantic V2 schemas, implement async endpoints with dependency injection, add authentication, and write async tests with pytest and httpx. It is instructed to run pytest after each endpoint group and to check the OpenAPI docs at /docs before moving on.
- Writes request and response models that validate data with Pydantic V2, using field_validator, model_validator and model_config.
- Sets up async database access with SQLAlchemy, including an async engine, session and models.
- Adds JWT login tokens using an OAuth2 password flow and a get_current_user dependency.
- Builds REST endpoints with APIRouter and can add WebSocket endpoints.
- Writes pytest tests using pytest-asyncio and httpx.
- Loads reference notes on WebSockets, routing, and migrating from Django when relevant.
How do you install the FastAPI Expert skill?
Download the ZIP for this skill from this page. Then choose one of the two install locations below. The skill's folder should end up containing SKILL.md and its references folder.
For a personal install available in all your projects, unzip the download into ~/.claude/skills/. For a single project, unzip it into that project's .claude/skills/ folder instead.
In the Claude apps, you can instead upload the ZIP under Settings → Capabilities → Skills.
- Personal install: ~/.claude/skills/
- Project install: .claude/skills/ inside your project
- Claude apps: Settings → Capabilities → Skills, then upload the ZIP
How do you trigger the skill with a natural request?
You do not need a special command. Describe the API task in plain language and mention FastAPI, Pydantic, or one of the other trigger terms. The skill's description lists the trigger terms: FastAPI, Pydantic, async Python, Python API, REST API Python, SQLAlchemy async, JWT authentication, OpenAPI, Swagger Python.
Good requests name the thing you want built and the context around it. The more specific you are about endpoints and data, the more closely the output will match what you need.
- "Using FastAPI and Pydantic V2, create a REST endpoint to register users with email and password."
- "Add JWT login to my FastAPI app with a /auth/token endpoint and a get_current_user dependency."
- "Set up async SQLAlchemy sessions for my FastAPI project and show the User model."
- "Write pytest tests with httpx for my FastAPI order endpoints."
- "Migrate this Django REST Framework view to a FastAPI router."
What does a typical output look like?
For implementation tasks the skill's output template asks for a schema file with Pydantic models, an endpoint file with a router, CRUD operations if a database is involved, and a short explanation of key decisions. The skill includes a minimal example of this pattern: a UserCreate schema with an email and password check, a UserResponse schema, a users router with a 409 response for duplicate emails, and a crud module that hashes the password before saving.
The bundled JWT snippet shows an access token built with python-jose using the HS256 algorithm and a 30-minute default expiry. The snippet uses a placeholder for the secret key, and the skill's own comment says to load it from environment settings instead.
from fastapi import APIRouter, Depends, HTTPException, status
from sqlalchemy.ext.asyncio import AsyncSession
from typing import Annotated
router = APIRouter(prefix="/users", tags=["users"])
@router.post("/", response_model=UserResponse, status_code=status.HTTP_201_CREATED)
async def create_user(payload: UserCreate, db: DbDep) -> UserResponse:
existing = await crud.get_user_by_email(db, payload.email)
if existing:
raise HTTPException(status_code=status.HTTP_409_CONFLICT, detail="Email already registered")
return await crud.create_user(db, payload)What do you need before using it?
The skill assumes you already have a Python environment. It lists Python, FastAPI, Pydantic V2, async SQLAlchemy, python-jose (for the JWT example), pytest, pytest-asyncio and httpx. The agent writes code; it does not install these for you in the skill's instructions, so you need to have them set up in the project you run the code in.
The output is code that still needs to be run and reviewed by you. This skill is not a finished application generator.
- Python with FastAPI and Pydantic V2
- SQLAlchemy with async support
- python-jose for the JWT example
- pytest, pytest-asyncio and httpx for tests
What are the safety notes?
According to the listing, this skill does not run scripts and does not use the network. It works by giving the agent instructions and reference text, and the code it produces is what you run.
Security is the main caveat. The sample JWT code uses a placeholder secret key, and the skill's own examples note that configuration should come from environment settings rather than being hardcoded. Before deploying any authentication, have a person review the secret handling, password hashing, token expiry and authorisation rules.
- Runs scripts: no
- Uses network: no
- Replace the placeholder SECRET_KEY with a value loaded from your environment or settings.
- Review all auth code manually before production use.
Tips for getting better results
Give the agent your existing project structure, such as where the database session and models live, so it can match your imports rather than inventing new ones. Ask it to run pytest after each endpoint group, since the skill's workflow expects that. Check /docs after each change to confirm the endpoints you intended are the ones exposed.
- Share your current models and settings file so the output fits your code.
- Ask for tests alongside each endpoint, not at the end.
- Ask the agent to explain key decisions, as its output template includes this.
What people use it for
- Create a user registration endpoint with Pydantic V2 validation and a duplicate-email check.
- Add JWT login with an OAuth2 password flow and a get_current_user dependency to an existing API.
- Set up an async SQLAlchemy engine, session and models for a FastAPI project.
- Write async pytest tests with httpx for a group of REST endpoints.
- Plan a migration of a Django or DRF view toward a FastAPI router, using the migration reference notes.
Frequently asked questions
How do I install the FastAPI Expert skill?
Download the ZIP from this page and unzip it into ~/.claude/skills/ for personal use, or into a project's .claude/skills/ folder. You can also upload the ZIP in the Claude apps under Settings → Capabilities → Skills.
Do I need to install anything else to use it?
You need Python, FastAPI, Pydantic V2, async SQLAlchemy, and python-jose for the JWT example. For tests you also need pytest, pytest-asyncio and httpx. The skill does not install these itself.
Is the FastAPI Expert skill free?
The skill is licensed under MIT, as listed on this page. Check the license file in the download for the full terms.
Does the skill run code or access the internet?
According to the listing, it runs no scripts and uses no network. The code the agent writes is still yours to run and review.
Is the JWT code safe to use in production?
Not without review. The sample uses a placeholder secret key and the skill advises loading configuration from environment settings. A human should check secret handling, password hashing, token expiry and authorisation before deployment.
Can it help migrate from Django or Django REST Framework?
Yes. The skill includes a reference file on migrating from Django and DRF to FastAPI, which the agent loads when the task calls for it.
Who should not use this skill?
Non-programmers who only want a finished app should look elsewhere, since the output is code that needs running and review. Anyone who needs production auth without a security review should not rely on the sample code as is.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
Use this skill if you are a Python developer building or extending a FastAPI backend and want consistent Pydantic V2 and async SQLAlchemy patterns with tests. Pick something else if you want a finished application without touching code, or if you need production authentication that you cannot review yourself.
Download the skill