fastapi-router-py

fastapi-router-py is a skill for Claude Code, Codex from microsoft/skills. It costs 46 tokens per session (535 once invoked), scanned A, original, MIT.

A template for building FastAPI routers, which are groups of web API endpoints, with create, read, update, and delete operations.

In plain words
What is it for?
Use it when adding authenticated REST endpoints and CRUD operations to a FastAPI application.
Why use it?
It helps keep API routes consistent by covering authentication, response formats, and HTTP status codes.

Skill for Claude CodeCodex

Part of the azure-sdk-python plugin — 40 skills shipped together

About the project

microsoft/skills is a collection of skills, custom agents, AGENTS.md templates, plugins, hooks, commands, and MCP configurations that give AI coding agents context for Azure SDK and Microsoft AI Foundry development. Developers use it to install selected domain-specific guidance into coding-agent environments. The catalogue entries are the repository’s own agent resources and supporting configurations.

microsoft/skills · 2,992 stars · on GitHub

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/microsoft/skills/fastapi-router-py
Any agent
npx skills add microsoft/skills --skill fastapi-router-py
Clone the repo
git clone --depth 1 https://github.com/microsoft/skills

Made for: Claude Code, Codex.

Or install azure-sdk-python, the plugin that ships this one along with the rest of its 40 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for fastapi-router-py

README.md
[![agentmods](https://agentmods.dev/badge/skills/microsoft/skills/fastapi-router-py.svg)](https://agentmods.dev/skills/microsoft/skills/fastapi-router-py)
Your own site
<a href="https://agentmods.dev/skills/microsoft/skills/fastapi-router-py"><img src="https://agentmods.dev/badge/skills/microsoft/skills/fastapi-router-py.svg" alt="Measured on agentmods" height="20"></a>
Per session 46 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 535 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00046 $0.00535
Opus 5 $0.00023 $0.00267
Sonnet 5 $0.00009 $0.00107
Haiku 4.5 $0.00005 $0.00053

Measured yesterday against content hash a8c5911b2c67, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

fastapi-router-py scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

The scan reads SKILL.md. This mod also ships 1 executable file (assets/template.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.github/plugins/azure-sdk-python/skills/fastapi-router-py/SKILL.md · 73 lines

What it actually says

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

File Contents
references/capabilities.md Additional non-hero capabilities, operation-group coverage, and production checklists.
Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 73 lines · 46 tokens per session scan A a8c5911b2c67

Subscribe to this mod's changes

fastapi-router-py is a skill published in the GitHub repository microsoft/skills (2,992 stars, last pushed today), licensed MIT. It adds 46 tokens to every session and 535 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

agents-v2-py-v2

Azure AI Hosted Agents (Python) workflow skill. Use this skill when the user needs Build container-based Foundry Agents with Azure AI Projects SDK (ImageBasedHostedAgentDefinition). Use when creating hosted agents with custom container images in Azure AI Foundry and the operator should preserve the upstream workflow…

diegosouzapw/awesome-omni-skills · 78 tokens

agents-v2-py

Azure AI Hosted Agents (Python) workflow skill. Use this skill when the user needs Build container-based Foundry Agents with Azure AI Projects SDK (ImageBasedHostedAgentDefinition). Use when creating hosted agents with custom container images in Azure AI Foundry and the operator should preserve the upstream workflow…

diegosouzapw/awesome-omni-skills · 76 tokens

agents-sdk-dotnet-activityhandler-migration

Use when migrating a Microsoft 365 Agents SDK agent that uses ActivityHandler or TeamsActivityHandler to AgentApplication. This is ONLY for DotNet projects that uses Microsoft.Agents. packages. Triggered by Agents SDK bots that subclass ActivityHandler or TeamsActivityHandler that need to be modernized to…

microsoft/Agents · 76 tokens

agents-sdk-python-otel

Use when adding, configuring, validating, or troubleshooting OpenTelemetry observability for a Microsoft 365 Agents SDK application in Python. Trigger when the user mentions OpenTelemetry, OTel, telemetry, traces, metrics, logs, OTLP, Aspire Dashboard, Application Insights, Azure Monitor, distributed tracing, custom…

microsoft/Agents · 81 tokens

agents-sdk-provision

Use when provisioning Azure resources for a Microsoft Agents SDK application — including creating an Azure Bot Service resource, setting up Entra app registrations, configuring identity credentials (UserManagedIdentity, FederatedCredentials, or ClientSecret), adding a Teams channel, running Bicep deployments for SSO…

microsoft/Agents · 131 tokens

bf-to-agents-sdk-typescript-migration

Assess and migrate JavaScript or TypeScript bots from BotBuilder/Bot Framework SDK to Microsoft 365 Agents SDK with AgentApplication. Use to produce a migration report and plan before editing code, map BotBuilder packages and APIs, identify unsupported features, and implement only the supported plan items selected by…

microsoft/Agents · 71 tokens