fastapi-templates

fastapi-templates is a skill for Claude Code, Codex from HermeticOrmus/claude-code-game-development. It costs 37 tokens per session (3,610 once invoked), scanned A, a copy of fastapi-templates, MIT.

A project-template guide for FastAPI, a Python framework for building web APIs, with async code, dependency injection, and error handling.

In plain words
What is it for?
Use it to start asynchronous REST APIs and services, organise routes and business logic, connect databases, add shared dependencies, and set up testing.
Why use it?
It provides a consistent starting structure so new API projects do not have to assemble folders, database access, configuration, security, and tests from scratch.

Skill for Claude CodeCodex

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/hermeticormus/claude-code-game-development/fastapi-templates
Any agent
npx skills add HermeticOrmus/claude-code-game-development --skill fastapi-templates
Clone the repo
git clone --depth 1 https://github.com/HermeticOrmus/claude-code-game-development

Made for: Claude Code, Codex.

Its marketplace also offers this one on its own, as the plugin api-scaffolding/plugin install api-scaffolding after adding the marketplace above.

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-templates

README.md
[![agentmods](https://agentmods.dev/badge/skills/hermeticormus/claude-code-game-development/fastapi-templates.svg)](https://agentmods.dev/skills/hermeticormus/claude-code-game-development/fastapi-templates)
Your own site
<a href="https://agentmods.dev/skills/hermeticormus/claude-code-game-development/fastapi-templates"><img src="https://agentmods.dev/badge/skills/hermeticormus/claude-code-game-development/fastapi-templates.svg" alt="Measured on agentmods" height="20"></a>
Per session 37 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,610 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin 100% copy Near-identical to another mod 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.00037 $0.03610
Opus 5 $0.00018 $0.01805
Sonnet 5 $0.00007 $0.00722
Haiku 4.5 $0.00004 $0.00361

Measured 4d ago against content hash 07d7ca985809, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

fastapi-templates 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 4d 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.

Origin

This is a copy

100% identical to fastapi-templates — 3 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

plugins/api-scaffolding/skills/fastapi-templates/SKILL.md · 565 lines

How it starts

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

FastAPI Project Templates

Production-ready FastAPI project structures with async patterns, dependency injection, middleware, and best practices for building high-performance APIs.

When to Use This Skill

  • Starting new FastAPI projects from scratch
  • Implementing async REST APIs with Python
  • Building high-performance web services and microservices
  • Creating async applications with PostgreSQL, MongoDB
  • Setting up API projects with proper structure and testing

Core Concepts

1. Project Structure

Recommended Layout:

app/
├── api/                    # API routes
│   ├── v1/
│   │   ├── endpoints/
│   │   │   ├── users.py
│   │   │   ├── auth.py
│   │   │   └── items.py
│   │   └── router.py
│   └── dependencies.py     # Shared dependencies
├── core/                   # Core configuration
│   ├── config.py
│   ├── security.py
│   └── database.py
├── models/                 # Database models
│   ├── user.py
│   └── item.py
├── schemas/                # Pydantic schemas
│   ├── user.py
│   └── item.py
├── services/               # Business logic
│   ├── user_service.py
│   └── auth_service.py
├── repositories/           # Data access
│   ├── user_repository.py
│   └── item_repository.py
└── main.py                 # Application entry

2. Dependency Injection

FastAPI's built-in DI system using Depends:

  • Database session management
  • Authentication/authorization
  • Shared business logic
  • Configuration injection

3. Async Patterns

Proper async/await usage:

  • Async route handlers
  • Async database operations
  • Async background tasks
  • Async middleware

Implementation Patterns

Pattern 1: Complete FastAPI Application

# main.py
from fastapi import FastAPI, Depends
from fastapi.middleware.cors import CORSMiddleware
from contextlib import asynccontextmanager

@asynccontextmanager
async def lifespan(app: FastAPI):
    """Application lifespan events."""
    # Startup
    await database.connect()
    yield
    # Shutdown
    await database.disconnect()

app = FastAPI(
    title="API Template",
    version="1.0.0",
    lifespan=lifespan
)

# CORS middleware
app.add_middleware(
    CORSMiddleware,
    allow_origins=["*"],
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)

# Include routers
from app.api.v1.router import api_router
app.include_router(api_router, prefix="/api/v1")

# core/config.py
from pydantic_settings import BaseSettings
from functools import lru_cache

class Settings(BaseSettings):
    """Application settings."""
    DATABASE_URL: str
    SECRET_KEY: str
    ACCESS_TOKEN_EXPIRE_MINUTES: int = 30
    API_V1_STR: str = "/api/v1"

    class Config:
        env_file = ".env"

@lru_cache()
def get_settings() -> Settings:
    return Settings()

# core/database.py
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
from app.core.config import get_settings

settings = get_settings()

engine = create_async_engine(
    settings.DATABASE_URL,
    echo=True,
    future=True
)

AsyncSessionLocal = sessionmaker(
    engine,
    class_=AsyncSession,
    expire_on_commit=False
)

Base = declarative_base()

async def get_db() -> AsyncSession:
    """Dependency for database session."""
    async with AsyncSessionLocal() as session:
        try:
            yield session
            await session.commit()
        except Exception:
            await session.rollback()
            raise
        finally:
            await session.close()

Read the full file on GitHub · 565 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. 4d ago First seen · 565 lines · 37 tokens per session scan A 07d7ca985809

Subscribe to this mod's changes

fastapi-templates is a skill published in the GitHub repository HermeticOrmus/claude-code-game-development (59 stars, last pushed 3mo ago), licensed MIT. It adds 37 tokens to every session and 3,610 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to fastapi-templates, differing in 3 lines, and is treated as a copy.

Related

Other skills, from other repositories

cgs-adopt

Use for adopt tasks that inventory existing source, assets, docs, and tests before mapping work into CGS structure; produce verification evidence, changed or proposed files, and handoff boundaries.

merlinhu1/codex-game-studio · 42 tokens

cgs-architecture-decision

Use for architecture decision tasks that write an ADR with context, options, decision, consequences, validation, and rollback; produce verification evidence, changed or proposed files, and handoff boundaries.

merlinhu1/codex-game-studio · 44 tokens

cgs-architecture-review

Use for architecture review tasks that review architecture for layer violations, scalability risks, engine misuse, testing seams, and production readiness; produce verification evidence, changed or proposed files, and handoff boundaries.

merlinhu1/codex-game-studio · 45 tokens

cgs-art-bible

Use for art bible tasks that define visual identity, shape language, palette, camera, animation, UI style, and asset constraints; produce verification evidence, changed or proposed files, and handoff boundaries.

merlinhu1/codex-game-studio · 46 tokens

cgs-asset-audit

Use for asset audit tasks that audit game assets for completeness, naming, import settings, ownership, licensing, and production risk; produce verification evidence, changed or proposed files, and handoff boundaries.

merlinhu1/codex-game-studio · 46 tokens

cgs-asset-spec

Use for asset spec tasks that specify an individual asset with purpose, constraints, references, dimensions, states, and acceptance criteria; produce verification evidence, changed or proposed files, and handoff boundaries.

merlinhu1/codex-game-studio · 45 tokens