developer coding skill risk: low
FastAPI Router Pattern Creator
Instructs creation of FastAPI routers by copying a template and replacing placeholders for resource names, while incorporating specified authentication patterns, response models, a…
SKILL 1 file
SKILL.md
---
name: antigravity-awesome-skills-fastapi-router-py-b894cbad
description: "Create FastAPI routers following established patterns with proper authentication, response models, and HTTP status codes."
---
# 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
```python
# 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
```python
@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
```python
@router.post("/items", status_code=status.HTTP_201_CREATED)
@router.delete("/items/{id}", status_code=status.HTTP_204_NO_CONTENT)
```
## Integration Steps
1. Create router in `src/backend/app/routers/`
2. Mount in `src/backend/app/main.py`
3. Create corresponding Pydantic models
4. Create service layer if needed
5. Add frontend API functions
## When to Use
This skill is applicable to execute the workflow or actions described in the overview.
## Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
INPUTS
- {{ResourceName}} REQUIRED
-
PascalCase resource name
e.g. Project
- {{resource_name}} REQUIRED
-
snake_case resource name
e.g. project
- {{resource_plural}} REQUIRED
-
plural form of resource
e.g. projects
REQUIRED CONTEXT
- resource name in PascalCase, snake_case, and plural forms
ROLES & RULES
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
EXPECTED OUTPUT
- Format
- code
- Constraints
-
- follow template from assets/template.py
- replace placeholders with provided resource names
- include proper auth, response models, and status codes
EXAMPLES
Includes code examples for authentication patterns, response models, and HTTP status codes, plus a numbered integration list.
CAVEATS
- Dependencies
-
- Requires template from assets/template.py
- Missing context
-
- Full content of assets/template.py
- Project-specific import paths and dependency names
- Target Python / FastAPI version
- Ambiguities
-
- 'established patterns' is referenced but never defined or linked
- 'When to Use' section is circular and adds no decision criteria
QUALITY
- OVERALL
- 0.77
- CLARITY
- 0.82
- SPECIFICITY
- 0.78
- REUSABILITY
- 0.88
- COMPLETENESS
- 0.65
IMPROVEMENT SUGGESTIONS
- Replace the generic 'When to Use' paragraph with concrete trigger conditions (e.g., 'Use when a new resource CRUD endpoint set is required').
- Embed a minimal but complete template.py example instead of only describing placeholder replacement.
- Add a short checklist of required inputs (resource name, auth type, response models) before generation begins.
USAGE
Copy the prompt above and paste it into your AI of choice — Claude, ChatGPT, Gemini, or anywhere else you're working. Replace any placeholder sections with your own context, then ask for the output.
MORE FOR DEVELOPER
- Context7 Library Documentation Expert developer coding
- Structured Python Production Code Generator developer coding
- Angular Standalone Directive Generator developer coding
- Pytest Unit Test Suite Generator developer coding
- Unity Architecture Specialist developer coding
- Web Typography CSS Generator developer coding
- VSCode CodeTour File Expert developer coding
- Senior Python Code Reviewer developer coding
- Structured Cross-Language Code Translator developer coding
- Multi-DB SQL Query Optimizer and Builder developer coding
- Base R Programming Reference Guide developer coding
- Flutter Map SDK Layer Bug Fixer developer coding
- Expert Mobile App Builder for iOS Android developer coding
- Scalable Backend Architect Expert developer coding
- Comprehensive TypeScript Codebase Reviewer developer coding
- Code Improvement and Refactoring Suggester developer coding
- Vercel SPA Blank Screen Diagnoser developer coding
- CLAUDE.md File Generator for AI Coders developer coding
- App Store Screenshots Gallery Generator developer coding
- Spring Boot SOLID Architect Specialist developer coding
- React SaaS Metrics Dashboard Generator developer coding
- Software Optimization Auditor developer coding
- Senior Frontend Task Checklist Architect developer coding
- POSIX Shell Script Developer with Checklists developer coding
- Astro v6 Strict Architecture Rules developer coding