fastapi-init

fastapi-init is a skill for Claude Code from robhowley/py-pit-skills. It costs 109 tokens per session (3,545 once invoked), scanned A, original, MIT.

A workflow for creating a new FastAPI project, a Python framework for building web services and REST APIs. It sets up the project structure and development environment.

In plain words
What is it for?
Use it to bootstrap a new Python web service, REST API, or microservice, including its package name, dependencies, and basic server command.
Why use it?
It removes the repetitive setup work and gives the agent a defined process for starting a FastAPI service.

Skill for Claude Code

Written for Claude Code: disable-model-invocation in frontmatter.

Part of the py-pit plugin — 16 skills, 1 hook shipped together

Good fit Use it to bootstrap a new Python web service, REST API, or microservice, including its package name, dependencies, and basic server command.

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

Made for: Claude Code.

Or install py-pit, the plugin that ships this one along with the rest of its 16 skills, 1 hook.

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/robhowley/py-pit-skills/fastapi-init/github.svg)](https://agentmods.dev/skills/robhowley/py-pit-skills/fastapi-init)
Your own site
<a href="https://agentmods.dev/skills/robhowley/py-pit-skills/fastapi-init"><img src="https://agentmods.dev/badge/skills/robhowley/py-pit-skills/fastapi-init/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-init

Your own site · 80×15
<a href="https://agentmods.dev/skills/robhowley/py-pit-skills/fastapi-init"><img src="https://agentmods.dev/badge/skills/robhowley/py-pit-skills/fastapi-init.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 109 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,545 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.00109 $0.03545
Opus 5.5 $0.00044 $0.01418
Sonnet 5.5 $0.00022 $0.00709
Haiku 4.5 $0.00011 $0.00354

Measured 1mo ago against content hash 938fab91e8fd, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

fastapi-init 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.

skills/fastapi-init/SKILL.md · 459 lines

How it starts

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

fastapi-init

Scaffold a new FastAPI project end-to-end. This skill coordinates with others in the plugin — invoke them at the right steps rather than reinventing what they already encode.

Prerequisite skills

  • uv skill: use for all uv add, uv run, and environment commands — never fall back to pip
  • click-cli skill: consult if the user wants an extended CLI beyond the basic server entry point
  • fastapi-errors skill: the authority on the full error architecture — domain subclasses, error codes, auth error patterns, and existing-repo strategy

Step 1 — Confirm the service name

Ask: "What's the name of this service?"

Use a single snake_case variable {pkg_name} for everything — the project directory, the Python package, the pyproject.toml name, and the CLI command (e.g. my_service). The uv run {pkg_name} serve command will use it directly. Derive {PkgName} as the PascalCase form of {pkg_name} (e.g. my_service → MyService) — used only for the exception class name.


Step 2 — Initialize with uv

uv init {pkg_name} --app --no-workspace
cd {pkg_name}

Remove the stub file uv generates (hello.py), then add dependencies:

uv add fastapi "uvicorn[standard]" "sqlalchemy[asyncio]" aiosqlite "pydantic-settings" click
uv add --dev pytest pytest-asyncio httpx

After uv init, add the hatchling build backend to pyproject.toml so [project.scripts] works:

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.hatch.build.targets.wheel]
packages = ["{pkg_name}"]

Step 3 — Directory structure

Build this layout under the project root:

{pkg_name}/
├── pyproject.toml
├── uv.lock
├── {pkg_name}/                         ← Python package, same name as project root
│   ├── __init__.py
│   ├── main.py                # FastAPI app + lifespan
│   ├── cli.py                 # click entry point
│   ├── core/
│   │   ├── __init__.py
│   │   ├── config.py          # pydantic-settings Settings
│   │   └── exceptions.py      # {PkgName}Error base + usage note
│   ├── api/
│   │   ├── __init__.py
│   │   ├── deps.py            # shared Annotated Depends providers
│   │   └── v1/
│   │       ├── __init__.py
│   │       └── routes/
│   │           ├── __init__.py
│   │           └── health.py
│   ├── db/
│   │   ├── __init__.py
│   │   ├── base.py            # Base, TimestampMixin, naming convention
│   │   └── session.py         # engine, AsyncSessionLocal, get_db
│   ├── models/
│   │   └── __init__.py        # SQLAlchemy declarative models
│   └── schemas/
│       ├── __init__.py
│       └── base.py            # APIModel + ReadModel base schemas
└── tests/
    ├── __init__.py
    ├── conftest.py
    └── api/
        └── v1/
            ├── __init__.py
            └── test_health.py

Read the full file on GitHub · 459 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 · 459 lines · 109 tokens per session scan A 938fab91e8fd

Subscribe to this mod's changes

fastapi-init is a skill published in the GitHub repository robhowley/py-pit-skills (5 stars, last pushed 7mo ago), licensed MIT. It adds 109 tokens to every session and 3,545 once invoked, about $0.0004 per session on Opus 5.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.