fastapi-router-py
Speeds up FastAPI development by generating routers, CRUD patterns, and auth endpoints.
Install
mkdir -p .claude/skills/fastapi-router-py && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/1609" && unzip -o skill.zip -d .claude/skills/fastapi-router-py && rm skill.zipInstalls to .claude/skills/fastapi-router-py
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.
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.Key capabilities
- →Create CRUD API endpoints
- →Implement authentication dependencies
- →Define response models
- →Standardize HTTP status codes
How it works
The skill provides a template-based approach to generating routers that include pre-configured authentication and response schemas.
Inputs & outputs
When to use fastapi-router-py
- →Create new CRUD API endpoints
- →Add auth dependencies to routes
- →Define router response schemas
- →Build modular API architecture
About this skill
FastAPI Router
Create FastAPI routers following established patterns with proper authentication, response models, and HTTP status codes.
Quick Start
Copy the template from assets/template.py and replace placeholders:
{{ResourceName}}→ PascalCase name (e.g.,Project){{resource_name}}→ snake_case name (e.g.,project){{resource_plural}}→ plural form (e.g.,projects)
Authentication Patterns
# Optional auth - returns None if not authenticated
current_user: Optional[User] = Depends(get_current_user)
# Required auth - raises 401 if not authenticated
current_user: User = Depends(get_current_user_required)
Response Models
@router.get("/items/{item_id}", response_model=Item)
async def get_item(item_id: str) -> Item:
...
@router.get("/items", response_model=list[Item])
async def list_items() -> list[Item]:
...
HTTP Status Codes
@router.post("/items", status_code=status.HTTP_201_CREATED)
async def create_item(item: ItemCreate) -> Item:
...
@router.delete("/items/{id}", status_code=status.HTTP_204_NO_CONTENT)
async def delete_item(id: str) -> None:
...
Integration Steps
- Create router in
src/backend/app/routers/ - Mount in
src/backend/app/main.py - Create corresponding Pydantic models
- Create service layer if needed
- Add frontend API functions
Best Practices
- Pick
deforasync defper endpoint based on whether you call async I/O; do not call blocking I/O from anasync defhandler. - Manage long-lived resources (DB pools, HTTP clients) in
lifespanand inject viaDepends; usewith/async withfor per-request resources.
Reference Files
| File | Contents |
|---|---|
| references/capabilities.md | Additional non-hero capabilities, operation-group coverage, and production checklists. |
When not to use it
- →When the project does not use FastAPI
- →When blocking I/O is required in an async handler
Prerequisites
Limitations
- →Requires manual mounting in main.py
- →Requires separate Pydantic model creation
How it compares
It enforces a consistent architectural pattern for routers, authentication, and status codes across the application.
Compared to similar skills
fastapi-router-py side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| fastapi-router-py (this skill) | 5 | 27d | No flags | Beginner |
| fastapi-templates | 520 | 2mo | No flags | Intermediate |
| fastapi-pro | 79 | 4mo | No flags | Advanced |
| pydantic-models-py | 3 | 27d | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by microsoft
View all by microsoft →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.
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
fastapi
kid-sid
Use when structuring a FastAPI application, designing dependency injection chains, defining Pydantic v2 schemas, adding JWT authentication, or writing async route tests with httpx.