home / skills / bankkroll / skills-builder / fastapi

fastapi skill

/skills/fastapi

This skill provides FastAPI guidance and official documentation references to help you master advanced topics, deployment, and practical tutorials.

npx playbooks add skill bankkroll/skills-builder --skill fastapi

Review the files below or copy the command above to add this skill to your agents.

Files (46)
SKILL.md
8.6 KB
---
name: "fastapi"
description: "Scraped from https://fastapi.tiangolo.com/ Source: https://fastapi.tiangolo.com. Use when questions involve: advanced, deployment, how to, reference, tutorial."
---

# Fastapi

> Official documentation: https://fastapi.tiangolo.com

## Overview

This skill provides comprehensive documentation for fastapi.

**Total references:** 45 files (~390,244 tokens)

**Topics covered:**
fastapiresponsesJSONResponse, Combining information, 01241, Handling custom request body encodings, Hash and verify the passwords, fastapisecurityHTTPAuthorizationCredentials, Containers and Docker, fastapiopenapidocsget_swagger_ui_oauth2_redirect_html, Installwebsockets, OpenAPI operationId, Developing, Use thescopes...

## Reference Files

Load only the reference files relevant to the user's question:

### Advanced

- **[Additional Responses in OpenAPI¶ and more](references/advanced-1.md)** (~6,383 tokens)
  - Topics: Additional Response withmodel, Additional media types for the main response, Combining information
- **[Behind a Proxy¶ and more](references/advanced-2.md)** (~6,728 tokens)
  - Topics: Proxy Forwarded Headers, Proxy with a stripped path prefix, About proxies with a stripped path prefix
- **[Lifespan Events¶ and more](references/advanced-3.md)** (~7,972 tokens)
  - Topics: Use Case, Lifespan, Alternative Events deprecated
- **[OpenAPI Webhooks¶ and more](references/advanced-4.md)** (~6,151 tokens)
  - Topics: Webhooks steps, Documenting webhooks withFastAPIand OpenAPI, An app with webhooks
- **[OAuth2 scopes¶](references/advanced-5.md)** (~20,463 tokens)
  - Topics: OAuth2 scopes and OpenAPI, Global view, OAuth2 Security scheme
- **[Advanced Security¶ and more](references/advanced-6.md)** (~6,375 tokens)
  - Topics: Additional Features, Read the Tutorial first, Types and validation
- **[WebSockets¶ and more](references/advanced-7.md)** (~2,949 tokens)
  - Topics: Installwebsockets, WebSockets client, Create awebsocket

### Deployment

- **[Deploy FastAPI on Cloud Providers¶ and more](references/deployment-1.md)** (~4,134 tokens)
  - Topics: FastAPI Cloud, Cloud Providers - Sponsors, Security - HTTPS
- **[FastAPI in Containers and more](references/deployment-2.md)** (~7,894 tokens)
  - Topics: What is a Container, What is a Container Image, Container Images
- **[Run a Server Manually¶ and more](references/deployment-3.md)** (~2,267 tokens)
  - Topics: Use thefastapi runCommand, ASGI Servers, Server Machine and Server Program

### General

- **[About¶ and more](references/general-1.md)** (~4,427 tokens)
  - Topics: Additional Features, Read the Tutorial first, Intro
- **[Concurrency and async / await¶ and more](references/general-2.md)** (~7,532 tokens)
  - Topics: In a hurry, Technical Details, Asynchronous Code
- **[Environment Variables¶ and more](references/general-3.md)** (~5,878 tokens)
  - Topics: Create and Use Env Vars, Read env vars in Python, Types and Validation
- **[Help FastAPI and more](references/general-4.md)** (~6,193 tokens)
  - Topics: Subscribe to the newsletter, Follow FastAPI on X Twitter, StarFastAPIin GitHub
- **[Repository Management Tasks¶ and more](references/general-5.md)** (~6,446 tokens)
  - Topics: Be Nice, Edit PR Titles, Add Labels to PRs
- **[Release Notes¶](references/general-6.md)** (~62,193 tokens)
  - Topics: Latest Changes, 01280, 01271
- **[Resources¶ and more](references/general-7.md)** (~4,011 tokens)
  - Topics: Run the code, Install FastAPI, Advanced User Guide

### How To

- **[Use Old 403 Authentication Error Status Codes¶ and more](references/how-to-1.md)** (~7,629 tokens)
  - Topics: About security APIs and docs, Conditional OpenAPI from settings and env vars, Disable Syntax Highlighting
- **[Extending OpenAPI¶ and more](references/how-to-2.md)** (~4,730 tokens)
  - Topics: The normal process, Overriding the defaults, Filter Data - Security

### Reference

- **[APIRouterclass¶](references/reference-1.md)** (~23,363 tokens)
  - Topics: fastapiAPIRouter
- **[Background Tasks and more](references/reference-2.md)** (~3,490 tokens)
  - Topics: fastapiBackgroundTasks, Depends, fastapiDepends
- **[FastAPIclass¶](references/reference-3.md)** (~27,736 tokens)
  - Topics: fastapiFastAPI
- **[HTTPConnectionclass¶ and more](references/reference-4.md)** (~5,279 tokens)
  - Topics: fastapirequestsHTTPConnection, fastapimiddlewarecorsCORSMiddleware, fastapimiddlewaregzipGZipMiddleware
- **[Request Parameters¶](references/reference-5.md)** (~9,443 tokens)
  - Topics: fastapiQuery, fastapiPath, fastapiBody
- **[Requestclass¶ and more](references/reference-6.md)** (~3,294 tokens)
  - Topics: fastapiRequest, fastapiResponse, FastAPI Responses
- **[Security Tools¶](references/reference-7.md)** (~8,629 tokens)
  - Topics: API Key Security Schemes, fastapisecurityAPIKeyCookie, fastapisecurityAPIKeyHeader
- **[Static Files and more](references/reference-8.md)** (~5,060 tokens)
  - Topics: fastapistaticfilesStaticFiles, Example, fastapistatus

### Tutorial

- **[Background Tasks¶ and more](references/tutorial-1.md)** (~7,361 tokens)
  - Topics: UsingBackgroundTasks, Create a task function, Add the background task
- **[Body and more](references/tutorial-2.md)** (~7,176 tokens)
  - Topics: MixPathQueryand body parameters, Multiple body parameters, Singular values in body
- **[Request Body¶ and more](references/tutorial-3.md)** (~5,170 tokens)
  - Topics: Import PydanticsBaseModel, Create your data model, Declare it as a parameter
- **[Classes as Dependencies¶ and more](references/tutorial-4.md)** (~5,045 tokens)
  - Topics: Adictfrom the previous example, What makes a dependency, Classes as dependencies
- **[Dependencies with yield¶ and more](references/tutorial-5.md)** (~7,724 tokens)
  - Topics: A database dependency withyield, A dependency withyieldandtry, Sub-dependencies withyield
- **[JSON Compatible Encoder¶ and more](references/tutorial-6.md)** (~7,718 tokens)
  - Topics: Using thejsonable_encoder, Other data types, Example
- **[Header Parameter Models¶ and more](references/tutorial-7.md)** (~6,662 tokens)
  - Topics: Header Parameters with a Pydantic Model, Check the Docs, Forbid Extra Headers
- **[Path Parameters and Numeric Validations¶ and more](references/tutorial-8.md)** (~5,500 tokens)
  - Topics: ImportPath, Declare metadata, Order the parameters as you need
- **[Query Parameters and String Validations¶](references/tutorial-9.md)** (~7,157 tokens)
  - Topics: Additional validation, UseAnnotatedin the type for theqparameter, AddQuerytoAnnotatedin theqparameter
- **[Query Parameters¶ and more](references/tutorial-10.md)** (~5,608 tokens)
  - Topics: Defaults, Optional parameters, Query parameter type conversion
- **[Response Model and more](references/tutorial-11.md)** (~6,041 tokens)
  - Topics: response_modelParameter, Return the same input data, Add an output model
- **[Declare Request Example Data¶ and more](references/tutorial-12.md)** (~5,513 tokens)
  - Topics: Extra JSON Schema data in Pydantic models, Fieldadditional arguments, examplesin JSON Schema - OpenAPI
- **[Get Current User¶](references/tutorial-13.md)** (~3,047 tokens)
  - Topics: Create a user model, Create aget_current_userdependency, Get the user
- **[OAuth2 with Password (and hashing), Bearer with JWT tokens¶](references/tutorial-14.md)** (~9,111 tokens)
  - Topics: About JWT, InstallPyJWT, Password hashing
- **[Simple OAuth2 with Password and Bearer¶](references/tutorial-15.md)** (~7,465 tokens)
  - Topics: Get theusernameandpassword, Code to get theusernameandpassword, Return the token
- **[Security¶](references/tutorial-16.md)** (~887 tokens)
  - Topics: In a hurry, OAuth2, OpenID Connect
- **[SQL (Relational) Databases¶](references/tutorial-17.md)** (~23,437 tokens)
  - Topics: InstallSQLModel, Create the App with a Single Model, Update the App with Multiple Models
- **[Static Files¶ and more](references/tutorial-18.md)** (~2,973 tokens)
  - Topics: UseStaticFiles, Details, More info

## Usage Guidelines

1. **Identify relevant sections** - Match the user's question to the appropriate reference file(s)
2. **Load minimally** - Only read files directly relevant to the question to conserve context
3. **Cite sources** - Reference specific sections when answering
4. **Combine knowledge** - For complex questions, you may need multiple reference files

### When to use each reference:

- **Advanced**: Advanced-related features and documentation
- **Deployment**: Deployment, hosting, and infrastructure
- **General**: General documentation, overview, and getting started
- **How To**: How To-related features and documentation
- **Reference**: Reference-related features and documentation
- **Tutorial**: Tutorial-related features and documentation

Overview

This skill provides comprehensive, navigable documentation and usage guidance for FastAPI. It consolidates tutorial content, reference material, advanced topics, and deployment guidance so you can get concise, actionable answers for building, securing, and deploying FastAPI apps. Use it when you need how-to steps, API references, deployment patterns, or advanced feature explanations.

How this skill works

I inspect the FastAPI documentation by topic (Tutorial, Reference, Advanced, Deployment, How-To) and surface the most relevant sections. For a question, I match it to the appropriate documents, summarize steps or APIs, and cite the targeted feature area so you can follow concrete instructions. I focus on code patterns, configuration, testing, and deployment commands, plus security and OpenAPI details.

When to use it

  • You need step-by-step guidance to implement FastAPI features (dependencies, validation, response models).
  • You want reference-level details for classes, decorators, or API behaviors (FastAPI, APIRouter, Request).
  • You plan to deploy FastAPI (containers, ASGI servers, HTTPS, cloud providers).
  • You need advanced topics: WebSockets, OAuth2 scopes, proxies, lifespan events, or custom OpenAPI additions.
  • You want tutorial-style examples: background tasks, database integrations, or JWT auth.

Best practices

  • Start with the Tutorial sections for idiomatic patterns before using advanced features.
  • Use Pydantic models for request/response validation and the response_model parameter for consistent outputs.
  • Run FastAPI with a production ASGI server (e.g., Uvicorn/Gunicorn combo) and configure HTTPS at the proxy/load balancer.
  • Document security in OpenAPI (OAuth2, API keys) and declare scopes when applicable.
  • Containerize reproducibly (multi-stage Dockerfile) and test endpoints with the auto-generated docs (Swagger/ReDoc).

Example use cases

  • Add OAuth2 password flow with JWT issuance and token verification using the tutorial examples.
  • Document webhook endpoints and custom OpenAPI metadata for third-party integrations.
  • Deploy a FastAPI app in Docker with Uvicorn and configure a reverse proxy with forwarded headers.
  • Implement background tasks and WebSocket endpoints for real-time features.
  • Model complex request/response bodies with Pydantic and use response_model to shape public APIs.

FAQ

Is the content official FastAPI documentation?

The skill summarizes and organizes the FastAPI docs into focused guidance, but indicate it draws from the public FastAPI documentation rather than being the official project itself.

How should I ask for help to get the best answer?

Specify the area (Tutorial, Reference, Advanced, Deployment), include key requirements (auth, DB, containerization), and paste minimal code or error messages when relevant.