FA

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.zip

Installs 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.
249 chars✓ has a “when” trigger
Beginner

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

You give it
Resource name
You get back
FastAPI router template

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

  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

Best Practices

  1. Pick def or async def per endpoint based on whether you call async I/O; do not call blocking I/O from an async def handler.
  2. Manage long-lived resources (DB pools, HTTP clients) in lifespan and inject via Depends; use with/async with for per-request resources.

Reference Files

FileContents
references/capabilities.mdAdditional 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

FastAPI installed

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.

SkillInstallsUpdatedSafetyDifficulty
fastapi-router-py (this skill)527dNo flagsBeginner
fastapi-templates5202moNo flagsIntermediate
fastapi-pro794moNo flagsAdvanced
pydantic-models-py327dNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

More by microsoft

View all by microsoft

fix-dependabot-alerts

microsoft

Fix Dependabot security alerts by updating vulnerable npm dependencies. Use when the user mentions "dependabot", "security alerts", "vulnerability", "CVE", or wants to update packages with security issues.

1872

wiki-architect

microsoft

Analyzes code repositories and generates hierarchical documentation structures with onboarding guides. Use when the user wants to create a wiki, generate documentation, map a codebase structure, or understand a project's architecture at a high level.

1144

azure-ai-vision-imageanalysis-py

microsoft

Azure AI Vision Image Analysis SDK for captions, tags, objects, OCR, people detection, and smart cropping. Use for computer vision and image understanding tasks. Triggers: "image analysis", "computer vision", "OCR", "object detection", "ImageAnalysisClient", "image caption".

622

playwright-mcp-dev

microsoft

Explains how to add and debug playwright MCP tools and CLI commands.

529

react-flow-node-ts

microsoft

Create React Flow node components with TypeScript types, handles, and Zustand integration. Use when building custom nodes for React Flow canvas, creating visual workflow editors, or implementing node-based UI components.

530

release-note-generation

microsoft

Toolkit for generating PowerToys release notes from GitHub milestone PRs or commit ranges. Use when asked to create release notes, summarize milestone PRs, generate changelog, prepare release documentation, request Copilot reviews for PRs, update README for a new release, manage PR milestones, or collect PRs between commits/tags. Supports PR collection by milestone or commit range, milestone assignment, grouping by label, summarization with external contributor attribution, and README version bumping.

537

Search skills

Search the agent skills registry