Cram 01 · Domain 3 · 20% of exam
Built from your 2026-08-28 mock: Domain 3 scored 7/12 (58%), and four of the five misses were the same underlying question — advice or enforcement? Lifting D3 to ~92% is worth about +68 points, four times either other gap.
Don't recall six mechanisms. Recall two questions. The second one is the one you got wrong.
Everything in the first family — CLAUDE.md, .claude/rules/, skills, commands — is
context: it shapes behaviour probabilistically.
Everything in the second — hooks, settings permissions — is
enforcement: deterministic, applied by the client.
The moment a question says must, guarantee, prevent, never, or names a
compliance rule, you have left the CLAUDE.md family entirely.
Must it be impossible to violate? (policy, compliance, "never", "guarantee")
│
├─ YES → is it a blanket allow / deny of a tool or path?
│ ├─ YES → settings permissions
│ └─ NO — it needs logic (thresholds, prerequisites, transforms)
│ └─ hook · before the call = PreToolUse
│ · after the call = PostToolUse
│
└─ NO, it's guidance → WHEN is it relevant?
├─ every task ....................... CLAUDE.md
├─ only certain files ............... .claude/rules/ + paths glob
└─ only when I ask for it
├─ carries heavy context ... skill
└─ a named repeatable prompt command
The trap you fell for — both directions
Q34: you treated CLAUDE.md scope as a precedence chain and stayed in the advice family
when the requirement was guaranteed. Q26: you jumped to a
.claude/rules/ ban when the instruction was merely vague.
Enforcement is not "the strong answer" — it's the answer when a violation is unacceptable.
A vague requirement gets specified, not enforced.
Recognition matters more than authoring: a favourite distractor is invented syntax
(.claude/config.json with a commands array, .claude/config.yaml). Neither exists.
| Mechanism | Applies | Binding | Reach for it when |
|---|---|---|---|
CLAUDE.md |
Always loaded | Advice | Universal standards relevant to every task in scope |
.claude/rules/*.md |
Always — or conditionally with a paths glob |
Advice | Topic-splitting a bloated CLAUDE.md; conventions tied to a file type spread across directories |
.claude/skills/SKILL.md |
On demand — only when invoked | Advice | A workflow with heavy context that is useless for other tasks |
.claude/commands/ |
On demand — typed as /name |
Advice | A repeatable prompt the team runs by name |
| Hooks | At a fixed lifecycle event | Guarantee | Block a call, or transform its result, deterministically |
| Settings permissions | At tool-call time | Guarantee | Allow / deny / ask for a tool or path outright |
Broadest scope first, most specific last — this is load order, not precedence (see §3):
| Scope | Location | Shared |
|---|---|---|
| Managed policy | IT-deployed (e.g. /Library/Application Support/ClaudeCode/CLAUDE.md) | Whole org — cannot be excluded |
| User | ~/.claude/CLAUDE.md | Just you, all projects |
| Project | ./CLAUDE.md or ./.claude/CLAUDE.md | Team, via version control |
| Local | ./CLAUDE.local.md | Just you, this project — gitignored |
Two more facts worth holding: user-level rules load before project rules, and a
rule without a paths field loads unconditionally — that single key is the
whole difference between a rule file and CLAUDE.md.
Verbatim from the official memory docs. Q34 was written directly against the first three — the question's correct answer quoted them. Read these until they're reflexive.
All discovered files are concatenated into context rather than overriding each other.
Kills: "the more specific CLAUDE.md wins on conflicts." It doesn't. There is no precedence chain.
If two rules contradict each other, Claude may pick one arbitrarily.
Kills: any answer that resolves a conflict by moving the rule to a different CLAUDE.md file.
Settings rules are enforced by the client regardless of what Claude decides to do. CLAUDE.md instructions shape Claude's behavior but are not a hard enforcement layer.
This is the Q34 answer in one sentence. Rule that must hold every time → settings.json or a hook.
CLAUDE.md content is delivered as a user message after the system prompt, not as part of the system prompt itself… there's no guarantee of strict compliance.
Kills: "put it in bold / in caps / at the top of CLAUDE.md." Escalating emphasis on a probabilistic mechanism doesn't make it deterministic.
Hooks execute as shell commands at fixed lifecycle events and apply regardless of what Claude decides to do.
Note "fixed lifecycle events" — not "tool calls." That phrasing is the whole of §4.
Also verified, and useful if compaction comes up: project-root CLAUDE.md survives
/compact — Claude re-reads it from disk and re-injects it. Instructions that vanish after
compaction were conversation-only, or in a nested/path-scoped file that hasn't re-matched yet.
The live docs list roughly 26 hook events. The exam guide's appendix names exactly one:
hooks (PostToolUse, tool call interception)
. Spend your time accordingly.
PreToolUse Core
Fires before the tool executes. Can block.
Policy gates, prerequisites, thresholds. The guide's example: blocking refunds over $500; blocking process_refund until get_customer returns a verified ID.
Blocks via exit code 2, or "permissionDecision": "deny".
PostToolUse Core
Fires after the tool succeeds. Cannot block — it already ran.
Transform, normalise, validate, log. The guide's example: normalising heterogeneous data formats (Unix timestamps, ISO 8601, numeric status codes) before the agent processes them.
Also the right answer for "format the file after it's written."
Q51 — you picked PreToolUse for formatting
Checkstyle on every written Java file → PostToolUse. PreToolUse fires before the write, so there is no file on disk to format yet. If the requirement contains the words "before being saved", that describes the goal, not the hook — ask instead: does the artefact need to exist for this to work?
These cost you Q20 here and Q50 on the 08-24 run. Worth ten minutes of recognition, not memorisation.
| Event | Fires | Notes |
|---|---|---|
PreCompact Edge |
Before compaction runs | Matcher distinguishes manual (you ran /compact) from auto. Not a tool — it has no PreToolUse matcher. |
SessionStart Edge |
Session begins | Matcher: startup, resume, clear, compact, fork. |
UserPromptSubmit Edge |
You submit a prompt | No matcher. Can block. |
Stop / SubagentStop Edge |
Turn / subagent ends | Can block — i.e. force continuation. |
| Everything else Skip | — | FileChanged, ConfigChange, WorktreeCreate, TaskCreated… real, but far outside guide scope. Don't study these tonight. |
Q20 — the transferable rule
You invented a Compact tool and hung a PreToolUse matcher on it.
Compaction is a lifecycle operation, not a model-invoked tool. Generalise:
if the trigger is something the session does (starting, compacting, ending, stopping)
rather than something Claude calls, it has its own dedicated event and is never
reachable through PreToolUse.
Q50 (08-24): a PreToolUse hook that keeps returning deny invites retry loops.
It can also rewrite the call's input via updatedInput rather than only refusing it.
The field is real and documented; its exact semantics are not fully spelled out in the hooks reference — treat the "rewrite, don't just deny" idea as the takeaway, not the syntax.
// settings.json → permissions // blanket allow / deny / ask
{ "permissions": {
"allow": ["Bash(npm run test *)"],
"deny": ["Read(./.env)"],
"ask": ["Write(./src/**)"] } }
// ToolName(pattern) in one of three arrays. Deny wins across scopes.
// settings.json → hooks // enforcement with logic
{ "hooks": {
"PreToolUse": [
{ "matcher": "Bash",
"hooks": [ { "type": "command", "command": "./.claude/hooks/gate.sh" } ] } ] } }
// event → matcher → handlers array.
These generate most D3 distractors. Each turns on a single question.
Exemplar endpoints that help generate new endpoints but are dead weight during a bug fix in the same directory → skill. A path rule would load them on every bug fix too. "Only useful for task X" → skill. "Applies to file type Y" → path rule.
.claude/rules/ vs a subdirectory CLAUDE.md — directory or file type?mobile/ app) → subdirectory CLAUDE.md.*.test.tsx, all Terraform) → .claude/rules/ with a paths glob.Nested CLAUDE.md files supplement their parents. "Each one overrides the parent" is always wrong.
.claude/commands/, .claude/skills/ — in the repo.~/.claude/commands/, ~/.claude/skills/.~/.claude/skills/ under a different name.
The phrase "when they clone the repository" makes this a one-second question — anything under
~/.claude/ is wrong by definition.
| Field | Buys you |
|---|---|
context: fork | Runs the skill in an isolated sub-agent context, so verbose output never pollutes the main conversation. Tell: "the analysis floods the session." |
allowed-tools | Restricts tool access during the skill — e.g. no writes, to prevent destructive actions. |
argument-hint | Prompts the developer for required parameters when they invoke it bare. |
Session context isolation: why the same Claude session that generated code is less effective at reviewing its own changes compared to an independent review instance.
This is a named knowledge item, which is why it was the answer. Generate → review → analyse in one shared session means steps 2 and 3 inherit step 1's reasoning and stop being able to see its gaps.
The rest of 3.6, compressed:
-p / --print — non-interactive mode. Missing it makes the pipeline hang, not produce weak output.--output-format json + --json-schema — machine-parseable findings for inline PR comments.Q26 — the mirror image
Claude writes mocked unit tests instead of the required integration tests → tighten CLAUDE.md
with concrete criteria (real DB connections, contract assertions), not a rule-file ban on mocks.
The guide names this verbatim: Documenting testing standards, valuable test criteria, and available
fixtures in CLAUDE.md to improve test generation quality.
Diagnostic: the existing instruction wasn't disobeyed, it was under-specified.
Nobody violated a rule — "integration test" just never got defined.
| Choose | When |
|---|---|
| Plan mode | Large-scale changes, multiple valid approaches, architectural decisions, multi-file modifications. Safe exploration before committing to a change. |
| Direct execution | Simple, well-scoped changes — a single-file bug fix with a clear stack trace, one validation conditional. |
| Explore subagent | Verbose discovery of existing behaviour. Isolates the noise and returns a summary, preserving main-conversation context. |
Q29 (flagged, correct): the split between the last two is understanding vs deciding. "Explain this pipeline before we refactor it" is discovery → Explore subagent. Plan mode also explores, but it runs in the main conversation and drives toward a change plan.
If you read nothing else again, read this.
| Q | The rule |
|---|---|
| Q20 | Session lifecycle events (compact, start, stop) have dedicated hooks. They are not tools and never reachable via PreToolUse. |
| Q26 | Output is wrong because the spec was vague → add concrete criteria to CLAUDE.md. Don't escalate to enforcement. |
| Q34 | CLAUDE.md files are concatenated, not ranked. A rule that must hold every time goes in settings.json or a hook. |
| Q47 | A reviewer that shares context with the generator inherits its blind spots. Isolate the session. |
| Q51 | Act on a file that must already exist → PostToolUse. Pre = prevent, Post = process. |
Four of these five reduce to one habit: before choosing a mechanism, name the failure. Was the instruction unclear (Q26), unenforceable (Q34), mistimed (Q51), misattributed to a tool (Q20), or biased by shared context (Q47)? The failure names the mechanism. Choosing the mechanism first is how you got these wrong.
The question tells you the answer in its own words. Underline the constraint phrase before reading the options.
| If the question says… | Answer |
|---|---|
| "must never happen", "guarantee", "compliance", "policy" | Hook or settings permissions — never CLAUDE.md |
| blanket allow/deny of a tool or path | settings.json → permissions |
| needs a threshold, prerequisite, or transform | Hook |
| "stop it before it happens", block a call | PreToolUse |
| normalise / format / validate a result or written file | PostToolUse |
before /compact, on session start | Dedicated lifecycle hook (PreCompact, SessionStart) |
| output inconsistent, instruction was vague | Concrete criteria in CLAUDE.md |
| "every task in the project" | CLAUDE.md |
| "when they clone the repository" | Project-scoped, in the repo |
| "without affecting teammates", personal | ~/.claude/… |
all *.test.tsx wherever they live | .claude/rules/ + paths glob |
| conventions for one subtree | Subdirectory CLAUDE.md |
| "only useful when doing X" | Skill |
| verbose output floods the session | context: fork (skill) · Explore subagent (discovery) |
| restrict tools during the workflow | allowed-tools in SKILL.md |
| repeatable prompt run by name | .claude/commands/ |
| "which memory files loaded?" / inconsistent across sessions | /memory |
| review step misses what it generated | Independent session — context isolation |
| CI hangs waiting for input | -p / --print |
| machine-parseable CI findings | --output-format json + --json-schema |
| architectural, multi-approach, 45+ files | Plan mode |
| single-file fix, clear stack trace | Direct execution |
One note on /memory
The exam guide names it explicitly: Using the
Answer /memory command to verify which memory
files are loaded and diagnose inconsistent behavior across sessions./memory.
For your own awareness only — current docs have since split this: /memory lists file
locations, while /context shows what actually loaded this session.
If both appear as options, the guide's wording governs.