fastapi

fastapi is a skill for Claude Code, Codex from nimadorostkar/Claude-Skills-collection. It costs 34 tokens per session (1,010 once invoked), scanned A, original, MIT.

A set of guidelines for building APIs with FastAPI, a Python web framework. It covers request and response validation, dependency injection, asynchronous database access, authentication, background tasks, and testing.

In plain words
What is it for?
Use it when creating or reviewing FastAPI endpoints, organizing routers and dependencies, defining Pydantic models, connecting async SQLAlchemy sessions, adding authentication, and testing with an HTTP client.
Why use it?
It helps prevent blocking work inside asynchronous handlers, overly large route functions, incorrectly scoped database sessions, and responses that expose more data than intended.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when creating or reviewing FastAPI endpoints, organizing routers and dependencies, defining Pydantic models, connecting async SQLAlchemy sessions, adding authentication, and testing with an HTTP client.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/nimadorostkar/claude-skills-collection/fastapi
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.

Any agent
npx skills add nimadorostkar/Claude-Skills-collection --skill fastapi
Clone the repo
git clone --depth 1 https://github.com/nimadorostkar/Claude-Skills-collection

Made for: Claude Code, Codex.

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/nimadorostkar/claude-skills-collection/fastapi/github.svg)](https://agentmods.dev/skills/nimadorostkar/claude-skills-collection/fastapi)
Your own site
<a href="https://agentmods.dev/skills/nimadorostkar/claude-skills-collection/fastapi"><img src="https://agentmods.dev/badge/skills/nimadorostkar/claude-skills-collection/fastapi/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for fastapi

Your own site · 80×15
<a href="https://agentmods.dev/skills/nimadorostkar/claude-skills-collection/fastapi"><img src="https://agentmods.dev/badge/skills/nimadorostkar/claude-skills-collection/fastapi.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 34 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,010 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.1 $0.00034 $0.01010
Opus 5 $0.00017 $0.00505
Sonnet 5 $0.00007 $0.00202
Haiku 4.5 $0.00003 $0.00101

Measured 11d ago against content hash a412a14083b2, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

fastapi 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 11d ago.

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.

skills/backend/fastapi/SKILL.md · 102 lines

How it starts

The opening of the file, as written. The whole thing — 102 lines — stays where its author put it; the contents beside it link to each section on GitHub.

FastAPI

Purpose

Build FastAPI services that use the framework's strengths — declarative validation and dependency injection — without falling into its two standard traps: blocking calls inside async def, and business logic in the route handler.

When to Use

  • Building or reviewing a FastAPI application.
  • Structuring dependencies, authentication, and database sessions.
  • Diagnosing latency that appears only under concurrency.
  • Writing tests for FastAPI endpoints.

Capabilities

  • Route and router organization.
  • Pydantic v2 models for request, response, and settings.
  • Dependency injection with scoped lifecycles.
  • Async SQLAlchemy sessions, correctly scoped per request.
  • Authentication and authorization dependencies.
  • Testing with httpx.AsyncClient and dependency overrides.

Inputs

  • The API contract and the data layer.
  • Whether the workload is I/O-bound (nearly always) or CPU-bound.

Outputs

  • Thin route handlers delegating to service functions.
  • Response models that control exactly what is serialized.
  • A test suite that overrides dependencies rather than mocking internals.

Workflow

  1. Define the schemas — Separate request, response, and internal models. Never return an ORM object directly; a response_model is your defense against leaking a password hash.
  2. Build the dependencies — Database session, current user, feature flags. These are the injection points that make the app testable.
  3. Keep handlers thin — Parse, authorize, delegate, return. Business logic lives in a service module that knows nothing about HTTP.
  4. Get async right — In an async def handler, every I/O call must be awaited. A blocking call there stalls the entire event loop, not just that request.
  5. Test through the apphttpx.AsyncClient with app.dependency_overrides gives you real routing, real validation, and a fake database.

Best Practices

  • A blocking call inside async def (a sync DB driver, requests, time.sleep) blocks every concurrent request on that worker. If a handler must call blocking code, define it as def — FastAPI runs it in a thread pool.
  • Always set response_model. Without it, whatever your service returns is what the client sees, including fields you added last week.
  • Use Annotated[Session, Depends(get_session)] — it keeps signatures readable and reusable.
  • Validate settings with pydantic-settings at startup. Fail to boot on a bad config rather than at 3am on the first request that touches it.
  • BackgroundTasks runs in the same process and dies with it. For anything that must not be lost, use a real queue.
  • Mount routers by domain, not by HTTP verb.

Read the full file on GitHub · 102 lines

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. 11d ago First seen · 102 lines · 34 tokens per session scan A a412a14083b2

Subscribe to this mod's changes

fastapi is a skill published in the GitHub repository nimadorostkar/Claude-Skills-collection (26 stars, last pushed 23d ago), licensed MIT. It adds 34 tokens to every session and 1,010 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-08-30.

Related

Other skills, from other repositories

fastapi-expert

Use when building high-performance async Python APIs with FastAPI and Pydantic V2. Invoke to create REST endpoints, define Pydantic models, implement authentication flows, set up async SQLAlchemy database operations, add JWT authentication, build WebSocket endpoints, or generate OpenAPI documentation. Trigger terms…

Jeffallan/claude-skills · 95 tokens

django-expert

Use when building Django web applications or REST APIs with Django REST Framework. Invoke when working with settings.py, models.py, manage.py, or any Django project file. Creates Django models with proper indexes, optimizes ORM queries using selectrelated/prefetchrelated, builds DRF serializers and viewsets, and…

Jeffallan/claude-skills · 96 tokens

framework-migration-assistant

Automatically migrate Python web applications between frameworks (Flask → FastAPI, Django → FastAPI). Use when you need to migrate an existing web application to a modern framework while preserving functionality. The skill analyzes the codebase, updates routes, handlers, configuration, dependency injection patterns…

ArabelaTso/Skills-4-SE · 92 tokens

developing-kafka-python-client

Use when the user wants to build a Python Kafka producer or consumer, add Schema Registry to existing Python code, migrate from raw JSON to schema-backed serialization, or scaffold a confluent-kafka-python project for Confluent Cloud, local Docker, or WarpStream. Also use when user wants to optimize Python Kafka…

confluentinc/agent-skills · 75 tokens

python-programming-expert

Expert-level skill for Python programming (Python 3.13/3.14+). Covers type safety, generic syntax (PEP 695), async/await TaskGroups, FastAPI 0.115+, Pydantic v2, uv package manager, Ruff, and pytest in English and Indonesian.

roedyrustam/vibes-plug · 68 tokens

upstash-box-py

Work with the upstash-box Python SDK for sandboxed cloud containers with AI agents, shell, filesystem, git, cron schedules, snapshots, and a headless browser. Use when building with Upstash Box in Python, creating a sandbox or isolated environment to run untrusted or agent-generated code, running AI coding agents in…

upstash/skills · 109 tokens