fastapi

fastapi is a skill for Claude Code from alivirgo/Major-AI-Skills. It costs 32 tokens per session (825 once invoked), scanned A, original, MIT.

An operational guide for FastAPI, a Python framework for building HTTP APIs. It covers request validation, routes, authentication hooks, asynchronous handlers, automatic API documentation, and API tests.

In plain words
What is it for?
Use it to create REST or JSON endpoints, define typed request and response models, add authentication dependencies, generate OpenAPI documentation, and test routes.
Why use it?
It helps agents keep API inputs and outputs consistent, avoid blocking asynchronous requests, and handle errors and authentication in a predictable way.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: mentions Codex.

Part of the major-ai-skills plugin — 147 skills, 7 plugins shipped together

Good fit Use it to create REST or JSON endpoints, define typed request and response models, add authentication dependencies, generate OpenAPI documentation, and test routes.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/alivirgo/major-ai-skills/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 alivirgo/Major-AI-Skills --skill fastapi
Clone the repo
git clone --depth 1 https://github.com/alivirgo/Major-AI-Skills

Made for: Claude Code.

Or install major-ai-skills, the plugin that ships this one along with the rest of its 147 skills, 7 plugins.

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/alivirgo/major-ai-skills/fastapi/github.svg)](https://agentmods.dev/skills/alivirgo/major-ai-skills/fastapi)
Your own site
<a href="https://agentmods.dev/skills/alivirgo/major-ai-skills/fastapi"><img src="https://agentmods.dev/badge/skills/alivirgo/major-ai-skills/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/alivirgo/major-ai-skills/fastapi"><img src="https://agentmods.dev/badge/skills/alivirgo/major-ai-skills/fastapi.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 32 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 825 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.
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.00032 $0.00825
Opus 5 $0.00016 $0.00413
Sonnet 5 $0.00006 $0.00165
Haiku 4.5 $0.00003 $0.00082

Measured 5d ago against content hash be114b08ba39, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, 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 5d 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/fastapi/SKILL.md · 110 lines

How it starts

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

FastAPI Python APIs AI Skill Guide

Overview & Engine Architecture

FastAPI builds HTTP APIs with type hints and Pydantic validation, generating OpenAPI automatically. Routes can be sync or async; dependencies inject auth, DB sessions, and settings. Agents keep CPU-bound or blocking ORM calls from stalling the event loop, validate every input model, and document response models explicitly.

uvicorn / gunicorn workers
        |
     FastAPI app
   +----+----+----+
   | routers       |
   | Depends()     |
   | Pydantic I/O  |
   | OpenAPI /docs |
   +---------------+

When to use this skill

  • Creating versioned REST/JSON APIs in Python
  • Adding auth dependencies and consistent error handlers
  • Generating clients from /openapi.json
  • Writing API tests with TestClient or httpx ASGI transport

Operational directives

  1. Define request and response models; avoid raw dict returns in public APIs.
  2. Use APIRouter per domain (/users, /billing).
  3. Put shared settings in a cached Settings dependency (pydantic-settings).
  4. Prefer async DB drivers for async routes; otherwise run sync work in a threadpool consciously.
  5. Never commit secrets; load from environment.

App sketch

from fastapi import Depends, FastAPI, HTTPException
from pydantic import BaseModel, Field

app = FastAPI(title="Inventory API", version="1.2.0")

class ItemIn(BaseModel):
    sku: str = Field(min_length=1, max_length=64)
    qty: int = Field(ge=0)

class ItemOut(ItemIn):
    id: int

def get_current_user(auth: str | None = None) -> str:
    if not auth:
        raise HTTPException(status_code=401, detail="unauthorized")
    return "user"

@app.post("/items", response_model=ItemOut)
def create_item(body: ItemIn, user: str = Depends(get_current_user)) -> ItemOut:
    return ItemOut(id=1, **body.model_dump())

Commands

uvicorn app.main:app --reload --port 8000
# OpenAPI UI: http://127.0.0.1:8000/docs
pytest -q

Testing sketch

from fastapi.testclient import TestClient
from app.main import app

client = TestClient(app)

def test_create_item_unauthorized():
    r = client.post("/items", json={"sku": "A", "qty": 1})
    assert r.status_code == 401

Read the full file on GitHub · 110 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. 5d ago First seen · 110 lines · 32 tokens per session scan A be114b08ba39

Subscribe to this mod's changes

fastapi is a skill published in the GitHub repository alivirgo/Major-AI-Skills (1 stars, last pushed yesterday), licensed MIT. It adds 32 tokens to every session and 825 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-05.

Related

Other skills, from other repositories