Agent skill

FastAPI Expert

by Jeffallan in Jeffallan/claude-skills

Builds async Python APIs with FastAPI and Pydantic V2, covering endpoints, JWT authentication, async SQLAlchemy, WebSockets and pytest checks against the OpenAPI docs.

MITAuto-check passedBackend & APIs

Install FastAPI Expert

skills CLI
$ npx skills add Jeffallan/claude-skills --skill fastapi-expert -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install Jeffallan/claude-skills fastapi-expert --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/Jeffallan/claude-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/fastapi-expert .claude/skills/fastapi-expert && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
fastapi-expert
GitHub stars
12k
Token cost
~1.8k tokens
SKILL.md length
323 words
Files
7 (incl. references)
Skills in repo
58
Repo updated
First seen
Licence
MIT

At a glance

Builds async Python APIs with FastAPI and Pydantic V2, covering endpoints, JWT authentication, async SQLAlchemy, WebSockets and pytest checks against the OpenAPI docs.

  • Works in 5 steps: Analyze requirements — Identify… → Design schemas — Create Pydantic V2… → Implement — Write async endpoints with… → …
  • Building a REST API with FastAPI from a list of endpoints
  • SKILL.md covers When to Use This Skill, Core Workflow, Minimal Complete Example and JWT Authentication Snippet, plus 4 more sections
  • Needs SECRET_KEY

What it does

Development follows five steps: identify endpoints, models and auth needs, define Pydantic V2 schemas, write async endpoints with dependency injection, add authentication, authorization and rate limiting, then test. The agent runs pytest after each group of endpoints and confirms the /docs page shows the intended API, with a checkpoint after every step on schema validation and status codes.

The skill carries worked examples for schemas, routers, CRUD functions and a JWT security module. Reference files cover Pydantic V2, async SQLAlchemy, routing, OAuth2 and JWT, async testing with pytest-asyncio and httpx, and migrating from Django or DRF. The rules ask for type hints everywhere and Pydantic V2 syntax such as field_validator, model_validator and model_config.

When your agent uses it

  • Building a REST API with FastAPI from a list of endpoints
  • Writing Pydantic V2 validation schemas for request and response bodies
  • Adding JWT authentication and a get_current_user dependency
  • Setting up async database access with SQLAlchemy
  • Porting a Django REST Framework app to FastAPI

Example prompts

  • “Create a FastAPI users service with Pydantic V2 schemas, async SQLAlchemy and CRUD routes.”
  • “Add JWT login and a protected /me endpoint to this FastAPI app.”
  • “Put a WebSocket endpoint in the app that broadcasts new comments to connected clients.”
  • “Write pytest-asyncio tests with httpx for the orders router.”

Requirements

  • Python with FastAPI and Pydantic V2
  • pytest and httpx for the test step

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Analyze requirements — Identify endpoints, data models, auth needs
  2. Design schemas — Create Pydantic V2 models for validation
  3. Implement — Write async endpoints with proper dependency injection
  4. Secure — Add authentication, authorization, rate limiting
  5. Test — Write async tests with pytest and httpx; run pytest after each endpoint group and verify OpenAPI docs at /docs

What it can do on your machine

Read from SKILL.md and the folder at commit 1be15d8. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • github.com
    • synergetic.solutions
    • jeffallan.github.io

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • SECRET_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

FastAPI Expert loads about 1.8k tokens when it runs, and up to ~14k if it reads all its reference files. Until then it costs about 114 tokens; SKILL.md has 323 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~114
When it runs · the whole SKILL.md, loaded when a task matches
~1.8k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~14k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from Jeffallan/claude-skills at commit 1be15d8, republished under its MIT licence (© Jeffallan). 323 words, ~1,766 tokens.

Download SKILL.mdSave it as .claude/skills/fastapi-expert/SKILL.md (or your agent's skills folder). This skill also uses 6 other files; get the full folder from GitHub.
name
fastapi-expert
description
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.
license
MIT
metadata.author
https://github.com/Jeffallan
metadata.company
https://synergetic.solutions
metadata.version
1.1.0
metadata.domain
backend
metadata.triggers
FastAPI, Pydantic, async Python, Python API, REST API Python, SQLAlchemy async, JWT authentication, OpenAPI, Swagger Python
metadata.role
specialist
metadata.scope
implementation
metadata.output-format
code
metadata.related-skills
fullstack-guardian, django-expert, test-master

FastAPI Expert

Deep expertise in async Python, Pydantic V2, and production-grade API development with FastAPI.

When to Use This Skill

  • Building REST APIs with FastAPI
  • Implementing Pydantic V2 validation schemas
  • Setting up async database operations
  • Implementing JWT authentication/authorization
  • Creating WebSocket endpoints
  • Optimizing API performance

Core Workflow

  1. Analyze requirements — Identify endpoints, data models, auth needs
  2. Design schemas — Create Pydantic V2 models for validation
  3. Implement — Write async endpoints with proper dependency injection
  4. Secure — Add authentication, authorization, rate limiting
  5. Test — Write async tests with pytest and httpx; run pytest after each endpoint group and verify OpenAPI docs at /docs

Checkpoint after each step: confirm schemas validate correctly, endpoints return expected HTTP status codes, and /docs reflects the intended API surface before proceeding.

Minimal Complete Example

Schema + endpoint + dependency injection in one cohesive unit:

python
# schemas.py
from pydantic import BaseModel, EmailStr, field_validator, model_config

class UserCreate(BaseModel):
    model_config = model_config(str_strip_whitespace=True)

    email: EmailStr
    password: str
    name: str | None = None

    @field_validator("password")
    @classmethod
    def password_strength(cls, v: str) -> str:
        if len(v) < 8:
            raise ValueError("Password must be at least 8 characters")
        return v

class UserResponse(BaseModel):
    model_config = model_config(from_attributes=True)

    id: int
    email: EmailStr
    name: str | None = None
python
# routers/users.py
from fastapi import APIRouter, Depends, HTTPException, status
from sqlalchemy.ext.asyncio import AsyncSession
from typing import Annotated

from app.database import get_db
from app.schemas import UserCreate, UserResponse
from app import crud

router = APIRouter(prefix="/users", tags=["users"])

DbDep = Annotated[AsyncSession, Depends(get_db)]

@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)
python
# crud.py
from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession
from app.models import User
from app.schemas import UserCreate
from app.security import hash_password

async def get_user_by_email(db: AsyncSession, email: str) -> User | None:
    result = await db.execute(select(User).where(User.email == email))
    return result.scalar_one_or_none()

async def create_user(db: AsyncSession, payload: UserCreate) -> User:
    user = User(email=payload.email, hashed_password=hash_password(payload.password), name=payload.name)
    db.add(user)
    await db.commit()
    await db.refresh(user)
    return user

JWT Authentication Snippet

python
# security.py
from datetime import datetime, timedelta, timezone
from jose import JWTError, jwt
from fastapi import Depends, HTTPException, status
from fastapi.security import OAuth2PasswordBearer
from typing import Annotated

SECRET_KEY = "read-from-env"  # use os.environ / settings
ALGORITHM = "HS256"
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="/auth/token")

def create_access_token(subject: str, expires_delta: timedelta = timedelta(minutes=30)) -> str:
    payload = {"sub": subject, "exp": datetime.now(timezone.utc) + expires_delta}
    return jwt.encode(payload, SECRET_KEY, algorithm=ALGORITHM)

async def get_current_user(token: Annotated[str, Depends(oauth2_scheme)]) -> str:
    try:
        data = jwt.decode(token, SECRET_KEY, algorithms=[ALGORITHM])
        subject: str | None = data.get("sub")
        if subject is None:
            raise ValueError
        return subject
    except (JWTError, ValueError):
        raise HTTPException(status_code=status.HTTP_401_UNAUTHORIZED, detail="Invalid credentials")

CurrentUser = Annotated[str, Depends(get_current_user)]

Reference Guide

Load detailed guidance based on context:

TopicReferenceLoad When
Pydantic V2references/pydantic-v2.mdCreating schemas, validation, model_config
SQLAlchemyreferences/async-sqlalchemy.mdAsync database, models, CRUD operations
Endpointsreferences/endpoints-routing.mdAPIRouter, dependencies, routing
Authenticationreferences/authentication.mdJWT, OAuth2, get_current_user
Testingreferences/testing-async.mdpytest-asyncio, httpx, fixtures
Django Migrationreferences/migration-from-django.mdMigrating from Django/DRF to FastAPI

Constraints

MUST DO
  • Use type hints everywhere (FastAPI requires them)
  • Use Pydantic V2 syntax (field_validator, model_validator, model_config)
  • Use Annotated pattern for dependency injection
  • Use async/await for all I/O operations
  • Use X | None instead of Optional[X]
  • Return proper HTTP status codes
  • Document endpoints (auto-generated OpenAPI)
MUST NOT DO
  • Use synchronous database operations
  • Skip Pydantic validation
  • Store passwords in plain text
  • Expose sensitive data in responses
  • Use Pydantic V1 syntax (@validator, class Config)
  • Mix sync and async code improperly
  • Hardcode configuration values

Output Templates

When implementing FastAPI features, provide:

  1. Schema file (Pydantic models)
  2. Endpoint file (router with endpoints)
  3. CRUD operations if database involved
  4. Brief explanation of key decisions

Knowledge Reference

FastAPI, Pydantic V2, async SQLAlchemy, Alembic migrations, JWT/OAuth2, pytest-asyncio, httpx, BackgroundTasks, WebSockets, dependency injection, OpenAPI/Swagger

Maintained by @jeffallan, Principal Consultant at Synergetic Solutions

Documentation

© Jeffallan, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 6 other files (references) in skills/fastapi-expert of Jeffallan/claude-skills.

  • SKILL.md
  • references/async-sqlalchemy.md
  • references/authentication.md
  • references/endpoints-routing.md
  • references/migration-from-django.md
  • references/pydantic-v2.md
  • references/testing-async.md

Open the folder on GitHubat commit 1be15d8

Compare with similar skills

FastAPI Expert next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

FastAPI Expert compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
FastAPI Expert this skillJeffallan/claude-skills12k—~1.8kAutomated safety check: PassMIT
Fastcrudbenavlabs/fastcrud1.6k—~5kAutomated safety check: PassMIT
Fastapi Appccplugins/awesome-claude-code-plugins968—~1.1kAutomated safety check: NotesApache-2.0
Fastapi Prodavila7/claude-code-templates32k8 repos~1.6kAutomated safety check: PassMIT
Python Fastapi Patternsaiskillstore/marketplace4301 repos~1.3kAutomated safety check: NotesNone
PythonMadAppGang/claude-code284—~2.8kAutomated safety check: NotesMIT

Similar skills

  • Fastcrud

    benavlabs/fastcrud

    A skill your agent uses when building or modifying CRUD endpoints with FastCRUD (the fastcrud PyPI package) in a FastAPI project — covers FastCRUD, crudrouter, EndpointCreator, FilterConfig…

    1.6k GitHub stars~5k tokensUpdated 13 days ago
    Backend & APIsAuto-check passed
  • Fastapi App

    ccplugins/awesome-claude-code-plugins

    Bootstrap a new FastAPI backend with async SQLAlchemy 2.0, asyncpg, Alembic, Pydantic v2, and no deprecated APIs.

    968 GitHub stars~1.1k tokensUpdated 1 mo ago
    Backend & APIsAuto-check: notes
  • Fastapi Pro

    davila7/claude-code-templates

    Build high-performance async APIs with FastAPI, SQLAlchemy 2.0, and Pydantic V2.

    32k GitHub starsUsed in 8 repos~1.6k tokens
    Backend & APIsAuto-check passed
  • Python Fastapi Patterns

    aiskillstore/marketplace

    FastAPI web framework patterns. An agent skill from aiskillstore/marketplace.

    430 GitHub starsUsed in 1 repo~1.3k tokens
    Backend & APIsAuto-check: notes
  • Python

    MadAppGang/claude-code

    A skill your agent uses when building FastAPI applications, implementing async endpoints, setting up Pydantic schemas, working with SQLAlchemy, or writing pytest tests for Python backend services.

    284 GitHub stars~2.8k tokensUpdated 6 mo ago
    Backend & APIsAuto-check: notes
  • Fastapi Mastery

    aiskillstore/marketplace

    Comprehensive FastAPI development skill covering REST API creation, routing, request/response handling, validation, authentication, database integration, middleware, and deployment.

    430 GitHub stars~1.1k tokensUpdated yesterday
    Backend & APIsAuto-check passed

More from Jeffallan/claude-skills

All 58 skills in this repo
  • API Designer

    Jeffallan/claude-skills

    Designs REST and GraphQL APIs from resource modeling to an OpenAPI 3.1 contract, with versioning, pagination and RFC 7807 error handling.

    12k GitHub starsUsed in 2 repos~2k tokens
    Auto-check passed
  • CLI Developer

    Jeffallan/claude-skills

    Walks through designing, building and polishing a command-line tool: user workflow and command hierarchy, implementation in commander, click, typer or cobra, completions and cross-platform testing.

    12k GitHub starsUsed in 2 repos~1.2k tokens
    Auto-check passed
  • Fine-Tuning Expert

    Jeffallan/claude-skills

    Guides LLM fine-tuning with LoRA and QLoRA through Hugging Face PEFT, from dataset validation and training checks to adapter merging, quantization and deployment.

    12k GitHub starsUsed in 1 repo~1.7k tokens
    Auto-check passed
  • GraphQL Architect

    Jeffallan/claude-skills

    Designs GraphQL schemas and Apollo Federation graphs, with DataLoader resolvers, subscriptions, query complexity limits and caching.

    12k GitHub starsUsed in 1 repo~1.3k tokens
    Auto-check passed
  • Kubernetes Specialist

    Jeffallan/claude-skills

    Creates and checks Kubernetes manifests, Helm charts, RBAC and network policies, and helps debug pod problems, with kubectl checks and rollback steps.

    12k GitHub starsUsed in 1 repo~2.1k tokens
    Auto-check passed
  • Laravel Specialist

    Jeffallan/claude-skills

    Builds Laravel 10+ applications with Eloquent models, Sanctum authentication, Horizon queues, API resources and Livewire components, tested with Pest or PHPUnit.

    12k GitHub starsUsed in 1 repo~2.1k tokens
    Auto-check passed

Categories

Questions about FastAPI Expert

What does FastAPI Expert do?

Builds async Python APIs with FastAPI and Pydantic V2, covering endpoints, JWT authentication, async SQLAlchemy, WebSockets and pytest checks against the OpenAPI docs. Development follows five steps: identify endpoints, models and auth needs, define Pydantic V2 schemas, write async endpoints with dependency injection, add authentication, authorization and rate limiting, then test. The agent runs pytest after each group of endpoints and confirms the /docs page shows the intended API, with a checkpoint after every step on schema validation and status codes.

When should I use FastAPI Expert?

FastAPI Expert fits situations like: building a REST API with FastAPI from a list of endpoints; writing Pydantic V2 validation schemas for request and response bodies; adding JWT authentication and a get_current_user dependency; setting up async database access with SQLAlchemy.

How do I install FastAPI Expert in Claude Code?

Run `npx skills add Jeffallan/claude-skills --skill fastapi-expert -a claude-code`. Or copy the skill folder (skills/fastapi-expert in Jeffallan/claude-skills) into .claude/skills/fastapi-expert in your project. Claude Code loads it when a task matches its description.

How do I install FastAPI Expert in Codex?

Run `npx skills add Jeffallan/claude-skills --skill fastapi-expert -a codex`. Or copy the skill folder (skills/fastapi-expert in Jeffallan/claude-skills) into .agents/skills/fastapi-expert in your project. Codex loads it when a task matches its description.

Can I use FastAPI Expert in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add Jeffallan/claude-skills --skill fastapi-expert -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/fastapi-expert, .gemini/skills/fastapi-expert, .github/skills/fastapi-expert and .opencode/skills/fastapi-expert in your project.

What does FastAPI Expert need to run?

Going by SKILL.md and its folder, FastAPI Expert needs credentials named SECRET_KEY. Our summary lists: Python with FastAPI and Pydantic V2; pytest and httpx for the test step.

Does FastAPI Expert access the network?

SKILL.md names 3 domains. As links in the text: github.com, synergetic.solutions and jeffallan.github.io. This is read from the text; nothing was executed.

Is FastAPI Expert safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does FastAPI Expert use?

FastAPI Expert is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does FastAPI Expert use?

About 1.8k tokens (SKILL.md is roughly 7.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 12k tokens, read only when the agent opens those files.

What are the alternatives to FastAPI Expert?

Skills that share tags, products or a category with FastAPI Expert: Fastcrud (benavlabs/fastcrud, 1.6k stars), Fastapi App (ccplugins/awesome-claude-code-plugins, 968 stars), Fastapi Pro (davila7/claude-code-templates, 32k stars) and Python Fastapi Patterns (aiskillstore/marketplace, 430 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains FastAPI Expert?

Jeffallan (a GitHub user) maintains it in Jeffallan/claude-skills, which has 11,767 GitHub stars. The repository holds 58 skills in this directory. The repository was last updated on October 3, 2026.

Source: Jeffallan/claude-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.