Provides standard structures and patterns for building efficient, type-safe APIs with FastAPI.

Install

mkdir -p .claude/skills/fastapi-diegosouzapw && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/11701" && unzip -o skill.zip -d .claude/skills/fastapi-diegosouzapw && rm skill.zip

Installs to .claude/skills/fastapi-diegosouzapw

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

FastAPI framework best practices including Pydantic schemas, dependency injection, and async patterns.
102 charsno explicit “when” trigger
Intermediate

Key capabilities

  • Organize FastAPI project files into a structured directory
  • Define Pydantic schemas for data validation
  • Implement dependency injection for reusable components
  • Use async patterns for I/O operations
  • Optimize API performance with response caching and background tasks

How it works

The skill outlines a recommended project structure and coding patterns for FastAPI applications. It specifies how to use Pydantic for validation, Depends() for dependency injection, and async def for I/O operations.

Inputs & outputs

You give it
FastAPI application code
You get back
Structured FastAPI project with best practices applied

When to use fastapi

  • Organize FastAPI project structure
  • Define Pydantic input schemas
  • Implement dependency injection
  • Optimize async I/O

About this skill

FastAPI Best Practices

Project Structure

  • app/main.py - Application entry
  • app/routers/ - Route handlers
  • app/models/ - SQLAlchemy models
  • app/schemas/ - Pydantic schemas
  • app/services/ - Business logic
  • app/dependencies.py - Dependency injection

Pydantic Schemas

  • Use separate schemas for input/output
  • Use Field() for validation
  • Use model_validator for complex validation
  • Use Config for schema settings

Dependency Injection

  • Use Depends() for dependencies
  • Create reusable dependencies
  • Use yield for cleanup logic
  • Cache expensive dependencies

Async

  • Use async def for I/O operations
  • Use httpx for async HTTP
  • Use databases/SQLAlchemy async
  • Avoid blocking in async context

Performance

  • Use response_model for serialization
  • Enable response caching
  • Use background tasks
  • Stream large responses
  • Use connection pooling

When not to use it

  • When not dealing with I/O-bound operations that benefit from async

Limitations

  • The skill only applies to FastAPI projects
  • The skill focuses on best practices, not on generating functional code

How it compares

This skill provides a structured approach to building FastAPI applications by defining specific file organization and coding practices, unlike a generic development process.

Compared to similar skills

fastapi side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
fastapi (this skill)05moNo flagsIntermediate
fastapi-templates5202moNo flagsIntermediate
fastapi-pro794moNo flagsAdvanced
fastapi-router-py529dNo flagsBeginner

Try saying

Example prompts that trigger this skill in your AI assistant.

More by diegosouzapw

View all by diegosouzapw

helm-chart-scaffolding-v2

diegosouzapw

Helm Chart Scaffolding workflow skill. Use this skill when the user needs Comprehensive guidance for creating, organizing, and managing Helm charts for packaging and deploying Kubernetes applications and the operator should preserve the upstream workflow, copied support files, and provenance before

00

cc-skill-coding-standards-v2

diegosouzapw

Coding Standards & Best Practices workflow skill. Use this skill when the user needs Universal coding standards, best practices, and patterns for TypeScript, JavaScript, React, and Node.js development and the operator should preserve the upstream workflow, copied support files, and provenance before

00

worktree-setup

diegosouzapw

Automatically invoked after `git worktree add` to create data/shared symlink and data/local directory. Required before starting work in any new worktree.

00

parsehub-automation

diegosouzapw

Automate Parsehub tasks via Rube MCP (Composio). Always search tools first for current schemas.

00

signalwire-agents-sdk

diegosouzapw

Expert assistance for building SignalWire AI Agents in Python. Automatically activates when working with AgentBase, SWAIG functions, skills, SWML, voice configuration, DataMap, or any signalwire_agents code. Provides patterns, best practices, and complete working examples.

00

agent-sales-engineer

diegosouzapw

Expert sales engineer specializing in technical pre-sales, solution architecture, and proof of concepts. Masters technical demonstrations, competitive positioning, and translating complex technology into business value for prospects and customers.

00

You might also like

fastapi-templates

wshobson

Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.

5201,086

fastapi-pro

sickn33

Build high-performance async APIs with FastAPI, SQLAlchemy 2.0, and Pydantic V2. Master microservices, WebSockets, and modern Python async patterns. Use PROACTIVELY for FastAPI development, async optimization, or API architecture.

79181

fastapi-router-py

microsoft

Create FastAPI routers with CRUD operations, authentication dependencies, and proper response models. Use when building REST API endpoints, creating new routes, implementing CRUD operations, or adding authenticated endpoints in FastAPI applications.

525

pydantic-models-py

microsoft

Create Pydantic models following the multi-model pattern with Base, Create, Update, Response, and InDB variants. Use when defining API request/response schemas, database models, or data validation in Python applications using Pydantic v2.

325

backend-architect

sickn33

Expert backend architect specializing in scalable API design, microservices architecture, and distributed systems. Masters REST/GraphQL/gRPC APIs, event-driven architectures, service mesh patterns, and modern backend frameworks. Handles service boundary definition, inter-service communication, resilience patterns, and observability. Use PROACTIVELY when creating new backend services or APIs.

1014

supabase-python

alinaqi

FastAPI with Supabase and SQLAlchemy/SQLModel

05

Search skills

Search the agent skills registry