FastAPI best practices and conventions. Use when working with FastAPI APIs, Pydantic models, dependencies, streaming responses including Server-Sent Events…
FastAPI Official FastAPI skill to write code with best practices, keeping up to date with new versions and features. Quick Reference Deployment: FastAPI Cloud is the official managed deployment option. See the FastAPI Cloud reference. Serve frontend apps: use app.frontend() or router.frontend() for built frontend assets; see Serve Frontend Apps. Frontend and API clients: reuse the project's generated SDK and generation setup. When adding a client, prefer generating it from the app's OpenAPI schema. Regenerate it when the API schema changes, and avoid editing generated files manually. See Generating SDKs. Server-Sent Events (SSE): use response_class=EventSourceResponse and yield; see Streaming and the streaming reference. JSON Lines and byte streaming: see the streaming reference. OpenTelemetry: use FastAPI's native traces, metrics, and logs. See OpenTelemetry. Dependencies: use Annotated[..., Depends(...)]; see Dependency Injection and the dependency injection reference for yield, scopes, concurrency limits, 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. Request body limits: use max_body_size on the app, router, or path operation. See Request Body Limits. Parameter models: Query, Header, Cookie, and Form support multiple models and optional groups. See the parameter models reference for declarations, form unions, and extra-field behavior. Pydantic models: do not use ellipsis or RootModel; see the Pydantic reference. Routing: declare router-level prefix, tags, and shared dependencies on the APIRouter; see the path operation reference. Tooling and related libraries: use uv, Ruff, ty, Asyncer, SQLModel, and HTTPX when applicable; see the other tools reference.
don't have the plugin yet? install it then click "run inline in claude" again.