# CLAUDE.md

> Canonical: https://skillalmanac.com/glossary/claude-md | Last verified: 2026-11-24 | Index status: not offered to search engines

CLAUDE.md is a Markdown file of persistent instructions that Anthropic's Claude Code reads at the start of every session, such as build commands, conventions and project layout. Claude treats it as context, not enforced configuration.

Also called: claude md, claude md file, claude.md file.

## In plain language

CLAUDE.md is a plain text note you leave in your project for Claude Code, Anthropic's coding tool. It might say how to run the tests and which style to follow. Claude Code starts each session with no memory of the last one, so it reads this note first instead of you retyping the rules. Think of the sheet of house rules you would give a new colleague on day one. The limit is that Claude reads the note as guidance, not as a lock: Anthropic's documentation says the file is context, not enforced configuration, and that shorter, more specific instructions are followed more consistently. A rule that must hold every time belongs somewhere that can enforce it.

## Technical definition

Claude Code loads CLAUDE.md and CLAUDE.local.md files from the working directory and every directory above it, concatenates them into context ordered from the filesystem root down, and loads files in subdirectories on demand once Claude touches a file there. Other scopes are ~/.claude/CLAUDE.md for personal rules and a managed file for an organisation. The @path syntax imports other files, and .claude/rules/ holds topic files that can be scoped to file paths. The memory documentation says to target under 200 lines per file, and that /init generates a starting file. Because the text is only context, a rule with no exceptions belongs in a hook or permission setting.

## How it shows up when you use agents

CLAUDE.md is where a Claude Code project keeps the facts the agent cannot read from the code: how to build, how to test, which conventions apply. Claude Code loads it into context at launch, so every line costs some of the [context window](/glossary/context-window) on every task. The file is one kind of [agent instruction file](/glossary/agent-instruction-file), and its text sits alongside the [system prompt](/glossary/system-prompt) the model already has.

What breaks when it is misunderstood:

- **Long files.** The Claude Code docs say longer files consume more context and reduce adherence, and suggest moving task-specific procedures to a skill or a path-scoped rule. An [agent skill](/glossary/agent-skill) loads when needed.
- **Hard rules.** A line such as "never touch the migrations folder" is still only context. The docs say rules that cannot have exceptions belong in a hook, so see [agent hooks](/glossary/agent-hooks).
- **Wrong scope.** Personal preferences go in CLAUDE.local.md or the home-directory file, not the shared project file.

A sensible next step: run `/init` in a repository, cut the draft to what the code does not already show, then use `/context all` to verify which files loaded at launch and `/memory` to open and edit them, per the memory docs. If your team also uses [AGENTS.md](/glossary/agents-md), the [CLAUDE.md vs AGENTS.md](/learn/agents-md-vs-claude-md) guide shows how to share one file.

## Common confusions

- **CLAUDE.md versus auto memory.** You write CLAUDE.md. Auto memory is notes Claude writes itself from your corrections. Both load at the start of a session.
- **CLAUDE.md versus a skill.** CLAUDE.md loads every session. A skill loads when invoked or judged relevant, so long procedures suit it better.
- **CLAUDE.md versus AGENTS.md.** CLAUDE.md is Claude Code's file. AGENTS.md is an open format other agents read. By default Claude Code reads AGENTS.md only when no CLAUDE.md applies.
- **Myth: a CLAUDE.md rule is a guarantee.** The documentation calls the file context, not enforced configuration. Use a hook or permission rule to block an action.

## Worked examples in this catalogue

### [CLAUDE.md examples: four stack templates, rules, imports](https://skillalmanac.com/learn/claude-md-examples)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: Complete CLAUDE.md examples for TypeScript, Python, Go and monorepo projects, plus .claude/rules, @imports and AGENTS.md, checked against the Claude Code docs.

Why it exercises the concept: It shows what a working file looks like in several stacks, so the definition above becomes a concrete file you can copy and trim.

### [CLAUDE.md vs AGENTS.md: Which Agents Read Which File](https://skillalmanac.com/learn/agents-md-vs-claude-md)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: A comparison of which coding agents read each file, how Claude Code and Codex load them, and how to keep one source of truth.

Why it exercises the concept: It covers the most common practical question about CLAUDE.md: what to do when a repository also uses AGENTS.md.

### [agent-instruction-files](https://skillalmanac.com/skills/skill-almanac/agent-instruction-files)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: Instruction files where every line is project-specific, verified against the repo, and worth loading on every session.

Why it exercises the concept: It applies the size and specificity advice from the Claude Code docs to the file you actually write.

### [Claude Code](https://skillalmanac.com/tools/claude-code)

```
/init
```

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: Per the Claude Code docs, Claude analyses the codebase and creates a starting CLAUDE.md with build commands, test instructions and conventions it finds. If one exists, /init suggests improvements instead of overwriting it.

Why it exercises the concept: Claude Code is the tool that reads the file, and /init is the documented way to create the first draft.

## Related terms

- [Agent instruction file](https://skillalmanac.com/glossary/agent-instruction-file.md)
- [AGENTS.md](https://skillalmanac.com/glossary/agents-md.md)
- [System prompt](https://skillalmanac.com/glossary/system-prompt.md)
- [Context window](https://skillalmanac.com/glossary/context-window.md)
- [Agent skill](https://skillalmanac.com/glossary/agent-skill.md)
- [Agent hooks](https://skillalmanac.com/glossary/agent-hooks.md)

## Sources

- [How Claude remembers your project](https://code.claude.com/docs/en/memory), Anthropic (Claude Code Docs) (accessed 2026-11-24)
- [Best practices for Claude Code](https://code.claude.com/docs/en/best-practices), Anthropic (Claude Code Docs) (accessed 2026-11-24)

Definitions are written by Skill Almanac from the sources above and checked against them on 2026-11-24. [Glossary index](https://skillalmanac.com/glossary.md).
