FastAPI

FastAPI is a skill for Claude Code, Codex from kok-o/koko-contextos-agents. It costs 10 tokens per session (874 once invoked), scanned A, original, MIT.

Coding guidance for building web APIs with FastAPI, a Python framework for receiving requests and returning data. It covers project structure, validation models, database access, and tests.

In plain words
What is it for?
It is for structuring FastAPI applications, defining validated request and response models, connecting routes to services and databases, and organising tests.
Why use it?
It helps keep FastAPI projects organised and makes request data and responses follow clear rules.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: installed under .agents/ (shared by several agents).

Good fit It is for structuring FastAPI applications, defining validated request and response models…

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

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/kok-o/koko-contextos-agents/fastapi.svg)](https://agentmods.dev/skills/kok-o/koko-contextos-agents/fastapi)
Your own site
<a href="https://agentmods.dev/skills/kok-o/koko-contextos-agents/fastapi"><img src="https://agentmods.dev/badge/skills/kok-o/koko-contextos-agents/fastapi.svg" alt="Measured on agentmods" height="20"></a>
Per session 10 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 874 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.00010 $0.00874
Opus 5 $0.00005 $0.00437
Sonnet 5 $0.00002 $0.00175
Haiku 4.5 $0.00001 $0.00087

Measured 6d ago against content hash 957953de336b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, 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 6d 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.

.agents/core/skills/fastapi/SKILL.md · 149 lines

How it starts

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

FastAPI

Overview

A brief summary of what the skill does and its core philosophy.

When to Use

Context for when this skill is applicable.

Rules & Patterns

FastAPI — Best Practices

Project Structure

app/
├── main.py              # App entry, CORS, middleware
├── config.py            # Settings with Pydantic BaseSettings
├── database.py          # Database session, engine
├── models/              # SQLAlchemy models
│   ├── __init__.py
│   └── user.py
├── schemas/             # Pydantic schemas (request/response)
│   ├── __init__.py
│   └── user.py
├── api/                 # Route handlers
│   ├── __init__.py
│   ├── deps.py          # Dependency injection
│   └── v1/
│       ├── __init__.py
│       └── users.py
├── services/            # Business logic
│   └── user_service.py
├── repositories/        # Database access
│   └── user_repo.py
└── tests/
    └── test_users.py

Pydantic Models

from pydantic import BaseModel, EmailStr, Field

class UserCreate(BaseModel):
    email: EmailStr
    name: str = Field(..., min_length=1, max_length=100)
    
class UserResponse(BaseModel):
    id: int
    email: str
    name: str
    
    model_config = ConfigDict(from_attributes=True)

Dependency Injection

from fastapi import Depends
from sqlalchemy.ext.asyncio import AsyncSession

async def get_db() -> AsyncGenerator[AsyncSession, None]:
    async with async_session() as session:
        yield session

async def get_current_user(
    token: str = Depends(oauth2_scheme),
    db: AsyncSession = Depends(get_db)
) -> User:
    # Verify token, return user
    ...

Async

  • Use async for all I/O operations (database, HTTP calls, file I/O)
  • Never block the event loop — no sync I/O in async endpoints
  • Use asyncio.gather for parallel async operations
  • Background tasksBackgroundTasks for non-critical work

Error Handling

from fastapi import HTTPException

class AppException(HTTPException):
    def __init__(self, status_code: int, detail: str, code: str):
        super().__init__(status_code=status_code, detail=detail)
        self.code = code

Read the full file on GitHub · 149 lines

Files

What ships with it

5 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. 6d ago First seen · 149 lines · 10 tokens per session scan A 957953de336b

Subscribe to this mod's changes

FastAPI is a skill published in the GitHub repository kok-o/koko-contextos-agents (2 stars, last pushed 2d ago), licensed MIT. It adds 10 tokens to every session and 874 once invoked, about $0.0001 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-31.