CLAUDE.md and AGENTS.md Template for App Projects
What to put in CLAUDE.md or AGENTS.md for an app repo: product context, rules, commands, done-when checks. A copyable template and how the two differ.
On this page · 7 sections
The short answer#
CLAUDE.md is the project file Claude Code reads automatically; AGENTS.md is an open format read by Codex, Cursor and many other agents. For an app repo, put the same core in either: who the app is for, a link to the spec, hard rules, build and test commands, and done-when checks. Keep it short.
What are CLAUDE.md and AGENTS.md?#
- CLAUDE.md — a Markdown file Claude Code reads automatically at the start of a session: project rules, commands, conventions.
- AGENTS.md — an open Markdown format released by OpenAI in 2025 and now under a Linux Foundation project, read by Codex, Cursor and many other agents.
Same idea, different readers. A common setup: shared rules in AGENTS.md, plus a short CLAUDE.md that references it
and adds Claude-specific notes.
What belongs in the file?#
| Section | Why |
|---|---|
| One-line product | The agent knows who it's building for |
| Links: spec.md, brief.md | Detail lives there, not here |
| Hard rules | Things that must never happen |
| Commands | Build, test, lint, run |
| Done-when | How the agent knows a step is finished |
| Out of scope | Stops feature creep |
A copyable CLAUDE.md template#
# <App name> — <one line: what, for whom>
Spec: spec.md · Brief: brief.md · Evidence: evidence.md
## Rules
- Read spec.md before any change. Build only "MVP screens".
- No accounts, no network calls unless spec.md says so.
- Ask before adding a dependency.
- Never commit secrets.
## Commands
- Build: <command>
- Test: <command>
- Run: <command>
## Done when
- Tests pass and you report the exact commands you ran.
- The step matches spec.md; list any deviation.
## Out of scope (for now)
- Sync, social features, widgets
Where does the product context come from?#
The first line and the spec should come from evidence, not a guess: the keyword people search, the audience, the top
complaint and the gap competitors leave. ShotMatic exports brief.md and spec.md (plus an evidence file) from your niche
research, ready to link from CLAUDE.md or AGENTS.md.
Common mistakes#
- A 500-line rules file nobody updates.
- Product decisions buried in rules instead of the spec.
- Rules that contradict the spec.
- Secrets pasted "just for now".
Generate the brief and spec to link from it — free plan included.
Related: Spec-driven development: write a PRD Claude Code can build from · Claude Code prompts for building an app
Frequently asked questions
Should I use CLAUDE.md or AGENTS.md?
If you use several agents, keep shared rules in AGENTS.md and reference it from CLAUDE.md. Check Anthropic's docs for how Claude Code currently treats AGENTS.md.
How long should CLAUDE.md be?
Short enough to read in a minute. Put product detail in spec.md and link to it.
What should never go in these files?
Secrets, API keys and passwords. The files are committed to your repo and read by tools.