Lesson 0005 · Domain 3 (20%) · Claude Certified Architect — Foundations

Claude Code config: where it lives & what scopes it

One map of every config surface, the user-vs-project split, and the four distractors that beat you on the mock. ~10 minutes.
Why you're here. You missed four Domain-3 questions, and they're all the same gap: which file, which directory, which scope. The fix isn't more theory — it's one map you can recall instantly, plus knowing why the plausible-looking wrong answer is wrong.

0 · The one question to ask: who needs this, and when?

Every Domain-3 location question reduces to two axes:

Exam tell: "available to every developer when they clone the repo" → it must be in the repo (.claude/…), never ~/.claude/….

1 · The map — memorize this table

What you needWhere it livesScope
My instructions across all projects~/.claude/CLAUDE.mduser — personal, not shared
Team instructions for this project./CLAUDE.md (repo root)project — shared via git
Instructions for one subtree<subdir>/CLAUDE.mddirectory — supplements the parents
Split a huge CLAUDE.md into topics.claude/rules/*.md (e.g. testing.md)project; optional glob paths to scope by file
Slash command shared on clone.claude/commands/project — version-controlled
My personal/experimental command~/.claude/commands/user — not in the repo
Context useful for one task type onlya skill, invoked via slash commandon-demand — loaded only when called
Run non-interactively (CI/CD)claude -p "…" (--print)CLI flag — prints & exits, no prompt

2 · CLAUDE.md hierarchy — they STACK, they don't override

You can place CLAUDE.md at the user level, the project root, and inside subdirectories. Claude reads all applicable levels and supplements — a child does not overwrite the parent's rules.

The distractor that beat you: "multiple CLAUDE.md files, each overriding the parent." Wrong on two counts — (1) they supplement, not override; (2) this feature is for scoping context to parts of the codebase, not for modularizing one project's many topics.

To modularize a 500-line CLAUDE.md into focused files → that's .claude/rules/, a different feature.

3 · .claude/rules/ — modular, and optionally path-scoped

Break the monolith into topic files (testing.md, api-conventions.md). Each rule file can declare a glob paths so it activates only when you're working on matching files.

Key limit: a rule with paths: api/** fires for everything you do in that directory — generation, bug fixes, reviews alike. That's the trap in the next point.

4 · Skill vs path-rule — on-demand vs always-on

Path-scoped ruleSkill (slash command)
Loads whenany work touching matching filesonly when you invoke it
Best forstandards that apply to all work in a pathcontext useful for one task type
Riskwastes context on unrelated tasks (bug fixes, reviews)none — it's silent until called

The distractor that beat you: exemplar endpoints help only when generating new endpoints — not for bug fixes or reviews in the same api/ dir. A path-rule would fire for all of those (wasteful). The on-demand skill loads the exemplars only when you ask for a new endpoint. Useful-sometimes → skill; always-applies-in-path → rule.

5 · -p for CI — the non-interactive flag

A bare claude "…" in a pipeline hangs waiting for interactive input. claude -p "…" (--print) processes the prompt, writes the result to stdout, and exits.

Dodge these: there is no CLAUDE_HEADLESS env var and no --batch flag; redirecting < /dev/null is a generic Unix hack, not the documented mechanism. The answer is always -p.

Practice — pick the location, dodge the look-alike

Primary source

📖 Read once: Anthropic's Best practices for Claude Code (CLAUDE.md, commands, plan mode) + Claude Code settings (the full config surface). Grounded in exam guide Domain 3 + your CLAUDE.md notes.