fastapi

fastapi is a skill for Claude Code, Codex from andresquirogadev/skillsense. It costs 0 tokens per session (568 once invoked), scanned A, original, MIT.

A set of conventions for building FastAPI applications, a Python framework for creating web APIs. It organizes routes, data models, validation, settings, security, and database code.

In plain words
What is it for?
Use it when creating or extending FastAPI endpoints, request and response data models, startup and shutdown logic, database access, and reusable dependencies.
Why use it?
It gives the project a consistent structure and avoids outdated FastAPI and Pydantic patterns. Separating these parts makes the API easier to maintain.

Skill for Claude CodeCodex

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

Good fit Use it when creating or extending FastAPI endpoints, request and response data models, startup and shutdown logic, database access, and reusable dependencies.

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

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/andresquirogadev/skillsense/fastapi/github.svg)](https://agentmods.dev/skills/andresquirogadev/skillsense/fastapi)
Your own site
<a href="https://agentmods.dev/skills/andresquirogadev/skillsense/fastapi"><img src="https://agentmods.dev/badge/skills/andresquirogadev/skillsense/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/andresquirogadev/skillsense/fastapi"><img src="https://agentmods.dev/badge/skills/andresquirogadev/skillsense/fastapi.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 568 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.00000 $0.00568
Opus 5.5 $0.00000 $0.00227
Sonnet 5.5 $0.00000 $0.00114
Haiku 4.5 $0.00000 $0.00057

Measured 1mo ago against content hash 455d11b13c95, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 1mo 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.

packages/catalog/skills/fastapi/SKILL.md · 64 lines

How it starts

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

FastAPI Skill

You are working on a FastAPI project. Apply these conventions.

Project Structure

app/
├── main.py            # FastAPI app creation, router inclusion
├── routers/           # APIRouter groupings by domain
├── models/            # SQLAlchemy / database models
├── schemas/           # Pydantic request/response schemas
├── dependencies/      # Reusable Depends() functions
├── services/          # Business logic layer
└── core/              # Settings, security, database session

App Setup

  • Create the FastAPI app once and include routers: app.include_router(users.router, prefix="/users", tags=["users"]).
  • Use lifespan for startup/shutdown logic (not deprecated on_event):
    from contextlib import asynccontextmanager
    @asynccontextmanager
    async def lifespan(app: FastAPI):
        # startup
        yield
        # shutdown
    app = FastAPI(lifespan=lifespan)
    

Pydantic Models (v2)

  • Use Pydantic v2 — model_config = ConfigDict(from_attributes=True) replaces class Config: orm_mode = True.
  • Separate schemas for creation (UserCreate), update (UserUpdate), and response (UserResponse).
  • Use model_validator and field_validator (not @validator — that's v1 syntax).

Dependency Injection

  • Create reusable dependencies with Depends():
    async def get_current_user(token: str = Depends(oauth2_scheme), db: Session = Depends(get_db)) -> User:
    
  • Inject database sessions via Depends(get_db) — never create sessions inside route handlers.

Async

  • Use async def for route handlers that perform I/O (DB, HTTP).
  • Use def (synchronous) for CPU-bound handlers — FastAPI runs them in a thread pool.
  • Use asyncpg or SQLAlchemy async engine for async DB operations.

Error Handling

  • Raise HTTPException(status_code=404, detail="Not found") for expected errors.
  • Use exception handlers for global errors: @app.exception_handler(RequestValidationError).
  • Return consistent error shapes — define a base ErrorResponse Pydantic schema.

Read the full file on GitHub · 64 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. 1mo ago First seen · 64 lines · 0 tokens per session scan A 455d11b13c95

Subscribe to this mod's changes

fastapi is a skill published in the GitHub repository andresquirogadev/skillsense (2 stars, last pushed 6mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 568 tokens. 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-31.

Related

Other skills, from other repositories

fastapi

Use when building, reviewing, testing, securing or shipping a FastAPI / async Python service — routers, Pydantic v2 schemas, dependency injection, async SQLAlchemy 2.0, OAuth2/JWT, ASGITransport tests, production wiring. NOT language-level Python or packaging (that is python), NOT engine-level SQL (that is…

ericrisco/rsc-harness · 94 tokens

django

Use when building, reviewing, securing, testing or shipping a Django app — models, migrations, QuerySets/managers, FBV/CBV views, forms, the admin, settings split, and Django REST Framework (serializers, ModelViewSet, permissions). NOT async FastAPI/Pydantic services (that is fastapi), NOT Postgres schema/index work…

ericrisco/rsc-harness · 84 tokens

developing-with-python

Python 3.11+ development with type hints, async patterns, FastAPI, and pytest. Use for backend services, CLI tools, data processing, and API development.

FortiumPartners/ensemble · 40 tokens

developing-with-typescript

TypeScript 5.x development with type system, generics, utility types, and strict mode patterns. Use when writing TypeScript code or adding types to JavaScript projects.

FortiumPartners/ensemble · 41 tokens

plugin-system

Generic plugin system for Python applications. Auto-discovery, validation, fault tolerance. Zero dependencies (Python stdlib only).

ellmos-ai/skills · 27 tokens

codegen

Use for .NET code generation work with Roslyn, Microsoft.OpenApi, Razor templates, DTO/manager/controller generation, REST API generation, C# HttpClient generation, Angular/Axios TypeScript request clients, generated formatting, and deterministic output.

AterDev/Perigon.CLI · 53 tokens