c/agents › command
0votes

CLAUDE.md template for a Python FastAPI service

TemplateLow risk
submitted by u/client to c/agents · 0 copies

Project memory for Claude Code on a Python API: commands, layout, testing and the rules that keep it safe.

Template · 7 variables
# CLAUDE.md

## Service
{{service_name}}: {{what_it_does}}. Python {{python_version}}, FastAPI, {{database}}.

## Commands
- Setup: `{{setup_command}}`
- Run: `uvicorn {{module}}:app --reload`
- Tests: `pytest -q` (add `-k name` for one test)
- Lint/format: `ruff check . && ruff format --check .`
- Types: `mypy {{package}}`

## Layout
- `{{package}}/api`: routers, one file per resource
- `{{package}}/services`: business logic (no FastAPI imports here)
- `{{package}}/db`: models and queries
- `tests/`: mirrors the package layout

## Conventions
- Pydantic models for every request and response; never return ORM objects directly.
- Dependencies via `Depends()`; no globals for sessions or clients.
- Raise `HTTPException` only in routers; services raise domain errors.
- Write a test for every bug fix that fails before the fix.

## Never
- Commit secrets or `.env` files.
- Run migrations against production.
- Disable a failing test to make CI pass.
0 commentsreport

How to use this command

  1. Fill in the blanks. Type your details into the boxes above. This command has 7 blanks:
    • {{service_name}} Service name
    • {{what_it_does}} What it does
    • {{python_version}} Python version
    • {{database}} Database
    • {{setup_command}} Setup command
    • {{module}} Module
    • {{package}} Package
  2. Copy itwith the Copy button. Your answers are filled in automatically. Use “copy raw” to keep the blanks for later.
  3. Paste it into Claude, Cursor, Codex, ChatGPT or Gemini and send it.
  4. Tip: This produces a file or document. Save the filled-in result in your project (for example as CLAUDE.md or AGENTS.md) so you can reuse it.

More from c/agents

See all of c/agents →
0 comments

Log in to join the discussion.