fastapi
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.zipInstalls 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.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
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.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| fastapi (this skill) | 0 | 5mo | No flags | Intermediate |
| fastapi-templates | 520 | 2mo | No flags | Intermediate |
| fastapi-pro | 79 | 4mo | No flags | Advanced |
| fastapi-router-py | 5 | 27d | No flags | Beginner |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by diegosouzapw
View all by diegosouzapw →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.
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.
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.
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.
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.
supabase-python
alinaqi
FastAPI with Supabase and SQLAlchemy/SQLModel