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 (CCAR-F) exam. The bank holds 20 practice questions here — 2 easy, 11 medium, and 7 hard — with 6 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.
Your team's project CLAUDE.md contains shared conventions, but the backend subdirectory has strict API design rules that only apply when working in that directory. Where should you add those directory-specific rules to apply them automatically?
Show answer & explanation
Correct answer: A. In a CLAUDE.md file placed inside the backend subdirectory
CLAUDE.md files in subdirectories load on demand when Claude reads files in that directory, making them the correct mechanism for directory-scoped rules. 'Project-root CLAUDE.md under a backend section' loads unconditionally for all directories, violating the scoping requirement. '~/.claude/CLAUDE.md' applies to all projects globally, not this subdirectory. '.claude/settings.json path-scoped block' is not a supported mechanism for conditional instruction loading.
3 more free questions on this subtopic in the practice stream, plus 14 in the full bank. Keep practicing →