skills/fastapi/SKILL.md
FastAPI Python framework. Covers REST APIs, validation, dependencies, security. Use when building Python web APIs with FastAPI, configuring Pydantic models, implementing dependency injection, or setting up OAuth2/JWT authentication. Keywords: FastAPI, Pydantic, async, OAuth2, JWT, REST API.
npx skillsauth add itechmeat/llm-code fastapiInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill provides comprehensive guidance for building APIs with FastAPI.
| Topic | Reference |
| ------------------ | ----------------------------------- |
| Getting started | references/first-steps.md |
| Path parameters | references/path-parameters.md |
| Query parameters | references/query-parameters.md |
| Request body | references/request-body.md |
| Validation | references/validation.md |
| Body advanced | references/body-advanced.md |
| Cookies/Headers | references/cookies-headers.md |
| Pydantic models | references/models.md |
| Forms/Files | references/forms-files.md |
| Error handling | references/error-handling.md |
| Path config | references/path-config.md |
| Dependencies | references/dependencies.md |
| Security | references/security.md |
| Middleware | references/middleware.md |
| CORS | references/cors.md |
| Database | references/sql-databases.md |
| Project structure | references/bigger-applications.md |
| Background tasks | references/background-tasks.md |
| Metadata/Docs | references/metadata-docs.md |
| Testing | references/testing.md |
| Advanced responses | references/responses-advanced.md |
| WebSockets | references/websockets.md |
| Templates | references/templates.md |
| Settings/Env vars | references/settings.md |
| Lifespan events | references/lifespan.md |
| OpenAPI advanced | references/openapi-advanced.md |
Requires Python 3.10+. Install: pip install "fastapi[standard]" (full with uvicorn) or pip install fastapi (minimal). Add python-multipart for forms/files.
yield.EventSourceResponse).TaskGroup usage in request async exit stack (stability fix).1.0.0.ServerSentEvent payloads fail earlier instead of quietly streaming invalid frames.convert_underscores=True (the default). If a client truly sends underscore headers, declare Header(convert_underscores=False) and verify that your proxy chain allows them.from fastapi import FastAPI
app = FastAPI()
@app.get("/")
def read_root():
return {"Hello": "World"}
@app.get("/items/{item_id}")
def read_item(item_id: int, q: str | None = None):
return {"item_id": item_id, "q": q}
Run: fastapi dev main.py
from typing import Annotated
from fastapi import Path, Query
@app.get("/items/{item_id}")
def read_item(
item_id: Annotated[int, Path(ge=1)],
q: Annotated[str | None, Query(max_length=50)] = None
):
return {"item_id": item_id, "q": q}
from pydantic import BaseModel, Field
class Item(BaseModel):
name: str = Field(min_length=1, max_length=100)
price: float = Field(gt=0)
@app.post("/items/", response_model=Item)
def create_item(item: Item):
return item
from fastapi import Depends
async def get_db():
db = SessionLocal()
try:
yield db
finally:
db.close()
@app.get("/users/")
def list_users(db: Annotated[Session, Depends(get_db)]):
return db.query(User).all()
from fastapi.security import OAuth2PasswordBearer
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")
async def get_current_user(token: Annotated[str, Depends(oauth2_scheme)]):
return decode_token(token)
@app.get("/users/me")
def read_me(user: Annotated[User, Depends(get_current_user)]):
return user
/docs/redoc/openapi.jsonAnnotated[Type, ...] for parametersresponse_model for output filteringstatus_code for proper HTTP codestags for API organizationdependencies at router/app level for authBody with Form/File in same endpointdata-ai
Zvec in-process vector database. Covers collections, indexing, embeddings, reranking, and persistence. Use when embedding Zvec into applications or tuning retrieval/storage behavior. Keywords: Zvec, HNSW-RaBitQ, vector database, ANN.
development
Vitest testing framework: Vite-powered tests, Jest-compatible API, mocking, snapshots, coverage, browser mode, and TypeScript support. Use when writing or configuring tests with Vitest, setting up mocking/snapshots, configuring coverage, or running browser-mode tests. Keywords: Vitest, testing, Vite, Jest, mocking, coverage.
tools
Vite next-gen frontend tooling: dev server, HMR, build, config, plugins, Environment API, Rolldown. Use when setting up or running a Vite project, configuring vite.config.*, authoring plugins, working with HMR or JS API, or managing environment variables and modes. Keywords: vite.config, bundler, Vite, HMR, Rolldown.
development
Orchestrate AI coding with Vibe Kanban: tasks, review, sessions, workspaces, and isolated git worktrees. Use when managing AI-generated code in isolated environments, planning coding tasks, reviewing AI output, or configuring Vibe Kanban workspaces and agents. Keywords: Vibe Kanban, AI orchestration, worktrees.