CLAUDE.mdis where you write down your commands, conventions, and constraints once so you stop repeating them in every chat. Here’s exactly what it is, where it lives, how the memory hierarchy merges, and how it compares to skills and AGENTS.md.June 25, 2026 · 11 min read · by Harish Ganapathi
CLAUDE.mdis where you write down your commands, conventions, and constraints once so you stop repeating them in every chat. Here’s exactly what it is, where it lives, how the memory hierarchy merges, and how it compares to skills and AGENTS.md.A CLAUDE.mdfile is Claude Code’s project memory file: a Markdown file whose contents are loaded into the model’s context automatically at the start of every session. Instead of re-explaining how to build the project or which conventions to follow, you write those instructions in CLAUDE.mdonce and Claude Code reads them every time. Because it’s always on, it’s also a recurring token cost — which is why the golden rule is to keep it tight and high-signal.
Key takeaways
CLAUDE.md is Claude Code’s project memory— auto-loaded into context at the start of every session./init, append quick notes with the # shortcut, and pull in other files with @imports.CLAUDE.md is always-on facts; skills are on-demand procedures. Claude Code reads CLAUDE.md, not AGENTS.md, natively.Think of CLAUDE.md as a README written for the agent rather than for a human contributor. A human-facing README explains the project to a person browsing GitHub; CLAUDE.mdtells Claude Code the operational details it needs to work effectively — the exact commands, the conventions, the architecture, and the boundaries. The key difference from a README is whenit’s used: Claude Code injects CLAUDE.mdinto context at the start of each session without you asking, so it’s always present in the model’s working memory.
That always-on behavior is the whole point, and also the constraint. It means a fact you put in CLAUDE.md never has to be rediscovered, but it also means every line is paid for in tokens on every request. A tight, bulleted CLAUDE.md beats a long one that buries the important rules in prose.
Claude Code doesn’t read a single CLAUDE.md— it reads several, from different scopes, and merges them. The further down (more specific) a file is, the higher its precedence when instructions overlap. Here’s the full hierarchy:
More specific scopes win.
| Scope | File path | Shared with team? | Notes |
|---|---|---|---|
| Enterprise / managed | Managed policy file | Org-wide | Set by an admin; applies across the organization |
| Project | ./CLAUDE.md (repo root) | Yes — checked in | The main shared file; lives in git with the code |
| Project (subdir) | <subdir>/CLAUDE.md | Yes — checked in | Loaded only when you work inside that subtree |
| User | ~/.claude/CLAUDE.md | No — personal | Applies to all your projects on this machine |
| Local | CLAUDE.local.md | No — gitignored | Personal per-project overrides; now de-emphasized for imports |
The subdirectory files are what make this powerful in a monorepo: a CLAUDE.mddeep in a package only enters context when you’re editing files in that package, so its rules don’t cost you anything — or muddy the agent’s focus — when you’re working elsewhere.
Where Claude Code looks for CLAUDE.md files.
You don’t have to start from a blank file. The fastest way is the /initcommand: run it inside a project and Claude Code scans the repository — package files, directory structure, existing config — and drafts a starter CLAUDE.md capturing what it found. Treat that draft as a first pass, then prune and sharpen it.
For quick, in-the-moment additions there’s the # shortcut. Start a message with # during a session and Claude Code appends that line to your CLAUDE.mdas a memory — handy for capturing a convention the instant you notice the agent getting it wrong, without breaking flow to open the file.
Run /init inside the project
Claude Code drafts a starter CLAUDE.md
Prune and sharpen it
Append memories with the # shortcut
# during a session and Claude Code appends that line to CLAUDE.md.A CLAUDE.md file can pull in other files with an @ reference. Writing @README.md or @docs/architecture.mdon its own line tells Claude Code to expand that file’s contents inline. Imports resolve recursively— an imported file can import others, up to roughly five hops — so you can compose your context from focused pieces instead of one sprawling file.
This is the modern replacement for copy-pasting. Rather than duplicating your architecture notes into CLAUDE.mdand watching the two drift, you keep one canonical doc and import it. It’s also the idiomatic way to reuse an existing AGENTS.md— more on that below.
# CLAUDE.md
## Commands
- Install: `pnpm install`
- Dev: `pnpm dev`
- Test: `pnpm test` (must pass before any commit)
- Lint + types: `pnpm lint && pnpm typecheck`
## Conventions
- TypeScript strict mode; named exports only
- Files under 800 lines, functions under 50
- Tailwind 4 syntax: `(--var)` parens, not `[var(--var)]`
## Architecture
@docs/architecture.md
## Don't
- Don't add a dependency without flagging it first
- Don't edit generated files under `/dist`Because every line is loaded on every session, the goal is maximum signal per token. The content that earns its place:
@-imported from a canonical doc.What notto do: don’t paste your entire docs site, your changelog, or long design rationale. CLAUDE.md is a cheat sheet, not a knowledge base. If a body of guidance is long and only relevant to specific tasks, it belongs in a skill, not in always-on memory.
Keep it current
A stale CLAUDE.mdis worse than none — it actively misleads the agent on every session while you pay tokens for the wrong instructions. Prune it whenever your commands or conventions change.
The cleanest way to decide where something goes is the facts-versus- procedures test. CLAUDE.md holds always-on facts — the constraints and conventions Claude should never forget, loaded every session. Skills hold on-demand procedures— task-specific playbooks that load only when they’re relevant, so a twelve-step deployment runbook doesn’t cost you context when you’re writing a unit test.
Put another way: if it’s a rule that applies to all work in the repo, it goes in CLAUDE.md; if it’s a recipe for a particular kind of task, it’s a skill. For the full mental model and how skills are structured, see the guide to Claude Code skills.
AGENTS.mdis the portable, cross-tool standard — a plain-Markdown file read by Codex, Cursor, Copilot, Gemini, and dozens of other agents. CLAUDE.md is Claude-Code-only, but it trades portability for power: @imports, CLAUDE.local.md overrides, and the hierarchical memory described above.
The catch worth knowing: Claude Code does not read AGENTS.md natively (as of mid-2026). A repo with only an AGENTS.mdloads zero project instructions in Claude Code — silently, with no error. If your team has standardized on AGENTS.md, the two clean workarounds are a thin CLAUDE.md that does @AGENTS.md (Claude Code expands the import) or a symlink, ln -s AGENTS.md CLAUDE.md. This is fast-moving, so confirm against the current docs.
| Format | Portability | Extra power |
|---|---|---|
CLAUDE.md | Claude Code only | @imports, CLAUDE.local.md, hierarchical memory |
AGENTS.md | Read by 24+ tools | None — plain Markdown by design |
For the deeper dive on the open standard, read the AGENTS.md standard explained, and for the full five-way comparison across every rules file, see SKILL.md vs CLAUDE.md vs .cursorrules vs AGENTS.md. Migrating from another tool? Here’s how to convert a .cursorrules file to CLAUDE.md.
One CLAUDE.md per repo is easy. The pain starts when you have ten repos that all share the same conventions, plus a CLAUDE.md for Claude Code, a .cursorrules for Cursor, and an AGENTS.mdfor everything else — all encoding the same rules, all drifting out of sync. The @import trick solves this withina single repo; it doesn’t help you keep the same standards consistent across projects and tools.
That’s the problem Skillwright exists to solve: keep your rules and skills in one canonical library, treat CLAUDE.mdas a first-class output, and compile to each tool’s format — Claude Code’s CLAUDE.md, Cursor’s .mdc, and AGENTS.md— so nothing drifts. Start from a vetted base with the templates, then read how to manage AI coding rules across tools to see the workflow end to end.
A CLAUDE.md file is Claude Code's project memory file — a Markdown file whose instructions are loaded into context automatically at the start of every session. You use it to tell Claude Code your build and test commands, code conventions, architecture notes, and the things it should never do, so you don't have to repeat them in every chat.
The most common spot is the root of your repository (./CLAUDE.md), where it's checked into git and shared with your team. Claude Code also reads a personal CLAUDE.md in your home directory (~/.claude/CLAUDE.md) that applies to all your projects, plus any CLAUDE.md files in subdirectories, which load only when you're working in that part of the tree.
Run the /init command inside a project and Claude Code scans the repo and drafts a starter CLAUDE.md for you. From there you edit it like any Markdown file. During a session you can also type a line beginning with # and Claude Code appends it to CLAUDE.md as a quick memory.
Keep it tight: the exact setup, build, and test commands; code conventions stated as rules; a short architecture map; and an explicit list of don'ts. Prefer bullets over prose. Because CLAUDE.md is loaded into context on every session, every line costs tokens — it should be a high-signal cheat sheet, not exhaustive documentation.
Not natively as of mid-2026 — Claude Code reads CLAUDE.md, not AGENTS.md. If your repo standardizes on AGENTS.md, the common workarounds are a thin CLAUDE.md that pulls it in with @AGENTS.md, or a symlink (ln -s AGENTS.md CLAUDE.md). This is a fast-moving area, so check the current Claude Code docs.
CLAUDE.md holds always-on facts that load every session, so it's best for conventions and constraints Claude should never forget. Skills are on-demand procedures that load only when relevant, so they're better for longer, task-specific playbooks. Use CLAUDE.md for the rules; use skills for the how-to.