FastAPI skill
The official FastAPI skill, bundled with the package, teaching agents to write code for the installed version
Install
uvx library-skillsRun in a project where FastAPI is already installed. For Claude Code choose .claude/skills.
This is third-party code. Review the repository files before installing.
What it does
The skill lives inside the fastapi package, so its guidance matches the framework version in the project and updates with it. It gives the agent current patterns: parameters and dependencies via Annotated, response models via return types, APIRouter-level settings, JSON Lines and Server-Sent Events streaming, and serving a built frontend with app.frontend(). It also has the agent run the server with fastapi dev and fastapi run, declare the entrypoint in pyproject.toml, and use related tools: uv, Ruff, ty, SQLModel, HTTPX. Details sit in separate reference files the agent reads when needed.
Who it is for. For Python developers building APIs with FastAPI alongside a coding agent.
Good fit when
- The agent writes FastAPI code from outdated examples
- You need to add SSE or response streaming
- You want dependencies and routers aligned with the current style
Not a fit when
- The project uses Django, Flask or another framework
- The project is pinned to an old FastAPI version without the bundled skill
Example request
Add an endpoint that streams task progress via Server-Sent EventsLimitations
The skill installs from the package already present in the project, so FastAPI must be installed first, and the install command needs uv. The skill contains coding guidance only and does not check the project automatically.
How to disable. Delete the fastapi folder from the agent's skills directory, for example .claude/skills/fastapi.
Security check
- The skill consists only of instructions and references
README in short
The repository is the FastAPI framework itself; the skill is described in the tutorial docs: it ships in the package and installs with uvx library-skills once FastAPI is in the project. SKILL.md holds a quick reference and links to references on dependencies, responses, streaming, Pydantic, routing and tooling. Release notes show the skill updated regularly alongside new framework features. MIT licensed.
SKILL.md
--- name: fastapi description: FastAPI best practices and conventions. Use when working with FastAPI APIs, Pydantic models, dependencies, streaming responses including Server-Sent Events (SSE), and serving frontend apps. Keeps FastAPI code clean and up to date with the latest features and patterns. --- # FastAPI Official FastAPI skill to write code with best practices, keeping up to date with new versions and features. ## Quick Reference * Serve frontend apps: use `app.frontend()` or `router.frontend()` for built frontend assets; see [Serve Frontend Apps](#serve-frontend-apps). * Server-Sent Events (SSE): use `response_class=EventSourceResponse` and `yield`; see [Streaming](#streaming-json-lines-sse-bytes) and [the streaming reference](references/streaming.md). * JSON Lines and byte streaming: see [the streaming reference](references/streaming.md). * Dependencies: use `Annotated[..., Depends(...)]`; see [Dependency Injection](#dependency-injection) and [the dependency injection reference](references/dependencies.md) for `yield`, scopes, and class dependencies. * Response models: prefer return types; use `response_model` when the public response schema differs from the internal return value; see [the response reference](references/responses.md). * Pydantic models: do not use ellipsis or `RootModel`; see [the Pydantic reference](references/pydantic.md). * Routing: declare router-level prefix, tags, and shared dependencies on the `APIRouter`; see [the path operation reference](references/path-operations.md). * Tooling and related libraries: use uv, Ruff, ty, Asyncer, SQLModel, and HTTPX when applicable; see [the other tools reference](references/other-tools.md). ## Use the `fastapi` CLI Run the development server on localhost with reload: ```bash fastapi dev ``` Run the production server: ```bash fastapi run ```
FAQ
Why install via library-skills rather than from GitHub?
Library Skills scans packages installed in the project and takes the skill from the FastAPI version you actually have.
Which agents does it work with?
The docs list Codex, Claude Code, Cursor, GitHub Copilot, Gemini CLI, Pi and OpenCode.
Related
Official skills and agents from the .NET team: performance, MSBuild, NuGet, upgrades, testing, ASP.NET Core, Blazor and MAUI
Firebase MCP Server
Firebase CLI and MCP Server
Official Firebase MCP server from the Firebase CLI: projects, Firestore, Auth, Crashlytics, Remote Config and function logs
Laravel's official MCP server, guidelines and skills: the agent sees the DB schema, logs and package versions and searches ecosystem docs
Go skills by samber
cc-skills-golang
Over forty Go skills: style, errors, concurrency, testing, security, performance and popular libraries