CLAUDE.md is the file Claude Code reads as standing instructions — the project's
"house rules." But there isn't one file; there's a hierarchy: user-level, project-level, and
directory-level, each layered on top of the last. Knowing which file wins where is the single most
configuration-heavy thing the exam tests.
Claude Code reads from broad to specific and stacks them. A more specific file doesn't erase the broader ones — it adds to and overrides them for its scope. Click around the tree to see the effective rule set for a file in that location:
| Level | Location | Scope |
|---|---|---|
| User | ~/.claude/CLAUDE.md | Every project on your machine — your personal defaults. |
| Project | <repo>/CLAUDE.md (committed) | The whole repo — shared team conventions. |
| Directory | <repo>/sub/CLAUDE.md | Just that subtree — e.g. backend-only rules. |
| Local / personal | CLAUDE.local.md (git-ignored) | Your private overrides for a repo, not shared. |
Files can also pull in others with @path/to/file imports, so you keep one source of truth
and reference it instead of copy-pasting. The closer a file is to the code being edited, the higher its
precedence.
CLAUDE.md;
put personal tweaks in ~/.claude/CLAUDE.md or CLAUDE.local.md. Mixing these up
(committing personal prefs, or putting team rules only in your user file) is a classic wrong answer.~/.claude) → project (committed) → directory (subtree) → local (git-ignored
personal). More-specific files add to and override broader ones for their scope; they don't wipe the
stack. Use @imports for one source of truth. Shared rules → committed project file; personal rules
→ user/local file.Curated companion: Claude Code — Memory & CLAUDE.md.