Build high-performance FastAPI applications with async routes, validation, dependency injection, security, and automatic API documentation. Use when developing modern Python APIs with async support, automatic OpenAPI documentation, and high performance requirements.
Create fast, modern Python APIs using FastAPI with async/await support, automatic API documentation, type validation using Pydantic, dependency injection, JWT authentication, and SQLAlchemy ORM integration.
Minimal working example:
# main.py
from fastapi import FastAPI, HTTPException, status
from fastapi.middleware.cors import CORSMiddleware
from contextlib import asynccontextmanager
import logging
# Setup logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
# Create FastAPI instance
app = FastAPI(
title="API Service",
description="A modern FastAPI application",
version="1.0.0",
docs_url="/api/docs",
openapi_url="/api/openapi.json"
)
# Add CORS middleware
app.add_middleware(
CORSMiddleware,
allow_origins=["http://localhost:3000"],
allow_credentials=True,
allow_methods=["*"],
// ... (see reference guides for full implementation)
Detailed implementations in the references/ directory:
| Guide | Contents | |---|---| | FastAPI Application Setup | FastAPI Application Setup | | Pydantic Models for Validation | Pydantic Models for Validation | | Async Database Models and Queries | Async Database Models and Queries | | Security and JWT Authentication | Security and JWT Authentication | | Service Layer for Business Logic | Service Layer for Business Logic | | API Routes with Async Endpoints | API Routes with Async Endpoints |
Copy a source-pinned command for your client. You run it yourself.
Destination: .claude/skills/fastapi-development · pinned to the source commit
git clone https://github.com/aj-geddes/useful-ai-prompts.git
cd useful-ai-prompts
git checkout 3f5182cfd739fc113f4af5244a1cf342ad7f7911
mkdir -p ".claude/skills/fastapi-development"
cp -r "skills/fastapi-development" ".claude/skills/fastapi-development"Review the source before running. This copies files into your project; it is not a one-click install and does not verify runtime safety.
Scanner static-checks@0.1.0 · commit 3f5182cfd739. Static checks cannot prove runtime safety – review the source and the exact diff before installing. How checks work.
No static rules matched. This is not a safety guarantee.