What you will be able to do
- Place an instruction at the scope that matches who needs it: just you, the whole team, or one part of the codebase
- Explain why an instruction in ~/.claude/CLAUDE.md never reaches a teammate
- Predict which CLAUDE.md files are loaded at launch and which load later, based on where Claude was started
- Use /memory to see which memory files a session has loaded
- Diagnose a configuration hierarchy issue where a new team member is not receiving instructions that live in user-level rather than project-level configuration
- Use the @import syntax to pull only the standards files relevant to each package into that package's CLAUDE.md
- Split a large CLAUDE.md into focused topic-specific files under .claude/rules/, such as testing.md or security.md
Key concept
Scope decides who gets an instruction — Where a CLAUDE.md file lives decides who receives its instructions and when they load. A file in your home directory reaches only you. A file committed to the repository reaches everyone who clones it. A file in a subdirectory applies only when Claude works in that part of the tree.
1.Where CLAUDE.md files can live
A CLAUDE.md file is a plain markdown briefing that Claude reads automatically. You don't attach it to a prompt. If the file exists in a location Claude checks, the instructions are already in context. There are several such locations, and each one answers a different question: who should this instruction reach?
| Scope | Location | Shared with |
|---|---|---|
| Managed policy | /Library/Application Support/ClaudeCode/CLAUDE.md (macOS), /etc/claude-code/CLAUDE.md (Linux and WSL) | All users in organization |
| User instructions | ~/.claude/CLAUDE.md | Just you (all projects) |
| Project instructions | ./CLAUDE.md or ./.claude/CLAUDE.md | Team members via source control |
| Local instructions | ./CLAUDE.local.md | Just you (current project) |
The project file is the one most teams need. It holds the architecture, conventions, and build and test commands that everyone working on the repository should follow. The support guidance says it plainly: most teams only need the project-root file, committed to git. The other scopes cover exceptions. The user file holds personal habits that follow you across projects. The local file holds personal settings for one project, such as your sandbox URLs, and should be gitignored. The managed file is for organisation-wide policy that IT deploys.
2.User-level instructions stay on your machine
~/.claude/CLAUDE.md sits in your home directory, not in any repository, so version control never sees it. That's why it suits preferences like "I use pnpm, not npm". It's also why it's the wrong place for anything the team depends on. The file applies to every project you open, but only for you.
The rules were written to the senior engineer's user-level file, ~/.claude/CLAUDE.md, which applies only to that engineer. The new hire's clone contains only what's in version control. The fix is to move the team conventions into the project CLAUDE.md at the repository root (or .claude/CLAUDE.md) and commit it. Genuinely personal preferences can stay in the user file.
That scenario is the standard shape of a configuration hierarchy issue, and diagnosing it follows a fixed routine. When a new team member is not receiving instructions that work for everyone else, first ask which scope the instruction lives in. An instruction in user-level configuration (~/.claude/CLAUDE.md) or in a gitignored ./CLAUDE.local.md never travels with the clone. An instruction in project-level configuration (./CLAUDE.md or ./.claude/CLAUDE.md) does. Run /memory on both machines: it lists the memory file locations across user and project scopes, so you can see at once that the rule appears under the senior engineer's user scope and under no project scope at all. The docs' own signal for what belongs in the project file is the same one: if a new teammate would need the same context to be productive, it belongs in the shared file, not in a personal one.
The same reasoning works in reverse. If you want personal editor or formatting preferences to apply to every project on your machine without committing them anywhere, the user-level file is the right place. If a personal preference applies to only one project, ./CLAUDE.local.md keeps it out of the shared file, as long as you add it to .gitignore. Auto memory is separate again. It lives under ~/.claude/projects/<project>/memory/ and holds notes Claude writes for itself, while the CLAUDE.md files are the ones you maintain by hand.
Two engineers on the same team report that Claude behaves inconsistently: one gets careful adherence to a 'always run the linter before committing' rule, while the other says Claude never mentions the linter at all, even in the same repository on the same branch. Before assuming the rule text is unclear, what is the fastest way to confirm whether the inconsistency is actually a memory-loading problem?
Correct answer: A — Have each engineer run `/memory` and compare which CLAUDE.md, CLAUDE.local.md, and rules files are loaded to see if the linter rule is missing
- A. Correct. `/memory` lists exactly which CLAUDE.md, CLAUDE.local.md, and rules files are loaded in the current session; if the linter instruction is missing from one engineer's list, that immediately isolates the problem to a loading/scoping issue rather than instruction wording.
- B. Stale git objects do not affect which memory files Claude Code discovers and loads, and re-cloning is a disruptive step with no diagnostic value here.
- C. CLAUDE.md files are read fresh at the start of each session; no OS reboot is required or relevant to whether an instruction is loaded.
- D. Version mismatches could cause differences, but comparing versions doesn't reveal what's actually loaded, and instruction-following isn't gated by a required version match for diagnosis.
3.Directory-level files load when Claude works there
CLAUDE.md files can also sit in subdirectories, such as frontend/CLAUDE.md or packages/api/CLAUDE.md, to hold conventions for one module. When they load depends on where you started Claude. Files at and above the working directory are read at session start. A file in a subdirectory below the working directory isn't read at start. It loads when Claude reads files in that subdirectory.
| Start from | File access | CLAUDE.md loaded at launch | Use when |
|---|---|---|---|
| Repository root | Every file | Root only; subdirectory files load on demand when Claude reads there | Tasks span multiple packages or subsystems |
| A subdirectory | That subtree only, until you grant more | That directory’s plus every ancestor’s | Work is scoped to one package or subsystem |
The recommended split follows from this. The root CLAUDE.md holds rules that apply everywhere, such as coding standards and commit conventions. Each subdirectory file holds conventions for that area's stack. In a monorepo that means one file per package. In a large single tree it means one per subsystem, such as src/db/ or src/api/. Because subdirectory files load on demand, someone working only in the API package doesn't carry the frontend's rules in context.
Per-package files don't have to repeat shared material, because a CLAUDE.md can reference external files with the @import syntax. Writing @ followed by a path inside the file pulls that file's content in when the CLAUDE.md loads. The docs' example reads "See @README for project overview and @package.json for available npm commands for this project." A bullet such as "git workflow @docs/git-instructions.md" imports a standards document, and a home-directory path such as @~/.claude/my-project-instructions.md imports a personal file. This keeps CLAUDE.md modular: the standards live once, in their own files, and each CLAUDE.md just lists which ones apply.
In a monorepo, that lets you use @import selectively. Keep the shared standards as separate files, say docs/api-conventions.md, docs/testing.md and docs/deployment.md, and let each package's CLAUDE.md import only the ones relevant to that package. Which standards those are is domain knowledge the package's maintainers hold: the API package's maintainers know it needs the API conventions and the deployment standards, while the shared library's maintainers know it needs only the testing standards. The same mechanism is how an existing AGENTS.md is folded in: when a CLAUDE.md already imports AGENTS.md, Claude reads the CLAUDE.md with AGENTS.md included through the import.
4.Splitting a monolithic CLAUDE.md into .claude/rules/
Imports are one way to keep CLAUDE.md modular. The other is the .claude/rules/ directory, an alternative to a monolithic CLAUDE.md that keeps everything in one central place. Instead of one large file covering testing, API conventions and deployment at once, you split it into focused topic-specific rule files, one markdown file per topic, and Claude loads them alongside the project CLAUDE.md. Like CLAUDE.md, rules files are committed to the repository, so the whole team receives them.
| File | Purpose |
|---|---|
| .claude/CLAUDE.md | Main project instructions |
| .claude/rules/code-style.md | Code style guidelines |
| .claude/rules/testing.md | Testing conventions |
| .claude/rules/security.md | Security requirements |
A rules file can also be path-gated. Its only frontmatter field is paths, an optional list of glob patterns such as src/api/**/*.ts. When paths is set, the rule loads only when Claude works with a file that matches, so an API rule file doesn't sit in context while Claude edits the frontend. Without paths, the rule loads like any other project instruction. The same directory exists at user scope as ~/.claude/rules/, for personal rule files that stay on your machine, and a shared standards file can be symlinked into .claude/rules/ rather than copied.
| Approach | File location | Loads when | Use when |
|---|---|---|---|
| Per-directory CLAUDE.md | Inside the directory, alongside its code | At launch when started from that directory, or on demand when Claude reads a file there | Directory owners maintain their own conventions; instructions are versioned with the code |
| Path-scoped rule in .claude/rules/ | Central .claude/ at the repo root | When Claude works with a file matching the rule’s paths: glob | You want all conventions in one place, or the same rule applies to many scattered paths |
5.How the levels combine, and checking them with /memory
The levels don't replace each other. Every CLAUDE.md that loads adds its content to the same context. A subdirectory file doesn't override the root file, and a project file doesn't cancel your user file. When two instructions conflict, Claude uses its judgement to reconcile them. There's no strict precedence rule. So the fix for a contradiction is to remove it, not to count on one file winning.
When Claude behaves differently from one session to the next, or from one teammate to another, start by checking which files were actually loaded. The /memory command lists memory file locations across user and project scopes and lets you open each one in your editor. That's usually enough to show a missing project file, a rule that exists only in someone's user file, or a stale instruction.
Timing is the other common cause. CLAUDE.md is read when the session starts and isn't re-read from disk on every turn. An edit made mid-session is picked up the next time you run /compact or open the file through /memory. Otherwise it takes effect in your next session. So if you just added a rule and Claude doesn't seem to follow it yet, the session may still be using the older version.
Exam traps
Each one states something that sounds right. Open it to see what is actually true.
1.Rules in ~/.claude/CLAUDE.md reach every developer who works on the repository.Why is that wrong?
The user-level file applies only to the person whose home directory it's in. Only the project CLAUDE.md is shared with teammates through source control.
Covered in User-level instructions stay on your machine
2.Every subdirectory CLAUDE.md in the repository is loaded when a session starts at the root.Why is that wrong?
Only files at and above the working directory load at launch. A subdirectory file below it loads later, when Claude reads files in that subdirectory.
Covered in Directory-level files load when Claude works there
3.A file in .claude/rules/ only loads if its frontmatter declares a paths glob.Why is that wrong?
paths is optional. It narrows a rule to matching files when present; a rule file without it still loads as a topic-scoped instruction alongside CLAUDE.md.
Covered in Splitting a monolithic CLAUDE.md into .claude/rules/
4.A more specific CLAUDE.md replaces the instructions from the levels above it.Why is that wrong?
CLAUDE.md files are additive: every level contributes to context at the same time, and Claude uses judgement to reconcile conflicts.
Covered in How the levels combine, and checking them with /memory
Sources
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.https://code.claude.com/docs/en/memoryOfficial docs
“Team members via source control”
↩︎ Where CLAUDE.md files can live“Just you (all projects)”
↩︎ User-level instructions stay on your machine“Personal project-specific preferences; add to .gitignore”
↩︎ User-level instructions stay on your machine“A new teammate would need the same context to be productive”
↩︎ User-level instructions stay on your machine“See @README for project overview and @package.json for available npm commands for this project.”
↩︎ Directory-level files load when Claude works there“git workflow @docs/git-instructions.md”
↩︎ Directory-level files load when Claude works there“Your CLAUDE.md, with AGENTS.md included through the import”
↩︎ Directory-level files load when Claude works there“Scope rules to specific file types with .claude/rules/”
↩︎ Splitting a monolithic CLAUDE.md into .claude/rules/“Glob patterns that scope the rule to matching files. Accepts a YAML list or a comma-separated string”
↩︎ Splitting a monolithic CLAUDE.md into .claude/rules/“Team-shared instructions for the project”
↩︎ Key concept“Personal preferences for all projects”
↩︎ Exam trap 1“Glob patterns that scope the rule to matching files. Accepts a YAML list or a comma-separated string”
↩︎ Exam trap 3 - 2.https://support.claude.com/en/articles/14553240-give-claude-context-claude-md-and-better-promptsOfficial docs
“Most teams only need the project-root file. Commit it to git so the whole team benefits.”
↩︎ Where CLAUDE.md files can live“Subdirectory CLAUDE.md files are loaded on demand later, when Claude reads files in that subdirectory.”
↩︎ Directory-level files load when Claude works there“If you edit the file mid-session, the change is picked up the next time you run /compact or open it via /memory”
↩︎ How the levels combine, and checking them with /memory“Subdirectory CLAUDE.md files are loaded on demand later, when Claude reads files in that subdirectory.”
↩︎ Exam trap 2 - 3.https://code.claude.com/docs/en/debug-your-configOfficial docs
“Memory file locations across user and project scopes with the option to open each in your editor”
↩︎ User-level instructions stay on your machine“Memory file locations across user and project scopes with the option to open each in your editor”
↩︎ How the levels combine, and checking them with /memory - 4.
“This is separate from your user-level ~/.claude/CLAUDE.md and project-level ./CLAUDE.md files, which you maintain by hand.”
↩︎ User-level instructions stay on your machine - 5.https://code.claude.com/docs/en/large-codebasesOfficial docs
“Root CLAUDE.md: instructions that apply everywhere, such as coding standards and commit conventions”
↩︎ Directory-level files load when Claude works there“You want all conventions in one place, or the same rule applies to many scattered paths”
↩︎ Splitting a monolithic CLAUDE.md into .claude/rules/ - 6.https://code.claude.com/docs/en/claude-directoryOfficial docs
“Topic-scoped instructions, optionally path-gated”
↩︎ Splitting a monolithic CLAUDE.md into .claude/rules/ - 7.https://code.claude.com/docs/en/features-overviewOfficial docs
“When instructions conflict, Claude uses judgment to reconcile them.”
↩︎ How the levels combine, and checking them with /memory“CLAUDE.md files are additive: all levels contribute content to Claude’s context simultaneously.”
↩︎ Exam trap 4