fastapi-conventions

fastapi-conventions is a skill for Claude Code, Codex from Cypsy1714/cchad. It costs 26 tokens per session (292 once invoked), scanned A, original, MIT.

A set of coding conventions for FastAPI, a Python framework for building web APIs. It covers routes, request validation, shared dependencies, asynchronous code, resources, errors, and API schemas.

In plain words
What is it for?
Use it when building or reviewing FastAPI backends, including route modules, Pydantic request and response models, dependency injection, database sessions, and async handlers.
Why use it?
It keeps FastAPI projects organized as they grow and helps prevent common mistakes such as blocking an asynchronous request or accepting unvalidated data.

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/cypsy1714/cchad/fastapi-skill
Any agent
npx skills add Cypsy1714/cchad --skill fastapi-skill
Clone the repo
git clone --depth 1 https://github.com/Cypsy1714/cchad

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

README.md
[![agentmods](https://agentmods.dev/badge/skills/cypsy1714/cchad/fastapi-skill.svg)](https://agentmods.dev/skills/cypsy1714/cchad/fastapi-skill)
Your own site
<a href="https://agentmods.dev/skills/cypsy1714/cchad/fastapi-skill"><img src="https://agentmods.dev/badge/skills/cypsy1714/cchad/fastapi-skill.svg" alt="Measured on agentmods" height="20"></a>
Per session 26 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 292 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00026 $0.00292
Opus 5 $0.00013 $0.00146
Sonnet 5 $0.00005 $0.00058
Haiku 4.5 $0.00003 $0.00029

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

Security

Grade A, and why

fastapi-conventions 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 3d 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.

src/cchad/data/skills/fastapi-skill/SKILL.md · 33 lines

What it actually says

FastAPI conventions

Guidance for building FastAPI services that stay clean under growth.

Structure

  • Group routes with APIRouter per resource; keep one router per module.
  • Put request/response shapes in Pydantic models. Never accept or return raw dicts at the boundary — let the schema validate.
  • Separate the web layer (routers) from business logic (services) so handlers stay thin.

Dependencies

  • Use Depends() for shared concerns: database sessions, the current user, settings. Don't reach for globals.
  • Build a single settings object with pydantic-settings and inject it, rather than reading os.environ throughout the code.

Async

  • If a handler does I/O, make it async and use async clients. Never call a blocking library inside an async handler — offload it with run_in_threadpool.
  • Open and close resources (DB sessions, HTTP clients) with dependencies or lifespan handlers, not per-request globals.

Errors & validation

  • Raise HTTPException with a precise status code; let Pydantic return 422 for bad input automatically.
  • Return explicit response models so the OpenAPI schema stays accurate.
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. 3d ago First seen · 33 lines · 26 tokens per session scan A aaa7ba0f13cc

Subscribe to this mod's changes

fastapi-conventions is a skill published in the GitHub repository Cypsy1714/cchad (1 stars, last pushed 2mo ago), licensed MIT. It adds 26 tokens to every session and 292 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.

Related

Other skills, from other repositories

docs

Access and update the user's Docs vaults. Use whenever the user asks to read, find, create, update, or store a note, document, plan, or HTML artifact; when a Docs @-mention appears in context; or when an answer should link to a document the user can open in Docs.

get-bb/bb · 64 tokens

bb-cli

Use this when controlling bb. The bb CLI inspects and manages threads, environments, projects, machines, providers, skills, plugins, settings, terminals, and other BB services.

get-bb/bb · 39 tokens

memory

Use durable BB memory when prior project knowledge or cross-project user preferences can improve the current task, and save durable new learning through the bb memory CLI.

get-bb/bb · 32 tokens

workflows

Execute a workflow script that orchestrates multiple subagents deterministically. Use when the user explicitly requests a workflow, multi-agent orchestration, parallel or sequential agent pipelines, structured agent outputs, or a durable background workflow run.

get-bb/bb · 47 tokens

regex-mastery

Use this skill when writing regular expressions, debugging pattern matching,optimizing regex performance, or implementing text validation. Triggers on regex, regular expressions, pattern matching, lookahead, lookbehind, named groups, capture groups, backreferences, and any task requiring text pattern matching.

alibaba/anolisa · 60 tokens

devtools-event-client

Create typed EventClient for a library. Define event maps with typed payloads, pluginId auto-prepend namespacing, emit()/on()/onAll()/onAllPluginEvents() API. Connection lifecycle (5 retries, 300ms), event queuing, enabled/disabled state, SSR fallbacks, singleton pattern. Unique pluginId requirement to avoid event…

TanStack/devtools · 79 tokens