Skip to content

Free template · Claude Code + Codex

A CLAUDE.md for long agent runs.

Plan first, exact test commands, a clear “done”, and guardrails. Copy it, fill in the brackets, and let the agent run.

Free · no account · checked 20 October 2026

The template

Replace everything in <angle brackets> with your own project, and delete lines that don’t apply. Save it as CLAUDE.md in the root of your repo.

# CLAUDE.md

## Project
- What it is: <one sentence>
- Stack: <language, framework, package manager>
- Where things live: `src/` <...>, `tests/` <...>

## Commands
- Install: `<npm ci>`
- All tests: `<npm test>`
- One test file: `<npm test -- path/to/file>`
- Lint and typecheck: `<npm run lint>` and `<npm run typecheck>`
- Build: `<npm run build>`

## Long tasks: plan first
1. Before changing code, write the plan to `PLAN.md`: the goal, the files you expect to touch, the steps, and how you will check each step. Then start.
2. Work one step at a time. After each step, run the tests for what you changed and tick the step in `PLAN.md`.
3. Append one line per finished step to `PROGRESS.md`: what changed and the test result.
4. After a compaction or a new session, read `PLAN.md` and `PROGRESS.md` before doing anything else.
5. Commit after each green step: `<type>: <what changed>`. Never amend or rewrite earlier commits.
6. If the same test fails twice for the same reason, stop. Write what you tried in `PROGRESS.md` and wait for me.
7. If the task turns out bigger than the plan, update `PLAN.md` first.

## Done means
- `<npm test>` passes, lint and typecheck are clean.
- New behavior has a test.
- `PROGRESS.md` ends with three lines: what changed, what I should check, what is left.

## Guardrails
- Don't push, deploy, publish or merge. I do that.
- Don't read, print or edit `.env` files, keys or credentials.
- Don't run `rm -rf`, `git reset --hard`, `git clean` or `git push --force`.
- Don't add a dependency without writing why in `PLAN.md`.
- Don't run migrations or touch production data.
- Don't change a test to make it pass unless the test is wrong. If it is, say so in `PROGRESS.md`.
- Ask before anything you can't undo.

## Code style
- <e.g. 2-space indentation, named exports, no default exports>
- Follow the patterns in nearby files before adding new ones.

## Compact instructions
When you compact, keep the current step of `PLAN.md`, the latest failing test output and the list of files changed so far.

Why each part is there

Rules that make it work

Where it goes

sources

Checked against these official pages on 20 October 2026. Plans and limits change; if a page here disagrees with them, the official page wins.

  1. How Claude remembers your project (CLAUDE.md) · Claude Code docs
  2. Manage costs effectively · Claude Code docs
  3. AGENTS.md · Codex docs