Claude Code Setup Playbook — 1 · CLAUDE.md
CP — 02

Step 1. Write a CLAUDE.md

Why first: it takes an hour and helps every session after that.

Read time2 min
SectionClaude Code Setup Playbook
01 — 1 · claude.md

What to do

Do this:

  1. Run /init to get a draft, or write one by hand.
  2. Add the exact commands for format, lint, type check and test.
  3. Add a short repo map: folder, then purpose.
  4. Add what would surprise a new hire. Forbidden commands, odd conventions, terms the model would guess wrong.
  5. Say which source wins when docs and code disagree.
  6. Keep it under about 200 lines. Every line costs context on every session.
02 — 1 · claude.md

Example

Example. A small, useful CLAUDE.md for a web app:

markdown
# CLAUDE.md

## What this is
Customer billing dashboard. Next.js frontend, Node API, PostgreSQL.

## Commands
- Format:    `npm run format`
- Lint:      `npm run lint`
- Type check: `npm run typecheck`
- Unit tests: `npm test -- <file>`
- Do not run `npm run build` while developing. Use `npm run typecheck`.

## Repo map
- `web/`  React UI
- `api/`  HTTP handlers; thin, no business logic
- `core/` business logic and database access
- `docs/` product behaviour, owned by the product team

## When sources disagree
User instructions, then `docs/`, then code and tests, then comments.
If docs and code differ, say so. Don't quietly pick one.

## Never
- Read or print `.env` files.
- Push, merge or deploy unless asked.
03 — 1 · claude.md

Check it works

Check: open a fresh session and ask "How do I run the tests?" and "Where does business logic live?" Both should be answered without the agent reading any files.

Watch out:

  • Don't paste secrets, tokens or customer data into it.
  • Don't write long architecture essays. If the code shows it, skip it.
  • If your team also uses other agent tools, keep one canonical file and point the others at it.