python-samples-fastapi-restful: Instructions file for Claude Code

CLAUDE.md

python-samples-fastapi-restful CLAUDE.md is an instructions file for Claude Code from nanotaboada/python-samples-fastapi-restful. It costs 1,777 tokens per session, scanned A, original, MIT.

Repository instructions for a Python web service built with FastAPI, a framework for creating web APIs, and related tools for databases, validation, testing, and deployment.

In plain words
What is it for?
Use them when adding or changing API routes, business logic, database models and migrations, validation, caching, tests, linting, or Docker setup.
Why use it?
They give coding agents the project's technical rules and checks, reducing the chance of changes that break its API, database, tests, or formatting.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: reads .claude/ paths; mentions CLAUDE.md; mentions Claude Code.

This is nanotaboada/python-samples-fastapi-restful's own configuration. It tells Claude Code how to work on python-samples-fastapi-restful itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything python-samples-fastapi-restful configures →

Reuse

Borrowing it

Nothing to install: this file belongs to nanotaboada/python-samples-fastapi-restful. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/nanotaboada/python-samples-fastapi-restful/master/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/nanotaboada/python-samples-fastapi-restful

Made for: Claude Code.

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 python-samples-fastapi-restful CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/nanotaboada/python-samples-fastapi-restful/claude-md/github.svg)](https://agentmods.dev/instructions/nanotaboada/python-samples-fastapi-restful/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/nanotaboada/python-samples-fastapi-restful/claude-md"><img src="https://agentmods.dev/badge/instructions/nanotaboada/python-samples-fastapi-restful/claude-md/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 python-samples-fastapi-restful CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/nanotaboada/python-samples-fastapi-restful/claude-md"><img src="https://agentmods.dev/badge/instructions/nanotaboada/python-samples-fastapi-restful/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,777 This file is loaded in full into every session.
When invoked 1,777 The same file — it is already loaded in full.
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.01777 $0.01777
Opus 5.5 $0.00711 $0.00711
Sonnet 5.5 $0.00355 $0.00355
Haiku 4.5 $0.00178 $0.00178

Measured 24d ago against content hash 2999cdfdcb6d, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

python-samples-fastapi-restful CLAUDE.md 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 24d 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.

CLAUDE.md · 166 lines

How it starts

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

CLAUDE.md

Claude Code

  • Run /pre-commit to execute the full pre-commit checklist for this project.
  • Run /pre-release before tagging a release.
  • See .claude/skills/create-issue/SKILL.md for the SDD issue workflow, and .claude/skills/add-endpoint/SKILL.md for the endpoint/schema workflows.

Structure

Layer rule: Routes → Services → SQLAlchemy → SQLite. Routes handle HTTP concerns only; business logic belongs in services. Never skip a layer. tools/ is legacy (superseded by Alembic migrations); gunicorn.conf.py is used by the Docker entrypoint.

Coding Guidelines

  • Naming: snake_case (files, functions, variables), PascalCase (classes)
  • Type hints: Required everywhere — functions, variables, return types
  • Async: All routes and service functions must be async def; use AsyncSession (never Session); use aiosqlite (never sqlite3); use SQLAlchemy 2.0 select() (never session.query())
  • API contract: camelCase JSON via Pydantic alias_generator=to_camel; Python internals stay snake_case
  • Models: PlayerRequestModel (no id, used for POST/PUT) and PlayerResponseModel (includes id: UUID, used for GET/POST responses). One request model intentionally covers both POST and PUT — per-operation differences (conflict check on POST, mismatch guard on PUT) are handled at the route layer, not by duplicating the model. Never reintroduce the removed PlayerModel; it was removed because a single flat model conflated ORM, request, and response concerns.
  • Primary key: UUID surrogate key (id) — opaque, internal, used for GET by id only. UUID v4 for API-created records; UUID v5 (deterministic) for migration-seeded records. squad_number is the natural key — human-readable, domain-meaningful, used for all mutation endpoints (PUT, DELETE) and preferred for all external consumers
  • Caching: cache key "players" (hardcoded); clear on POST/PUT/DELETE; X-Cache header (HIT/MISS)
  • Errors: Catch specific exceptions with rollback in services; Pydantic validation returns 422 (not 400); squad number mismatch on PUT returns 400 (not 422 — it is a semantic error, not a validation failure)
  • Logging: logging module only; never print()
  • Tests: integration tests against the real SQLite DB (seeded via Alembic migrations) via TestClient — no mocking. Naming pattern test_request_{method}_{resource}_{context}_response_{outcome}; docstrings single-line, concise; tests/player_fake.py for test data; tests/conftest.py provides a function-scoped client fixture for isolation; tests/test_main.py excluded from Black; tests/test_migrations.py covers Alembic downgrade paths
  • Decisions: justify every decision on its own technical merits; never use "another project does it this way" as a reason — that explains nothing and may mean replicating a mistake
  • Avoid: sync DB access, mixing sync/async, print(), missing type hints, unhandled exceptions

Read the full file on GitHub · 166 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. 24d ago Changed · -61 lines · -682 tokens per session 2999cdfdcb6d
  2. 2mo ago First seen · 227 lines · 2,459 tokens per session scan A 06cec1727910

Subscribe to this mod's changes

python-samples-fastapi-restful CLAUDE.md is an instructions file published in the GitHub repository nanotaboada/python-samples-fastapi-restful (141 stars, last pushed 4d ago), licensed MIT. It adds 1,777 tokens to every session, about $0.0071 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-30.

Related

python-samples-fastapi-restful CLAUDE.md compared with instructions from other repositories

python-samples-fastapi-restful CLAUDE.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
python-samples-fastapi-restful CLAUDE.mdnanotaboada/python-samples-fastapi-restfulInstructions file1414d agoMITA1,777Claude Code
graftcode graftcode-python.instructions.mdgrft-dev/graftcodeInstructions file9671mo agononeA4,639GitHub Copilot
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143ktodayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149kyesterdayMITA4,680Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA5,516GitHub Copilot
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA3,093GitHub Copilot