Skip to content

Glossary · CLAUDE.md

What is a CLAUDE.md file?

A CLAUDE.md file is a plain Markdown file of standing instructions that Claude Code reads at the start of every session. It holds what you would otherwise re-explain: build and test commands, conventions, project layout and "always do X" rules. It usually sits at the root of a repository and is committed so the whole team shares it.

In practice

Anthropic's docs describe CLAUDE.md files as "markdown files that give Claude persistent instructions for a project, your personal workflow, or your entire organization." Each Claude Code session starts with a fresh context window, so the file is how knowledge carries over.

Where it lives sets who it applies to. The project file is ./CLAUDE.md or ./.claude/CLAUDE.md and is shared through source control. ~/.claude/CLAUDE.md holds your personal preferences for every project. ./CLAUDE.local.md holds private preferences for one project and is kept out of git.

Claude Code can also read AGENTS.md, the shared file other coding agents use. Since Claude Code v2.1.277, a repository with only an AGENTS.md works with no CLAUDE.md at all. When both exist, Claude reads the CLAUDE.md, so a CLAUDE.md that needs the shared rules imports them with @AGENTS.md on its first line.

It is context, not enforcement. Anthropic's docs say Claude treats it as context, not enforced configuration, and that specific, concise instructions are followed more consistently. It isn't a spec for one job, and it isn't auto memory, which is the notes Claude writes about itself.

How to start

  1. Run /init in Claude Code to generate a first CLAUDE.md from your codebase.
  2. Cut it to commands, conventions, project layout and things not to touch.
  3. Make each line checkable: "Run npm test before committing", not "Test your changes".
  4. Commit it, so the team shares one file.
  5. Add a line each time Claude repeats a mistake. Delete lines that stop being true.

Common mistakes

  • Letting it grow past a page. Long files cost context and lower how well it is followed.
  • Putting this week's priorities in it. They go stale within days.
  • Keeping separate copies of the same rules for each agent. They drift.

Why it matters for product builders

Without it, you type the same correction every session. With it, a new session starts from the rules you already settled.

Anthropic's docs suggest adding to it when Claude makes the same mistake twice, or when a code review catches something Claude should have known about the codebase. Keep it short: the docs target under 200 lines per file.

What changes in AI-first products

The file is new with coding agents, so there is no older practice to compare it with. It is close to a README written for the agent.

It holds how you work. It does not hold what to build next. That changes every week and belongs in a plan every agent reads. Annsa holds that part: ranked priorities and specs with the evidence and Done When lines, which Claude Code, Cursor, Codex and Grok read over MCP.

See how Annsa does it: The spec →

Questions people ask.

Q1

Do I need a CLAUDE.md if I already have an AGENTS.md?

Not anymore. Claude Code reads AGENTS.md as your project instructions when there is no CLAUDE.md (v2.1.277 or later). Add a CLAUDE.md only for Claude-specific lines, and put @AGENTS.md on its first line so the shared rules still load.
Q2

Where does the CLAUDE.md file go?

For a project, at ./CLAUDE.md or ./.claude/CLAUDE.md, committed so your team shares it. Personal preferences for all projects go in ~/.claude/CLAUDE.md. Private project preferences go in ./CLAUDE.local.md, which you keep out of git.
Q3

What should I put in a CLAUDE.md?

Facts Claude should hold in every session: build and test commands, conventions, project layout and "always do X" rules. Anthropic's docs say a multi-step procedure, or something that matters for one part of the codebase, belongs elsewhere.
Q4

How long should a CLAUDE.md be?

Anthropic's docs target under 200 lines per file. Longer files use more context and reduce how well the instructions are followed.
Q5

Is CLAUDE.md the same as AGENTS.md?

No. CLAUDE.md is the file Claude Code is built around. AGENTS.md is an open format that many coding agents read. A CLAUDE.md can import an AGENTS.md so you keep one set of rules.

Sources

  1. What CLAUDE.md files are, where they live, size guidance and imports.

  2. An agentic coding environment; keep instructions concrete.

Last reviewed 2026-10-21

Put it to work with your agents.

Try Annsa