fastapi-expert

fastapi-expert is a skill for Claude Code from personamanagmentlayer/pcl. It costs 49 tokens per session (1,911 once invoked), scanned A, original, Apache-2.0.

Expert guidance for FastAPI, a Python framework for building web APIs, including asynchronous code, validation, and automatic API documentation.

In plain words
What is it for?
Use it to build and test routes, request and response models, authentication, dependencies, middleware, background tasks, WebSockets, and async APIs.
Why use it?
It helps avoid design and implementation mistakes when creating typed, documented Python services.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter.

Good fit Use it to build and test routes, request and response models, authentication…

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/personamanagmentlayer/pcl/fastapi-expert
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add personamanagmentlayer/pcl --skill fastapi-expert
Clone the repo
git clone --depth 1 https://github.com/personamanagmentlayer/pcl

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for fastapi-expert

README.md
[![agentmods](https://agentmods.dev/badge/skills/personamanagmentlayer/pcl/fastapi-expert.svg)](https://agentmods.dev/skills/personamanagmentlayer/pcl/fastapi-expert)
Your own site
<a href="https://agentmods.dev/skills/personamanagmentlayer/pcl/fastapi-expert"><img src="https://agentmods.dev/badge/skills/personamanagmentlayer/pcl/fastapi-expert.svg" alt="Measured on agentmods" height="20"></a>
Per session 49 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,911 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00049 $0.01911
Opus 5 $0.00024 $0.00955
Sonnet 5 $0.00010 $0.00382
Haiku 4.5 $0.00005 $0.00191

Measured yesterday against content hash 5961978f83e6, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

fastapi-expert scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

stdlib/api/fastapi-expert/SKILL.md · 299 lines

How it starts

The opening of the file, as written. The whole thing — 299 lines — stays where its author put it; the contents beside it link to each section on GitHub.

FastAPI Expert

Expert guidance for FastAPI - modern, fast Python web framework for building APIs with automatic OpenAPI documentation and type safety.

Core Concepts

FastAPI Features

  • Fast performance (Starlette + Pydantic)
  • Automatic OpenAPI/Swagger docs
  • Type hints and validation
  • Async/await support
  • Dependency injection
  • OAuth2 and JWT
  • WebSocket support

Key Components

  • Path operations (routes)
  • Request/response models (Pydantic)
  • Dependency injection
  • Middleware
  • Background tasks
  • Testing with TestClient

Basic FastAPI Application

from fastapi import FastAPI, HTTPException, Depends
from pydantic import BaseModel, EmailStr, Field
from typing import List, Optional
import uvicorn

app = FastAPI(
    title="My API",
    description="Production-ready FastAPI",
    version="1.0.0"
)

# Models
class UserCreate(BaseModel):
    email: EmailStr
    name: str = Field(..., min_length=2, max_length=100)
    age: Optional[int] = Field(None, ge=0, le=150)

class UserResponse(BaseModel):
    id: int
    email: str
    name: str

    class Config:
        from_attributes = True

# Routes
@app.post("/users", response_model=UserResponse, status_code=201)
async def create_user(user: UserCreate):
    # Create user in database
    db_user = await db.users.create(**user.dict())
    return db_user

@app.get("/users/{user_id}", response_model=UserResponse)
async def get_user(user_id: int):
    user = await db.users.get(user_id)
    if not user:
        raise HTTPException(status_code=404, detail="User not found")
    return user

@app.get("/users", response_model=List[UserResponse])
async def list_users(skip: int = 0, limit: int = 100):
    return await db.users.find_many(skip=skip, limit=limit)

if __name__ == "__main__":
    uvicorn.run(app, host="0.0.0.0", port=8000)

Dependency Injection

from fastapi import Depends, HTTPException, status
from fastapi.security import OAuth2PasswordBearer
from sqlalchemy.ext.asyncio import AsyncSession

# Database dependency
async def get_db() -> AsyncSession:
    async with async_session() as session:
        yield session

# Auth dependency
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")

async def get_current_user(
    token: str = Depends(oauth2_scheme),
    db: AsyncSession = Depends(get_db)
):
    credentials_exception = HTTPException(
        status_code=status.HTTP_401_UNAUTHORIZED,
        detail="Could not validate credentials"
    )

    payload = jwt.decode(token, SECRET_KEY, algorithms=[ALGORITHM])
    user_id: int = payload.get("sub")
    if user_id is None:
        raise credentials_exception

    user = await db.get(User, user_id)
    if user is None:
        raise credentials_exception

    return user

# Use dependencies
@app.get("/me", response_model=UserResponse)
async def read_users_me(current_user: User = Depends(get_current_user)):
    return current_user

@app.post("/posts")
async def create_post(
    post: PostCreate,
    current_user: User = Depends(get_current_user),
    db: AsyncSession = Depends(get_db)
):
    db_post = Post(**post.dict(), user_id=current_user.id)
    db.add(db_post)
    await db.commit()
    return db_post

Read the full file on GitHub · 299 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday Changed · +5 lines · +31 tokens per session 5961978f83e6
  2. 7d ago First seen · 294 lines · 18 tokens per session scan A 58e8d1b8ddd3

Subscribe to this mod's changes

fastapi-expert is a skill published in the GitHub repository personamanagmentlayer/pcl (41 stars, last pushed yesterday), licensed Apache-2.0. It adds 49 tokens to every session and 1,911 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.