Software DevelopmentOfficial · microsoft

Fastapi Router Py skill for Claude

Create FastAPI routers with CRUD operations, authentication dependencies, and proper response models.

When Claude uses it

Use when building REST API endpoints, creating new routes, implementing CRUD operations, or adding authenticated endpoints in FastAPI applications.

Fastapi Router Py SKILL.md

The full skill file from microsoft/skills (MIT).

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.

How to install Fastapi Router Py

Claude Code

Copy the skill into your personal skills folder (or into .claude/skills/ inside a project):

npx degit microsoft/skills/.github/plugins/azure-sdk-python/skills/fastapi-router-py#main ~/.claude/skills/fastapi-router-py

Codex

npx degit microsoft/skills/.github/plugins/azure-sdk-python/skills/fastapi-router-py#main ~/.codex/skills/fastapi-router-py

Claude.ai and Claude Desktop

Download the skill folder from GitHub, zip it, and upload it under Settings → Capabilities → Skills.

Frequently asked questions

+What does the Fastapi Router Py skill do?

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.

+How do I install Fastapi Router Py in Claude Code?

Copy the skill folder into ~/.claude/skills/fastapi-router-py, for example with "npx degit microsoft/skills/.github/plugins/azure-sdk-python/skills/fastapi-router-py#main ~/.claude/skills/fastapi-router-py". Claude Code loads it automatically and uses it when a task matches.

+Does Fastapi Router Py work with ChatGPT or Codex?

Yes. Fastapi Router Py uses the open SKILL.md format. In Codex, put the folder in ~/.codex/skills/fastapi-router-py. In Claude.ai, zip the folder and upload it under Settings → Capabilities → Skills.

+Is Fastapi Router Py free?

Fastapi Router Py is published on GitHub by microsoft under the MIT license, which allows free use.

Related software development skills

  1. Code Review

    Review the changes since a fixed point (commit, branch, tag, or merge-base) along two axes: Standards (does the code follow this repo's…

    mattpocock/skills★ 327k
  2. Using Agent Skills

    Discovers and invokes agent skills. Use when starting a session, or when you need to decide which skill or workflow applies to the piece of…

    addyosmani/agent-skills★ 119k
  3. Build

    Fully automate a coding task with make-plan, do, and babysit.

    thedotmack/claude-mem★ 118k
  4. Install Atk

    Official

    Install or update the M365 Agents Toolkit (ATK) CLI and VS Code extension.

    microsoft/skills★ 3.2k
  5. M365 Agents Dotnet

    Official

    Microsoft 365 Agents SDK for .NET. Build multichannel agents for Teams/M365/Copilot Studio with ASP.NET Core hosting, AgentApplication…

    microsoft/skills★ 3.2k
  6. M365 Agents Py

    Official

    Microsoft 365 Agents SDK for Python. Build multichannel agents for Teams/M365/Copilot Studio with aiohttp hosting, AgentApplication…

    microsoft/skills★ 3.2k
  7. M365 Agents Ts

    Official

    Microsoft 365 Agents SDK for TypeScript/Node.js. Build multichannel agents for Teams/M365/Copilot Studio with AgentApplication routing,…

    microsoft/skills★ 3.2k
  8. Pydantic Models Py

    Official

    Create Pydantic models following the multi-model pattern with Base, Create, Update, Response, and InDB variants.

    microsoft/skills★ 3.2k
  9. Skill Creator

    Official

    Guide for creating effective skills for AI coding agents working with Azure SDKs and Microsoft Foundry services.

    microsoft/skills★ 3.2k

See all software development skills →

More skills from microsoft

  1. Finetuning

    Official

    Fine-tune models on Microsoft Foundry using SFT (supervised), DPO (preference), or RFT (reinforcement with graders).

    microsoft/skills★ 3.2k
  2. Foundry Iq

    Official

    Use for Azure AI Search, Foundry IQ, document-grounded agents and graphs built over documents.

    microsoft/skills★ 3.2k
  3. Frontend Design Review

    Official

    Review and create distinctive, production-grade frontend interfaces with high design quality and design system compliance.

    microsoft/skills★ 3.2k

All skills by microsoft →

Give your whole team an AI agent with skills

Cody runs managed AI agents your team can message in Slack, Teams, WhatsApp and the web, with 50+ business integrations, scheduled tasks and memory. No terminal required.