CLAUDE.md hierarchy, scoping & organization
Configure CLAUDE.md files with appropriate hierarchy, scoping, and modular organization.
This subtopic (3.1) sits in Claude Code Configuration & Workflows (D3) on Anthropic's Claude Certified Architect — Foundations (CCA-F) exam. The bank holds 20 practice questions here — 2 easy, 11 medium, and 7 hard — with 5 free to try, answers and explanations included. 3 of the free questions are below; the rest are in the practice stream.
What the exam tests here
- CLAUDE.md hierarchy — user-level, project-level, directory-level
- .claude/rules/ directory for topic-specific rule files
- user-level settings not shared via version control
- @import syntax for modular CLAUDE.md organization
Free practice questions: CLAUDE.md hierarchy, scoping & organization
Your team shares a project-level CLAUDE.md for shared conventions. Where should you store your personal coding style preferences so they apply across every project you open?
Show answer & explanation
Correct answer: C. In ~/.claude/CLAUDE.md as user-level instructions
~/.claude/CLAUDE.md is the user-level CLAUDE.md loaded for every project only for that user. Project-level CLAUDE.md is team-shared via source control. CLAUDE.local.md is personal but scoped to a single project. .claude/rules/ files are project-scoped.
Your team's CLAUDE.md has grown unwieldy mixing testing conventions, refactoring style, and slash commands guidance. A teammate moves the testing section into .claude/rules/testing.md expecting Claude Code to pick it up automatically on the next session, but the new rules are ignored during refactoring tasks. What is the minimal correct fix?
Show answer & explanation
Correct answer: D. Add an @./.claude/rules/testing.md import line in the project CLAUDE.md so the file is pulled into context.
Files under .claude/rules/ are not auto-discovered; they only take effect when explicitly pulled in via an @path import from a CLAUDE.md that is itself loaded. Adding @./.claude/rules/testing.md to project CLAUDE.md is the minimal fix. Renaming with a CLAUDE.md suffix does not trigger discovery outside recognized memory locations. .claude/commands/ defines slash commands, not rules. Top-level TESTING.md is not part of Claude Code's memory hierarchy.
An engineer on the developer productivity agent project wants Claude Code to always use their preferred Bash alias expansions and personal code-exploration shortcuts across every project, without those preferences appearing in version control. Where should these settings live?
Show answer & explanation
Correct answer: B. In ~/.claude/CLAUDE.md so personal preferences apply to all projects outside source control
~/.claude/CLAUDE.md is the user-level file that applies to all projects and is never committed to source control. CLAUDE.local.md is project-specific personal overrides. Committed CLAUDE.md is team-shared. HTML comments save tokens but still share via version control. The .claude/rules/ directory is also tracked by the team.
2 more free questions on this subtopic in the practice stream, plus 15 in the full bank. Keep practicing →