← ClaudeAtlas

fastapilisted

FastAPI modern Python web framework. Covers routing, Pydantic models, dependency injection, and async support. Use when building Python APIs. USE WHEN: user mentions "fastapi", "pydantic", "async python api", "python rest api", asks about "dependency injection python", "python openapi", "python swagger", "async endpoints", "python api validation", "fastapi middleware" DO NOT USE FOR: Django apps - use `django` instead, Flask apps - use `flask` instead, synchronous Python APIs without type hints, GraphQL-only APIs
claude-dev-suite/claude-dev-suite · ★ 33 · API & Backend · score 80
Install: claude install-skill claude-dev-suite/claude-dev-suite
# FastAPI Core Knowledge > **Full Reference**: See [advanced.md](advanced.md) for WebSocket integration including connection management, authentication, room management, Pydantic message protocols, heartbeat, Redis pub/sub scaling, and background tasks. > **Deep Knowledge**: Use `mcp__documentation__fetch_docs` with technology: `fastapi` for comprehensive documentation. ## Basic Setup ```python from fastapi import FastAPI, HTTPException, Depends from pydantic import BaseModel, EmailStr app = FastAPI(title="My API") class UserCreate(BaseModel): name: str email: EmailStr class User(UserCreate): id: int class Config: from_attributes = True ``` ## Route Patterns ```python @app.get("/users", response_model=list[User]) async def get_users(skip: int = 0, limit: int = 100): return await db.users.find_many(skip=skip, limit=limit) @app.get("/users/{user_id}", response_model=User) async def get_user(user_id: int): user = await db.users.find(user_id) if not user: raise HTTPException(status_code=404, detail="User not found") return user @app.post("/users", response_model=User, status_code=201) async def create_user(user: UserCreate): return await db.users.create(user.model_dump()) ``` ## Dependency Injection ```python async def get_db(): db = SessionLocal() try: yield db finally: db.close() async def get_current_user(token: str = Depends(oauth2_scheme)): user = await verify_token(token)