What you will be able to do
- Place an instruction at the right scope (managed, user, project, local, or subdirectory) by deciding who should receive it
- Name the three levels of the CLAUDE.md configuration hierarchy (user-level, project-level and directory-level) and where each file lives
- Predict which CLAUDE.md files load when a session starts and which load only on demand, then check with /memory
- Work out why a teammate is missing instructions that live in someone's user-level configuration
- Use @path imports so each package's CLAUDE.md pulls in only the standards files that apply to it
- Break a large CLAUDE.md into topic files under .claude/rules/ that still load in every session
Key concept
Instruction scope — Where a CLAUDE.md or rules file lives decides who receives it and when it loads. Files committed to the project reach the whole team. Files under ~/.claude reach only the person whose machine they are on. All loaded levels add their content to the context together.
1.Project scope vs user scope: who receives an instruction
CLAUDE.md is a plain markdown file of standing instructions that Claude reads at the start of every session, so you don't have to repeat build commands, conventions or warnings in each prompt. It can live in several places, and the location decides who gets it. Before you write an instruction, ask who should receive it: you alone, the team, or the whole organization.
| Scope | Location | Shared with | Typical content |
|---|---|---|---|
| Managed policy | /Library/Application Support/ClaudeCode/CLAUDE.md (macOS), /etc/claude-code/CLAUDE.md (Linux and WSL), C:\Program Files\ClaudeCode\CLAUDE.md (Windows) | All users in organization | Company coding standards, security policies, compliance requirements |
| User instructions | ~/.claude/CLAUDE.md | Only you (all projects) | Code styling preferences, personal tooling shortcuts |
| Project instructions | ./CLAUDE.md or ./.claude/CLAUDE.md | Team members via source control | Project architecture, coding standards, common workflows |
| Local instructions | ./CLAUDE.local.md (add to .gitignore) | Only you (current project) | Your sandbox URLs, preferred test data |
Project instructions are the ones a team depends on. A project-root CLAUDE.md is committed to git, so everyone who clones the repository gets the same file. User-level files sit under ~/.claude on one person's machine and are never part of the repository. The same split applies to rules: .claude/rules/ in the project is shared, while ~/.claude/rules/ holds one person's preferences and workflows.
A new team member who doesn't receive the team's instructions is the classic configuration hierarchy issue, and the cause is almost always level, not wording. Long-standing teammates find that Claude always follows the commit-message format and runs the tests. For the new team member who has just cloned the repo, Claude ignores both. The conventions were never in project-level configuration. Each veteran keeps them in user-level configuration, their own ~/.claude/CLAUDE.md, or Claude picked them up in auto memory, the notes it writes for itself under ~/.claude/projects/<project>/memory/. Neither location is committed, so a fresh clone gets nothing.
Diagnosing it takes two sessions and one commit:
- In the new team member's session, run
/memoryand read the list of memory files across user and project scopes. The project CLAUDE.md is there, but the missing conventions aren't in it. - Run
/memoryin a veteran's session and open the files it lists until you find the conventions, usually in the user-level~/.claude/CLAUDE.md. - Move them into the project-level
./CLAUDE.mdor./.claude/CLAUDE.md(or a project rules file), commit, and have the new team member pull.
The new team member is also the test for anything else you are unsure about: if a newcomer would need the context to be productive, it belongs at project level.
Checkpoint 1 of 9· Match them up
Each CLAUDE.md location reaches a different set of people. Match each location to who receives its instructions.
Tap a term, then the definition that fits it.
Where the file lives decides who receives it. Files under ~/.claude and the gitignored CLAUDE.local.md stay on one person's machine. The committed project file reaches everyone who clones the repo. The managed policy file is deployed to every user in the organization. This is why conventions kept in a veteran's ~/.claude/CLAUDE.md never reach a new teammate.
“User instructions | ~/.claude/CLAUDE.md | Personal preferences for all projects | Code styling preferences, personal tooling shortcuts | Only you (all projects)”Source: code.claude.com
2.Which files load at launch, which load on demand, and how /memory shows them
The CLAUDE.md configuration hierarchy has three levels a developer deals with every day: user-level, project-level and directory-level. User-level instructions live in ~/.claude/CLAUDE.md and follow you into every project on your machine. Project-level instructions live in the root CLAUDE.md of the repository or in .claude/CLAUDE.md, and for most teams this is the main file. Directory-level instructions live in subdirectory CLAUDE.md files and carry the conventions of one module, such as a frontend/ package that works differently from api/. Claude merges what it finds from broad to specific, and an organization can deploy a managed policy file above all three.
| Level | Location | Loads | Good for |
|---|---|---|---|
| User-level | ~/.claude/CLAUDE.md | Every session, in every project on your machine | Personal preferences, such as "I use pnpm, not npm" |
| Project-level | <repo-root>/CLAUDE.md or ./.claude/CLAUDE.md | Every session in this project | Architecture, conventions and commands the team shares |
| Directory-level | <subdir>/CLAUDE.md | On demand, when Claude reads files in that subdirectory | Module-specific rules, such as different conventions in frontend/ vs api/ |
Every level adds content; none of them replaces another. Managed, user and project files all go into the context together. When two instructions conflict, Claude uses judgment to reconcile them, which means it may pick either one. So remove contradictions instead of counting on one level to override another.
The working directory sets the dividing line. CLAUDE.md files in that directory and in every directory above it are read at session start. CLAUDE.md files below it load only when Claude reads files in that subdirectory. This is what makes per-package files cheap in a monorepo: work in packages/web never loads the API package's conventions.
| Start from | CLAUDE.md loaded at launch | Use when |
|---|---|---|
| Repository root | Root only; subdirectory files load on demand | Tasks span multiple packages or subsystems |
| A subdirectory | That directory's plus every ancestor's | Work is scoped to one package or subsystem |
Use /memory to see what is actually loaded. It lists the CLAUDE.md files in scope for the current session and lets you open any of them to edit. When Claude behaves differently from one session to the next, check this list first. A missing file, or an extra one such as a stale CLAUDE.local.md, usually explains the difference faster than rewriting the instructions.
Timing also matters when you edit a file mid-session. Claude doesn't re-read the file from disk on every turn. Compaction is Claude Code summarizing the conversation so far to free up context space, and /compact runs it on demand. The edit takes effect after the next /compact, when you open the file through /memory, or in your next session. After compaction, the project-root CLAUDE.md is re-injected from disk, while nested subdirectory files reload on demand again.
Checkpoint 2 of 9· Check yourself
A developer notices that in Monday's session Claude followed the package's error-handling convention, but in Tuesday's session on the same repo it ignored it. Nobody edited any instruction file in between. What should they do first?
When behavior changes between sessions, the usual cause is a difference in which memory files loaded. For example, a session started from a different directory leaves out a subdirectory's CLAUDE.md, or a stale CLAUDE.local.md adds extra instructions. /memory lists the files in scope, so it shows this right away. The levels add together, and no level overrides another, so copying the rule to user level fixes nothing and only creates a possible conflict.
“See what memory Claude is using | /memory”Source: support.claude.com
3.Organization-wide instructions developers cannot switch off
A committed CLAUDE.md reaches the team, but the team controls it. Any developer can edit or delete it, and it covers only one repository. For instructions that have to reach every developer in every repository, use the managed scope, which IT or DevOps deploy to a system location with a configuration management system.
Claude Code reads two different kinds of file. Instruction files such as CLAUDE.md hold text that is loaded into Claude's context each session, and when two instructions conflict Claude uses judgment to reconcile them. Settings files such as settings.json configure Claude Code itself: permissions, hooks, environment variables and model defaults. A settings rule is applied by Claude Code, while instruction text is guidance Claude weighs, which is why anything that must hold belongs in settings.
There are two managed mechanisms. A managed CLAUDE.md at the OS policy path holds behavioral guidance: code style and quality guidelines, data-handling and compliance reminders. Managed settings, in managed-settings.json, are enforced settings that your own settings files and --settings values can't override, apart from a few narrow exceptions. Managed settings can carry instruction text in a claudeMd field, and they also handle concerns that need enforcement instead of persuasion, such as blocking tools with permissions.deny or turning on sandbox isolation.
{
"claudeMd": "Always run `make lint` before committing.\nNever push directly to main."
}For security and compliance, the other scopes all fall short in the same way: someone below the organization controls them. A per-repository CLAUDE.md misses repositories nobody updated, and a developer can edit it. Seeding each person's ~/.claude/CLAUDE.md with an onboarding script leaves the file in their hands. A gitignored CLAUDE.local.md is personal by design. Only the managed location sits above developer and project control.
Checkpoint 3 of 9· Check yourself
Your compliance team wants a data-handling instruction to reach every developer in every repository, and no developer should be able to remove it. Which approach meets both requirements?
Only the managed scope sits above developer and project control. Managed settings in particular can't be overridden by a developer's own settings files. A committed CLAUDE.md misses any repository nobody updated, and developers can edit it. Seeded user files and CLAUDE.local.md stay under each developer's control.
“Enterprise-enforced settings that your own settings files and --settings values can’t override, apart from narrow exceptions.”Source: code.claude.com
Checkpoint 4 of 9· Exam question
An architect is designing a configuration strategy for a company rolling out Claude Code to all engineering teams. They need security and compliance instructions that every developer receives on every machine, in every repository, and that individual developers or teams cannot disable through their own settings. Which approach satisfies this requirement?
Correct answer: A — Deploy a managed-settings.json file to the system directory (e.g., /etc/claude-code/ on Linux) using the organization's configuration management system, as it enforces policies that override developer and project settings.
- A. Managed settings in Claude Code are designed to be non‑overridable by any user, project, or local settings. Deploying a
managed-settings.jsonfile to the system directory via configuration management ensures these policies are present on every machine. According to Anthropic documentation, this file‑based deployment is a recommended method for organizations that manage system configuration through automation. The managed policy has the highest precedence in the permission hierarchy, meaning it cannot be overridden by developer global settings (~/.claude/CLAUDE.md), project settings (CLAUDE.md), or local overrides (CLAUDE.local.md), thus satisfying the requirement. - B. While a
CLAUDE.mdfile at the repository root provides project‑level instructions that can be shared via source control, it is not enforceable. In Claude Code’s configuration hierarchy, global user settings (e.g.,~/.claude/CLAUDE.md) take precedence over project settings. An individual developer could simply set conflicting instructions in their global file, effectively disabling the project‑level instructions. Project files can also be deleted or modified, so they cannot guarantee that every developer receives and follows the required security and compliance instructions. - C. Global user settings in
~/.claude/CLAUDE.mdapply to all projects for that user, but developers can freely edit or delete this file at any time. There is no mechanism to lock these settings or prevent a developer from altering them. As a result, this approach does not enforce compliance and cannot ensure that the instructions remain active on every machine. - D. A
CLAUDE.local.mdfile is a local override meant for developer‑specific, temporary, or machine‑specific customizations. It has the lowest precedence in the configuration hierarchy; both project‑level (CLAUDE.md) and global user settings (~/.claude/CLAUDE.md) override it. Even if distributed by a script, developers can easily delete or modify it, and because it is added to.gitignore, there is no source control to maintain consistency. This does not provide the required enforcement or universal application.
4.Keeping CLAUDE.md modular with @path imports
An @path reference inside a CLAUDE.md imports another file. Claude Code loads the referenced file's contents at launch as part of the instructions. You can reference project files, docs, and even a file in your home directory. A home-directory file is a way to keep personal notes about a shared project out of the repository.
See @README for project overview and @package.json for available npm commands for this project.
# Additional Instructions
- git workflow @docs/git-instructions.md
# Individual Preferences
- @~/.claude/my-project-instructions.mdImports work well in a monorepo where each package keeps its own CLAUDE.md. The people who maintain a package know which shared standards apply to it. The API package's file can import the API conventions and the database standards, and the frontend package's file can import the component guidelines. Each package then loads only what is relevant to it, and the standards text still lives in one place. Per-directory files suit this because directory owners maintain their own conventions, and those conventions are versioned with the code.
Imports organize a file, but they don't shrink it. An imported file loads at launch together with the file that imports it, so a 300-line CLAUDE.md split into three imported files costs the same context. To actually load less, move area-specific guidance into a subdirectory CLAUDE.md or into a path-scoped rule. Importing a file from outside the working directory also needs approval: Claude Code asks you to approve external imports for the project.
The same mechanism lets you share AGENTS.md with other coding tools without keeping two copies. A CLAUDE.md that imports @AGENTS.md and then adds Claude-only notes loads both. A CLAUDE.md that only tells Claude in words to read AGENTS.md is weaker, because Claude sees the file only if it decides to open it.
@AGENTS.md
## Claude Code
Use plan mode for changes under `src/billing/`.Checkpoint 5 of 9· Fill the gap
This project CLAUDE.md is committed to the team repository. The developer wants the Individual Preferences import to bring in their personal notes about this project while keeping those notes out of the repository. Which reference completes the last line?
See @README for project overview and @package.json for available npm commands for this project.
# Additional Instructions
- git workflow @docs/git-instructions.md
# Individual Preferences
- ? An @path import can point to a file in the home directory. That file stays on the developer's machine, so the notes load for them but never go into source control. The other paths are inside the project, so the personal notes would be committed and shared with the whole team.
Source: code.claude.comCheckpoint 6 of 9· Check yourself
To reduce the context used at launch, a team moves the frontend and database sections of its 300-line root CLAUDE.md into docs/frontend.md and docs/db.md. The root file now imports them with @docs/frontend.md and @docs/db.md. What effect does this have on context?
Imports make a file easier to organize, but they don't make it smaller. Imported files load at launch together with the CLAUDE.md that imports them. Guidance only loads on demand when it lives in a subdirectory CLAUDE.md or a path-scoped rule.
“Imports help you organize a long file but don’t reduce its context cost, because imported files also load at launch.”Source: code.claude.com
5.Splitting a monolithic CLAUDE.md into .claude/rules/ topic files
Large CLAUDE.md files hurt in two ways: they use more context and Claude follows them less reliably. The recommended size is under 200 lines per CLAUDE.md file. When one file grows to cover code style, testing, security and deployment, put each topic in its own markdown file in .claude/rules/ and cut CLAUDE.md down to the core build commands and conventions.
your-project/
├── .claude/
│ ├── CLAUDE.md # Main project instructions
│ └── rules/
│ ├── code-style.md # Code style guidelines
│ ├── testing.md # Testing conventions
│ └── security.md # Security requirementsThe optional paths: frontmatter decides when a rules file loads. Without it, the file loads every session, the same as CLAUDE.md, and like the project-root CLAUDE.md it is re-injected from disk after compaction. That is the right choice when the goal is better organization while every topic stays loaded. Adding paths: globs turns the file into a conditional rule, which is a different design taught in path-specific rules.
| Destination | Loads | Fits when |
|---|---|---|
| .claude/rules/*.md without paths | Every session | Every topic must stay loaded, split into focused files |
| .claude/rules/*.md with paths globs | When Claude works with a matching file | Guidance applies only to certain file types or directories |
| Subdirectory CLAUDE.md | At launch from that directory, otherwise on demand | Directory owners maintain conventions next to their code |
| Skill in .claude/skills/ | On demand, when invoked or relevant | Reference material or repeatable workflows, not always-on rules |
If every topic has to be present in every session, only one option in that table works. Subdirectory CLAUDE.md files and path-scoped rules leave a topic out until Claude touches matching files. Skills load only when invoked or judged relevant, which suits a full style guide but not an always-on rule such as a security requirement. How skills are built is covered in custom slash commands and skills. Splitting does not reduce the total text, so delete outdated or contradictory instructions while you split, because Claude may pick either side of a conflict at random.
Checkpoint 7 of 9· Match them up
While splitting an oversized CLAUDE.md, a team weighs four places to put each topic. The deciding factor is when each place's content reaches Claude. Pair each destination with its loading behavior.
Tap a term, then the definition that fits it.
Only a rules file without paths frontmatter keeps a topic loaded in every session. Path-scoped rules, subdirectory CLAUDE.md files and skills all leave the topic out until something triggers it. That makes an unscoped rules file the right choice for an always-on requirement such as security.
“Loads | Every session | Every session, or when matching files are opened | On demand, when invoked or relevant”Source: code.claude.com
Checkpoint 8 of 9· Exam question
An engineer launches Claude Code from the services/billing/ directory inside a larger repository. The repository contains three CLAUDE.md files: one at the repository root, one at services/billing/CLAUDE.md, and one at services/billing/reports/CLAUDE.md. The engineer has not yet read or edited any files in the services/billing/reports/ subdirectory. At the moment the session starts, which files are loaded into context?
Correct answer: B — The root file and services/billing/CLAUDE.md load at launch; the reports/ file loads once Claude reads a file in that subdirectory.
- A. Incorrect. Claude Code loads the CLAUDE.md in the working directory and the ones in the directories above it, so the repository root file is in context at launch. A closer file does not exclude an ancestor file. The part about the
reports/file being deferred is right, but the claim about the root file is wrong. - B. Correct. At launch Claude Code loads the CLAUDE.md in the directory it was started from (
services/billing/) and in the directories above it, which includes the repository root. A CLAUDE.md in a deeper subdirectory such asservices/billing/reports/is pulled in only when Claude reads files there, and the engineer has not done that yet. - C. Incorrect. Claude Code does not scan the subtree below the working directory at startup. The
services/billing/reports/CLAUDE.mdfile is deferred until Claude reads a file in that subdirectory, and the engineer has not read any yet. It is therefore not in context at session start. - D. Incorrect. The CLAUDE.md in the directory where the session was launched loads at startup, together with the root file above it. Only the deeper
services/billing/reports/CLAUDE.mdwaits for Claude to read a file in that subdirectory. Deferred loading does not apply to the working directory's own file.
Checkpoint 9 of 9· Exam question
A project's single CLAUDE.md has grown to over 500 lines covering code style, testing, security requirements, and deployment steps, and the team notices Claude adheres to instructions less reliably than before. The architect wants to reorganize this into focused, maintainable files while keeping everything loaded for every session. Which restructuring best achieves this?
Correct answer: A — Split the guidance into code-style.md, testing.md, security.md and deployment.md in .claude/rules/ with no paths frontmatter, and slim CLAUDE.md down
- A. Correct. Topic files in .claude/rules/ that have no paths frontmatter are loaded at launch with the same priority as CLAUDE.md. All the guidance stays in context for every session, and each topic gets its own maintainable file.
- B. Wrong. A CLAUDE.md in a subdirectory is loaded only when Claude reads files in that directory. The security and deployment guidance would therefore be missing from sessions that never touch those folders, and the team needs all of it loaded each session.
- C. Wrong. Rules with paths frontmatter are loaded only when Claude reads a file matching the globs. Sessions that never touch those files would not see the guidance, so it is no longer loaded at launch as the team requires.
- D. Wrong. A skill's content is loaded only when Claude decides it is relevant or the skill is invoked. The guidance would not be present in every session, and the architect needs it loaded at launch.
Sources
(8)
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
“Personal preferences for all projects”
↩︎ Project scope vs user scope: who receives an instruction“A new teammate would need the same context to be productive”
↩︎ Project scope vs user scope: who receives an instruction“Project instructions | ./CLAUDE.md or ./.claude/CLAUDE.md”
↩︎ Which files load at launch, which load on demand, and how /memory shows them“Organization-wide instructions managed by IT/DevOps”
↩︎ Organization-wide instructions developers cannot switch off“Imports help you organize a long file but don’t reduce its context cost, because imported files also load at launch.”
↩︎ Keeping CLAUDE.md modular with @path imports“Claude sees AGENTS.md only if it decides to open the file.”
↩︎ Keeping CLAUDE.md modular with @path imports“target under 200 lines per CLAUDE.md file. Longer files consume more context and reduce adherence.”
↩︎ Splitting a monolithic CLAUDE.md into .claude/rules/ topic files“if two instructions contradict each other, Claude may pick one arbitrarily.”
↩︎ Splitting a monolithic CLAUDE.md into .claude/rules/ topic files“Team members via source control”
↩︎ Exam trap 1“Project instructions | ./CLAUDE.md or ./.claude/CLAUDE.md”
↩︎ Exam trap 3“Imports help you organize a long file but don’t reduce its context cost, because imported files also load at launch.”
↩︎ Exam trap 4“User instructions | ~/.claude/CLAUDE.md | Personal preferences for all projects | Code styling preferences, personal tooling shortcuts | Only you (all projects)”
↩︎ Checkpoint - 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.”
↩︎ Project scope vs user scope: who receives an instruction“Claude looks in a few places and merges what it finds, from broad to specific”
↩︎ Which files load at launch, which load on demand, and how /memory shows them“That subdirectory (loaded on demand when Claude reads files in that directory, not at session start)”
↩︎ Which files load at launch, which load on demand, and how /memory shows them“If you edit the file mid-session, the change is picked up the next time you run /compact or open it via /memory”
↩︎ Which files load at launch, which load on demand, and how /memory shows them“Subdirectory CLAUDE.md files are loaded on demand later, when Claude reads files in that subdirectory.”
↩︎ Exam trap 2“Subdirectory CLAUDE.md files are loaded on demand later, when Claude reads files in that subdirectory.”
↩︎ Prediction“See what memory Claude is using | /memory”
↩︎ Checkpoint - 3.https://code.claude.com/docs/en/claude-directoryOfficial docs
“Auto memory: Claude’s notes to itself across sessions”
↩︎ Project scope vs user scope: who receives an instruction“Enterprise-enforced settings that your own settings files and --settings values can’t override, apart from narrow exceptions.”
↩︎ Organization-wide instructions developers cannot switch off“Permissions, hooks, env vars, model defaults”
↩︎ Organization-wide instructions developers cannot switch off“Enterprise-enforced settings that your own settings files and --settings values can’t override, apart from narrow exceptions.”
↩︎ Exam trap 5 - 4.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”
↩︎ Project scope vs user scope: who receives an instruction - 5.https://code.claude.com/docs/en/features-overviewOfficial docs
“Files from your working directory and above load at launch; subdirectories load as you work in them.”
↩︎ Which files load at launch, which load on demand, and how /memory shows them“When instructions conflict, Claude uses judgment to reconcile them.”
↩︎ Organization-wide instructions developers cannot switch off“CLAUDE.md files are additive: all levels contribute content to Claude’s context simultaneously.”
↩︎ Key concept“Every session, or when matching files are opened”
↩︎ Prediction“Loads | Every session | Every session, or when matching files are opened | On demand, when invoked or relevant”
↩︎ Checkpoint - 6.
“/memory | View or edit the CLAUDE.md files in scope.”
↩︎ Which files load at launch, which load on demand, and how /memory shows them“/compact | Summarize the conversation so far to free up context.”
↩︎ Which files load at launch, which load on demand, and how /memory shows them - 7.https://code.claude.com/docs/en/large-codebasesOfficial docs
“Directory owners maintain their own conventions; instructions are versioned with the code”
↩︎ Keeping CLAUDE.md modular with @path imports - 8.https://code.claude.com/docs/en/context-windowOfficial docs
“Project-root CLAUDE.md and unscoped rules | Re-injected from disk”
↩︎ Splitting a monolithic CLAUDE.md into .claude/rules/ topic files