🎓 Claude Architect KB CCAR-F · CCAR-P study guide

Domain 2 – Questions

Claude Code · every question we have for this domain, in one place

Domain 2 lesson · Domain 2 – Facts

Answer each question cold, then open its explanation. In the local app every answer is graded and saved, and Reset all at the top starts a fresh round for this domain (your history is kept). 66 questions in total.

Practice questions (16)

Source: Practice questions.

Q9. The team wants formatting to run automatically after Claude Code Write/Edit operations. Use: A) A CLAUDE.md rule B) Ask Claude nicely per session C) A skill describing formatting D) A PostToolUse hook matching Write|Edit running the formatter

Understand Q9 · the situation and each part of the question

The real situation behind this question

A team wants formatting to happen whenever Claude Code writes or edits a file through the specified tools. This is an event-response requirement: after a matching edit, run the formatter. The developer should not have to remember to ask, and the model should not decide that formatting is optional. You are choosing the mechanism that connects a concrete tool event to executable follow-up behavior.

Read the question in parts

Part 1 · after a matching edit

The trigger is a completed Write or Edit tool operation, not the start of the session or a later code review.

Part 2 · actually runs a formatter

The requirement needs a command to execute, not merely a sentence describing the desired style.

Part 3 · Runtime scope: CLAUDE.md

This question assumes the Claude Code configuration environment. Its instruction-file conventions do not automatically apply to a custom messages.create loop. Production can use either runtime, so identify the named runtime rather than assuming all deployed agents ignore files.

What you are being asked to decide

Which mechanism actually runs a formatter after a matching edit? Distinguish an event handler from a written instruction.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
CLAUDE.md (memory file)A Markdown instruction file read as context by Claude Code.
Skill (Claude Code)A reusable set of task instructions, normally described in SKILL.md with optional scripts and resources.
Hook (Claude Code)A configured handler that runs when a lifecycle event occurs.

Study: the memory hierarchy CLAUDE.md — the memory layers (and the exam-speak decoder) Deterministic Skill Hook Domain 2 · Claude Code

Understand Q9's answer · full reasoning and worked examples
Claude synthesized · the point, straight

"Automatically after every Write or Edit" is a mechanical guarantee, and a CLAUDE.md rule or a skill only asks the model to remember. Hooks are the harness running code deterministically at lifecycle events. So a PostToolUse hook matched to Write|Edit runs the formatter every time, whether or not the model thinks of it.

Connect the design to the situation

After Write/Edit changes a file, a configured command formats that file.

Best answer: D. A configured PostToolUse hook runs after matching edits and can invoke formatting. This is stronger than asking the model to remember the formatter. Check hook failures and use CI formatting checks for repository-wide enforcement, including edits made outside that hook.

What each choice would do here

A · Why this does not meet the full requirement

A CLAUDE.md rule

A file instruction depends on the model remembering to follow it.

A CLAUDE.md instruction can explain formatting conventions and tell the assistant to run a command. It still relies on the assistant following that instruction each time an edit occurs.

B · Why this does not meet the full requirement

Ask Claude nicely per session

A per-session request is not an automatic event handler.

Asking again each session creates a repeated manual step and still leaves individual edits dependent on compliance. It does not register an automatic handler for the event.

C · Why this does not meet the full requirement

A skill describing formatting

A skill describes a procedure but is not necessarily triggered after every edit.

A formatting skill can package instructions and scripts for an appropriate task. Automatic skill relevance is not the same as a mandatory handler after every matching edit event.

D · Why this meets the requirement

A PostToolUse hook matching Write|Edit running the formatter

A matching PostToolUse hook runs code after the event; CI still checks changes from other sources.

Configure the post-tool event, match the relevant tool names, and execute the formatter for the changed file. Keep CI checks for edits made outside that event path and handle formatter failures visibly.

Walk through complete payloads or code · every step explained

Illustrative examples, not recorded live calls. Check each block's direction and endpoint: API requests, API responses, MCP messages, and configuration files are different contracts.

Complete minimal hook settings file

JSON
{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Write|Edit",
        "hooks": [
          {
            "type": "command",
            "command": "python3 .claude/hooks/format_changed_file.py"
          }
        ]
      }
    ]
  }
}

Place in the appropriate Claude Code settings file. This is host configuration, not a Messages API request. PostToolUse names the event, matcher restricts which tools trigger it, and the command hook launches the script.

Complete illustrative formatter handler

PYTHON
# .claude/hooks/format_changed_file.py
# Illustrative formatter hook. Requires prettier in the project's node_modules.
import json
from pathlib import Path
import subprocess
import sys

payload = json.load(sys.stdin)
project = Path(payload["cwd"]).resolve()
raw = Path(payload["tool_input"]["file_path"])
file = (raw if raw.is_absolute() else project / raw).resolve()
if not file.is_relative_to(project):
    raise ValueError("Changed file is outside this project")
if file.suffix in {".js", ".jsx", ".ts", ".tsx", ".json", ".css"}:
    subprocess.run([str(project / "node_modules/.bin/prettier"), "--write", str(file)], check=True, cwd=project)

The host supplies event JSON on stdin. The handler reads the changed file path and calls a project-installed formatter without constructing a shell command from that path. It checks location and a small extension list; it does not cover every editor or formatter setup. A failing formatter must be visible, and CI still checks the repository.

Which omitted settings use defaults or leave features unconfigured?

Check your understanding · explain the design in your own words

Which mechanism actually runs a formatter after a matching edit?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Claude Code mechanisms and examples Official hook configuration and event fields Which runtime reads CLAUDE.md? Guidance versus enforcement

Study: the memory hierarchy CLAUDE.md — the memory layers (and the exam-speak decoder) Deterministic Skill Hook Domain 2 · Claude Code

Return to Q9's situation and clause-by-clause explanation

Q10. Shared repo conventions (build commands, style rules) belong in: A) The project's CLAUDE.md checked into git B) Each engineer's settings.local.json C) A slash command D) ~/.claude/CLAUDE.md

Understand Q10 · the situation and each part of the question

The real situation behind this question

Several engineers clone the same repository and use Claude Code to work on it. Everyone should receive the same build command and project conventions without copying personal configuration from another laptop. The question is asking about the distribution and scope of instructions: what travels with the repository, and what exists only for an individual user.

Read the question in parts

Part 1 · every teammate

The solution must work for a new checkout, not just the author who already has local configuration.

Part 2 · project instructions

These are standing instructions for work in this repository, rather than a one-off task template.

Part 3 · Runtime scope: CLAUDE.md

This question assumes the Claude Code configuration environment. Its instruction-file conventions do not automatically apply to a custom messages.create loop. Production can use either runtime, so identify the named runtime rather than assuming all deployed agents ignore files.

What you are being asked to decide

Where should instructions live so every teammate receives them with the repository? Share project guidance through the correct scope.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
CLAUDE.md (memory file)A Markdown instruction file read as context by Claude Code.
Slash commandA named invocation that expands or runs a configured command or prompt procedure.

Study: the memory hierarchy CLAUDE.md — the memory layers (and the exam-speak decoder) settings precedence — cascade + clamp, layer by layer Slash command Domain 2 · Claude Code

Understand Q10's answer · full reasoning and worked examples
Claude synthesized · the point, straight

Build commands and style rules must reach every engineer who clones the repo. settings.local.json and ~/.claude/CLAUDE.md are per-person and never leave one machine; a slash command is a task, not standing context. So shared conventions go in the project's CLAUDE.md, checked into git, so everyone's session loads them.

Connect the design to the situation

A build command and naming convention travel with the checked-in project.

Best answer: A. A committed project CLAUDE.md shares instructions with collaborators. A personal user file or local settings file does not serve that shared purpose. Instructions remain guidance; use executable checks for requirements that must hold.

What each choice would do here

A · Why this meets the requirement

The project's CLAUDE.md checked into git

Project CLAUDE.md is shared with the repository.

A checked-in project instruction file travels through version control. Review changes to it like other team configuration so that new contributors and automation receive the intended guidance.

B · Why this does not meet the full requirement

Each engineer's settings.local.json

Local settings are personal overrides and not the shared instruction document.

A local settings file is useful for personal preferences. Using it for team-wide instructions fails because other checkouts do not automatically receive that individual's local file.

C · Why this does not meet the full requirement

A slash command

A command must be invoked; it is not the general project instruction layer.

A slash command is useful when someone deliberately invokes a repeated task. It does not make all general project conventions available merely because a teammate opens the repository.

D · Why this does not meet the full requirement

~/.claude/CLAUDE.md

The user's home-directory file belongs to one person's environment.

A home-directory instruction file applies to that user's environment. Another engineer or CI machine does not inherit it just by cloning the project.

Check your understanding · explain the design in your own words

Where should instructions live so every teammate receives them with the repository?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Claude Code mechanisms and examples Which runtime reads CLAUDE.md? Guidance versus enforcement

Study: the memory hierarchy CLAUDE.md — the memory layers (and the exam-speak decoder) settings precedence — cascade + clamp, layer by layer Slash command Domain 2 · Claude Code

Return to Q10's situation and clause-by-clause explanation

Q11. A 20-line prompt the team runs daily with one variable (a ticket id) should become: A) Rely only on automatic skill matching B) An explicitly invoked slash command with $ARGUMENTS (including one provided by a skill) C) A hook D) A subagent

Understand Q11 · the situation and each part of the question

The real situation behind this question

You review many tickets using the same checklist, but the ticket identifier changes each time. You want to type a recognizable command and provide the current ID. The question is about separating a reusable procedure from its changing input. You do not need a new agent architecture merely to avoid retyping a template.

Read the question in parts

Part 1 · repeatedly invoke

The user deliberately starts the procedure, rather than waiting for the model to guess that it is relevant.

Part 2 · changing one input

The template remains stable; the argument supplies the ticket or other target for this particular run.

What you are being asked to decide

How should a user repeatedly invoke a fixed prompt while changing one input? Choose explicit reusable invocation over accidental activation.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
Slash commandA named invocation that expands or runs a configured command or prompt procedure.
SubagentA worker assigned a scoped task with its own context and configured tools.
Skill (Claude Code)A reusable set of task instructions, normally described in SKILL.md with optional scripts and resources.
Hook (Claude Code)A configured handler that runs when a lifecycle event occurs.

Study: workflows vs agents Slash command Subagent Skill Hook Domain 2 · Claude Code

Understand Q11's answer · full reasoning and worked examples
Claude synthesized · the point, straight

The prompt is fixed, run on demand, and varies by one value. Automatic skill matching can't be relied on to fire when you want it; a hook is event-driven and a subagent is for isolating context. So it becomes an explicitly invoked slash command taking the ticket id as $ARGUMENTS, and a skill can provide that command too.

Connect the design to the situation

A ticket-review template is invoked with T-2291 today and T-2292 tomorrow.

Best answer: B. A parameterized slash command fits an explicitly user-invoked template. Current Claude Code skills can also provide slash invocations, so this is not an exclusive capability of legacy command files. The key requirement is a reusable procedure with the ticket ID supplied as an argument.

What each choice would do here

A · Why this does not meet the full requirement

Rely only on automatic skill matching

Skills can also expose commands today; automatic matching alone is less explicit than the invocation requested here.

Automatic relevance selection can be convenient, and skills can also expose commands. The mismatch is relying only on automatic selection when the requirement explicitly asks for user-controlled invocation with an argument.

B · Why this meets the requirement

An explicitly invoked slash command with $ARGUMENTS (including one provided by a skill)

An explicit command with an argument fits the stated reusable-template need.

The command body holds the checklist and substitutes the supplied argument where the target belongs. Modern skill-provided commands can serve the same interface; the key is explicit invocation and parameterization.

C · Why this does not meet the full requirement

A hook

A lifecycle hook responds to an event rather than a user's parameterized task.

A hook starts because a lifecycle event occurred, such as a tool finishing. That is a different trigger from a user asking to run the checklist on ticket T-2291.

D · Why this does not meet the full requirement

A subagent

A separate agent is unnecessary merely to substitute a ticket ID.

A subagent offers a separate execution context when isolation is useful. It is unnecessary if the only problem is putting a different ticket ID into the same short procedure.

Walk through complete payloads or code · every step explained

Illustrative examples, not recorded live calls. Check each block's direction and endpoint: API requests, API responses, MCP messages, and configuration files are different contracts.

Complete illustrative command template file

MARKDOWN
---
description: Review a ticket using the team checklist
---
Review ticket $ARGUMENTS.
Confirm the reported problem, available evidence, and proposed next step.
Do not change the ticket; return your findings.

For this legacy command-file example, save as .claude/commands/review-ticket.md and invoke /review-ticket T-2291. The template is fixed; T-2291 replaces $ARGUMENTS for this invocation. The release version uses the same pattern with an environment argument. Current skills can also provide explicit commands.

Which omitted settings use defaults or leave features unconfigured?

Check your understanding · explain the design in your own words

How should a user repeatedly invoke a fixed prompt while changing one input?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Claude Code mechanisms and examples

Study: workflows vs agents Slash command Subagent Skill Hook Domain 2 · Claude Code

Return to Q11's situation and clause-by-clause explanation

Q12. Claude Code in CI must run tests while network access and pushing are blocked. Enforce via: A) Narrow tool permissions, restricted credentials, and a network sandbox/egress policy, with hooks for additional checks B) --dangerously-skip-permissions C) Trusting the model D) Prompt instructions

Understand Q12 · the situation and each part of the question

The real situation behind this question

A CI agent must run useful tests but must not be able to publish changes or contact arbitrary destinations. Shell access complicates this: an allowed command might launch another process that uses the network. The design therefore needs controls at the actual execution and credential boundaries. This question asks how to permit a bounded job without confusing a polite instruction with an enforced restriction.

Read the question in parts

Part 1 · approved work

The agent still needs enough access to perform the CI task; denying everything is not a useful design.

Part 2 · no unrestricted network or push

Restrictions must apply even if the model proposes a command or script that would otherwise perform those actions.

What you are being asked to decide

How can CI run approved work without giving scripts unrestricted network or push access? Enforce restrictions outside model-generated text.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
CICI: automated checks/actions on a runner, whose files and credentials differ from your laptop.
Egress control (outbound network allowlist)Outbound communication from an application or network.

Example: egress Study: settings precedence Allowlist Hook Domain 2 · Claude Code

Understand Q12's answer · full reasoning and worked examples
Claude synthesized · the point, straight

"Blocked" means impossible, not discouraged. Prompt instructions and trusting the model only ask nicely, and skipping permissions removes the last check. Denying curl alone isn't enough either, because any allowed script can open the network. So enforce it in the environment: narrow tool permissions, restricted credentials, and a real network sandbox or egress policy, with hooks as extra checks.

Connect the design to the situation

The runner can execute tests, but network rules and restricted credentials prevent publishing.

Best answer: A. Use restricted tool permissions together with an actual network sandbox or egress policy. A deny pattern for curl or git push alone is insufficient because allowed scripts can also access the network. Keep the runner credentials narrowly scoped.

What each choice would do here

A · Why this meets the requirement

Narrow tool permissions, restricted credentials, and a network sandbox/egress policy, with hooks for additional checks

Permissions, credential restrictions, and actual egress enforcement work together.

Combine narrow tool permissions with credentials that lack publishing rights and an enforced egress boundary. Hooks can add checks, but credentials and execution isolation must carry the restrictions they are responsible for.

B · Why this does not meet the full requirement

--dangerously-skip-permissions

Skipping permissions removes a control instead of enforcing it.

Bypassing permission checks may make unattended execution easier, but it removes the very decision point the question needs. Convenience does not establish a replacement boundary.

C · Why this does not meet the full requirement

Trusting the model

Trust is not an executable restriction.

The model may usually follow policy, but a security requirement must hold when it makes a mistake or reads malicious input. Trust alone provides no mechanism for blocking a prohibited network connection.

D · Why this does not meet the full requirement

Prompt instructions

Prompt text cannot stop an allowed script from making a network request.

A prompt can describe the allowed workflow. It cannot revoke a process's network route or a credential's push permission once an allowed execution path has those capabilities.

Check your understanding · explain the design in your own words

How can CI run approved work without giving scripts unrestricted network or push access?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Claude Code mechanisms and examples

Example: egress Study: settings precedence Allowlist Hook Domain 2 · Claude Code

Return to Q12's situation and clause-by-clause explanation

Q13. Code review keeps bloating the main session's context. The canonical fix: A) /compact more often B) A read-only reviewer subagent with its own context window C) A bigger model D) Shorter diffs

Understand Q13 · the situation and each part of the question

The real situation behind this question

A code review may require inspecting many files and exploring several possible problems before finding a few useful issues. If all that exploration happens in the main conversation, later work must carry the review's intermediate detail. The desired result is a concise review report while keeping the detailed investigation elsewhere. The question asks for context isolation, not simply fewer words in the final response.

Read the question in parts

Part 1 · read-only reviewer

The reviewer needs to inspect and report, not modify the code being reviewed.

Part 2 · own context window

The investigation's intermediate material lives separately; the parent receives the findings it needs.

What you are being asked to decide

How can detailed code-review exploration avoid filling the main conversation? Isolate detailed exploration from the main task's context.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
Context windowThe model's limit on the information and generation it can process in one call.
SubagentA worker assigned a scoped task with its own context and configured tools.

Study: workflows vs agents Context window Subagent Domain 2 · Claude Code

Understand Q13's answer · full reasoning and worked examples
Claude synthesized · the point, straight

Review bloats the main context because reading diffs and exploring files dumps thousands of tokens into it. Compacting more often or shrinking diffs only slows the leak. So give review its own context: a read-only reviewer subagent does the exploring and returns just its findings to the main session.

Connect the design to the situation

A reviewer examines a diff in its own context and returns five actionable findings.

Best answer: B. A reviewer subagent receives a scoped task and returns concise findings. Its separate context keeps detailed exploration out of the main conversation. Restrict its tools if it should not modify files.

What each choice would do here

A · Why this does not meet the full requirement

/compact more often

Compaction may help, but repeatedly compressing the main session does not isolate review work.

Compacting the main conversation can reduce its size, but it still first accumulates the review material there. Summarization may also discard other useful main-task context along with review detail.

B · Why this meets the requirement

A read-only reviewer subagent with its own context window

A scoped reviewer returns concise findings while keeping exploration separate.

Give a reviewer a scoped task and read-only capabilities. Ask it to return actionable findings with file locations so the main conversation can act without importing the complete exploration transcript.

C · Why this does not meet the full requirement

A bigger model

A bigger model/window postpones the same accumulation issue.

More capacity postpones the point where accumulated material becomes a problem. It does not establish a separate workspace for the review or reduce the information carried into unrelated work.

D · Why this does not meet the full requirement

Shorter diffs

Diff size may be necessary for the review and is not the main context-isolation mechanism.

A small diff is easier to review, but the actual change may necessarily be large. Reducing the requested review scope could miss defects instead of solving how the investigation context is managed.

Check your understanding · explain the design in your own words

How can detailed code-review exploration avoid filling the main conversation?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Claude Code mechanisms and examples

Study: workflows vs agents Context window Subagent Domain 2 · Claude Code

Return to Q13's situation and clause-by-clause explanation

Q14. In CI, which gate may be blocking? A) Deterministic checks (tests, lint) — with AI review as advisory comments B) Claude's subjective code-quality opinion C) Nothing D) Any AI output

Understand Q14 · the situation and each part of the question

The real situation behind this question

A team wants automated checks to decide whether a change may merge. A failing test or a reproducible lint violation has an explicit rule and evidence that reviewers can inspect. An AI review may also be valuable, but subjective style judgments can vary. Under the stated policy, the question asks which results have a sufficiently clear pass/fail contract to block the merge automatically.

Read the question in parts

Part 1 · block a merge

This is an enforcement decision with a defined acceptance criterion, not simply information posted for a reviewer.

Part 2 · AI review as advisory

The AI can identify concerns without every generated opinion automatically stopping delivery.

What you are being asked to decide

Under this CI policy, which checks can reliably block a merge? Choose reliable blocking conditions for a CI policy.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
CICI: automated checks/actions on a runner, whose files and credentials differ from your laptop.
DeterministicA computation gives the same result for the same complete inputs and state under the same rules.

Study: harness controls Deterministic Domain 2 · Claude Code

Understand Q14's answer · full reasoning and worked examples
Claude synthesized · the point, straight

A gate that blocks a merge must be reproducible: same code, same verdict, every run. Tests and lint are; a model's opinion on code quality is not, and it can't be appealed the same way. So only deterministic checks block, and AI review lands as advisory comments a human weighs.

Connect the design to the situation

A failed unit test blocks merging; a subjective AI style suggestion becomes a review comment.

Best answer: A. In this proposed policy, tests and lint provide reproducible blocking conditions; subjective AI review supplies advisory findings. Organizations may choose other reviewed policies, but an unvalidated model opinion should not automatically become a reliable gate. Define failure behavior explicitly.

What each choice would do here

A · Why this meets the requirement

Deterministic checks (tests, lint) — with AI review as advisory comments

Reproducible tests/lint fit the described blocking policy.

Use the deterministic checks to enforce agreed rules and attach AI findings for human consideration. A failing test should still be investigated, but its result is tied to a specified executable check.

B · Why this does not meet the full requirement

Claude's subjective code-quality opinion

An unvalidated subjective judgment is not a reliable automatic gate.

A quality opinion may be useful evidence, yet the team has not established that it is sufficiently reliable or objective to be a hard gate. Turning it into policy needs separate validation.

C · Why this does not meet the full requirement

Nothing

Blocking checks are useful; removing every gate defeats the policy.

Removing all blocking checks would allow known test failures through. The presence of uncertainty in AI review does not make reproducible engineering checks unnecessary.

D · Why this does not meet the full requirement

Any AI output

Not every AI output has sufficient reliability to block a merge.

AI output can include suggestions, uncertainty, and unsupported claims. Treating every generated statement as a merge blocker gives the model more authority than the described policy supports.

Check your understanding · explain the design in your own words

Under this CI policy, which checks can reliably block a merge?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Claude Code mechanisms and examples

Study: harness controls Deterministic Domain 2 · Claude Code

Return to Q14's situation and clause-by-clause explanation

Q41. A developer on a shared repo wants her Claude Code sessions in this one project to run claude-haiku for cheap bulk edits — but the override must never reach teammates through git. A) Put "model": "claude-haiku-4-5" in <repo>/.claude/settings.json B) Put "model": "claude-haiku-4-5" in <repo>/.claude/settings.local.json C) Add "prefer haiku for this repo" to the project CLAUDE.md D) Put the model key into the enterprise managed policy file

Understand Q41 · the situation and each part of the question

The real situation behind this question

One developer wants a different model for work in a particular repository, but does not want to change the team's default or their preferences in other projects. That requires two boundaries at once: project scope and personal scope. The question is about an actual configuration value, not an instruction asking the assistant to prefer a model. Think about which file exists only for that person's checkout and which files travel to everyone through git.

Read the question in parts

Part 1 · one developer

The preference should not become a shared team setting.

Part 2 · project-only

A home-wide setting would affect other repositories, so the override belongs to this checkout.

Part 3 · Runtime scope: CLAUDE.md

This question assumes the Claude Code configuration environment. Its instruction-file conventions do not automatically apply to a custom messages.create loop. Production can use either runtime, so identify the named runtime rather than assuming all deployed agents ignore files.

What you are being asked to decide

Where can one developer set a project-only preference without committing it for teammates? Keep a personal preference out of shared project configuration.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
CLAUDE.md (memory file)A Markdown instruction file read as context by Claude Code.
Enterprise managed policy (managed settings)Configuration deployed by an organization to impose product settings and restrictions.

Study: the memory hierarchy CLAUDE.md — the memory layers (and the exam-speak decoder) settings precedence — cascade + clamp, layer by layer Enterprise managed policy Domain 2 · Claude Code

Understand Q41's answer · full reasoning and worked examples
Claude synthesized · the point, straight

The override has to be both project-scoped and personal, and "never reach teammates through git" is the decisive constraint. Anything in the shared .claude/settings.json or the project CLAUDE.md is committed, so it travels; managed policy is org-wide, the opposite of personal. So the model key belongs in the project's settings.local.json, the per-checkout file that stays out of version control.

Connect the design to the situation

Her local settings choose a model for this checkout; collaborators keep their own defaults.

Best answer: B. A project-local settings.local.json is intended for personal configuration in that project. Confirm it is excluded from version control. Shared project settings and managed policy affect a different scope.

What each choice would do here

A · Why this does not meet the full requirement

Put "model": "claude-haiku-4-5" in <repo>/.claude/settings.json

Shared settings are committed and affect teammates.

The shared project settings file is appropriate for a team decision. Committing a personal model preference there would distribute it to teammates, which violates the requested scope.

B · Why this meets the requirement

Put "model": "claude-haiku-4-5" in <repo>/.claude/settings.local.json

settings.local.json is the intended per-project personal override; ensure it is not committed.

The local project settings file provides the intended personal override. Keep it out of version control so a new teammate receives shared policy without inheriting this individual's choice.

C · Why this does not meet the full requirement

Add "prefer haiku for this repo" to the project CLAUDE.md

A prose preference is not the model-selection configuration field.

Instruction prose can describe a preference but is not equivalent to setting the client's model configuration. It also risks putting personal guidance in a file intended for the team.

D · Why this does not meet the full requirement

Put the model key into the enterprise managed policy file

Managed organization policy is not a personal project preference.

Managed policy belongs to organization administration and can constrain many users. It is the wrong authority and scope for a developer's optional preference in one project.

Walk through complete payloads or code · every step explained

Illustrative examples, not recorded live calls. Check each block's direction and endpoint: API requests, API responses, MCP messages, and configuration files are different contracts.

Complete local settings file for the stated preference

JSON
{
  "model": "claude-haiku-4-5"
}

This is .claude/settings.local.json configuration, not an API body. Keep it uncommitted. The same key in a shared or managed file would have a different scope.

Which omitted settings use defaults or leave features unconfigured?

Check your understanding · explain the design in your own words

Where can one developer set a project-only preference without committing it for teammates?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Claude Code mechanisms and examples Which runtime reads CLAUDE.md? Guidance versus enforcement

Study: the memory hierarchy CLAUDE.md — the memory layers (and the exam-speak decoder) settings precedence — cascade + clamp, layer by layer Enterprise managed policy Domain 2 · Claude Code

Return to Q41's situation and clause-by-clause explanation

Q42. Mid-session, nobody typed /go-live, yet the go-live skill's checklist loaded and the ship procedure ran. Which statement names who chose and who executed — exactly? A) The user chose it; Claude Code executed it B) The model chose it; the model executed it C) Nobody chose it; the harness fired it on a lifecycle event D) The model chose it; Claude Code executed it

Understand Q42 · the situation and each part of the question

The real situation behind this question

A user asks for a task without naming a skill. The model recognizes that an available skill's description matches the task, and Claude Code loads the relevant instructions and carries out permitted operations. The question separates selection from execution. Saying the model chose a skill does not mean that model inference itself executes Python, shell commands, or file operations.

Read the question in parts

Part 1 · without typing its name

The user did not explicitly invoke the skill in this scenario.

Part 2 · who runs the operations

The host provides execution capabilities and applies permissions after the model chooses or requests work.

What you are being asked to decide

When a relevant skill loads without the user typing its name, who selected it and who runs its operations? Separate choosing a procedure from executing its operations.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
skillSkill: reusable instructions and optional resources/scripts loaded by a compatible host.
Claude CodeAnthropic's coding-agent application and runtime.
HarnessThe application code around the model call. It prepares context, handles results, checks policy, and runs tools.

Study: skills vs slash vs subagents Slash command Frontmatter Harness Skill Domain 2 · Claude Code

Understand Q42's answer · full reasoning and worked examples
Claude synthesized · the point, straight

Nobody typed the command, so the user didn't choose it; and it wasn't a hook, because nothing fired on a lifecycle event. What actually happened is the model read the skill's description, judged it relevant, and selected it — but the model only generates text and tool calls. Claude Code, the harness, loaded the skill and ran the shell steps under its permission gates. Choice: model. Execution: harness.

Connect the design to the situation

The model recognizes a release task; the host loads the skill and executes allowed tool calls.

Best answer: D. In this scenario the model selected a relevant skill and Claude Code performed the runtime actions. Selection does not itself authorize deployment: execution still needs the applicable permissions. A hook would be an event-triggered mechanism instead.

What each choice would do here

A · Why this does not meet the full requirement

The user chose it; Claude Code executed it

No explicit user invocation occurred in this scenario.

Explicit user invocation is a valid way to use a skill, but it is not what happened here. The clue is that relevance was recognized without a named command.

B · Why this does not meet the full requirement

The model chose it; the model executed it

The model generates instructions/calls; it does not itself execute shell code.

The model can choose a capability and generate the next request. Actual script execution occurs in the host's execution environment, not inside the model's token-generation computation.

C · Why this does not meet the full requirement

Nobody chose it; the harness fired it on a lifecycle event

A lifecycle hook would be event-triggered; that is not the skill-selection scenario.

A hook is triggered by a configured lifecycle event. Skill selection based on task meaning is different from deterministic dispatch after an event such as editing a file.

D · Why this meets the requirement

The model chose it; Claude Code executed it

The model can select the skill; the host handles loading and permitted execution.

The model identifies the skill as useful; the host loads it and performs permitted tool operations. Keep those two responsibilities separate when explaining the architecture in an interview.

Walk through complete payloads or code · every step explained

Illustrative examples, not recorded live calls. Check each block's direction and endpoint: API requests, API responses, MCP messages, and configuration files are different contracts.

Complete illustrative skill instruction file

MARKDOWN
---
name: review-diff
description: Review a code diff and report actionable correctness issues.
context: fork
agent: Explore
---
Inspect the relevant diff and surrounding code without making changes.
Return each finding with its file location, evidence, and practical impact.

This is a SKILL.md file, not a Messages API body. name identifies the skill; description advertises when it is relevant; context: fork requests isolated subagent context; agent chooses the host agent type. The body supplies instructions. Removing context/agent changes this example to ordinary inline loading; model selection and host execution remain separate responsibilities.

Which omitted settings use defaults or leave features unconfigured?

Check your understanding · explain the design in your own words

When a relevant skill loads without the user typing its name, who selected it and who runs its operations?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Claude Code mechanisms and examples

Study: skills vs slash vs subagents Slash command Frontmatter Harness Skill Domain 2 · Claude Code

Return to Q42's situation and clause-by-clause explanation

Q43. The team re-types the same 20-line release-checklist prompt several times a week, varying only the target environment. Every option below can deliver that text into a session — which is the guidance choice? A) A slash command at .claude/commands/release.md using $ARGUMENTS for the environment B) A skill whose description matches "release" so the model loads it C) Paste the checklist into the project CLAUDE.md so it is always present D) A subagent whose system prompt is the checklist

Understand Q43 · the situation and each part of the question

The real situation behind this question

A release team uses the same checklist for staging and production. They want an engineer to deliberately start that procedure and specify the environment each time. The reusable content should not need to be pasted into every conversation. The question asks for a task invocation interface with a parameter, rather than an always-loaded instruction or a separate reasoning process.

Read the question in parts

Part 1 · explicitly reuse

The engineer controls when the checklist begins, rather than relying only on automatic relevance selection.

Part 2 · target environment

The procedure is stable, but staging or production is a changing argument that must be supplied clearly.

Part 3 · Runtime scope: CLAUDE.md

This question assumes the Claude Code configuration environment. Its instruction-file conventions do not automatically apply to a custom messages.create loop. Production can use either runtime, so identify the named runtime rather than assuming all deployed agents ignore files.

What you are being asked to decide

How should a team explicitly reuse a checklist while choosing its target environment? Reuse a parameterized procedure through a clear invocation interface.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
CLAUDE.md (memory file)A Markdown instruction file read as context by Claude Code.
Slash commandA named invocation that expands or runs a configured command or prompt procedure.
System prompt — the application’s standing instructionsYour application supplies the system prompt in the API request’s system field. It defines Claude’s general job and rules. The user message supplies the current task. Your code, not an application user’s claim, decides what belongs in the system field.
SubagentA worker assigned a scoped task with its own context and configured tools.
Skill (Claude Code)A reusable set of task instructions, normally described in SKILL.md with optional scripts and resources.

Study: the memory hierarchy CLAUDE.md — the memory layers (and the exam-speak decoder) Slash command System prompt Subagent Domain 2 · Claude Code

Understand Q43's answer · full reasoning and worked examples
Claude synthesized · the point, straight

The decisive facts are explicit, repeated, and parameterized only by environment. That is exactly a slash command with $ARGUMENTS: the user decides when it runs and passes the environment. A model-matched skill leaves the trigger and the parameter implicit, twenty lines in CLAUDE.md tax every unrelated session, and a subagent is overkill for a template.

Connect the design to the situation

A user invokes a release checklist with staging as its argument.

Best answer: A. An explicitly invoked parameterized procedure fits a slash command. Skills can also expose user-invoked procedures in current Claude Code. Avoid loading a large occasional checklist into every session's permanent context.

What each choice would do here

A · Why this meets the requirement

A slash command at .claude/commands/release.md using $ARGUMENTS for the environment

An explicit parameterized invocation matches the user-controlled repeated task; current skills can also expose this interface.

The command packages the checklist and substitutes the environment argument. A current skill-provided command can offer the same pattern; the essential feature is explicit, parameterized invocation.

B · Why this does not meet the full requirement

A skill whose description matches "release" so the model loads it

Automatic matching alone is less explicit about when to run and which environment to pass.

A skill may contain the checklist, but automatic matching alone does not express the desired invocation contract. It should expose or accept the explicit target when used for this requirement.

C · Why this does not meet the full requirement

Paste the checklist into the project CLAUDE.md so it is always present

Always-loaded project memory adds this task-specific checklist to unrelated work.

Always-loaded project memory would bring release-specific detail into unrelated tasks. It also does not provide a clear per-invocation environment argument in the way the question requests.

D · Why this does not meet the full requirement

A subagent whose system prompt is the checklist

A separate agent is unnecessary merely to reuse a short template.

A subagent can isolate substantial release analysis, but a separate context is not necessary just to run the same checklist with a different environment name.

Walk through complete payloads or code · every step explained

Illustrative examples, not recorded live calls. Check each block's direction and endpoint: API requests, API responses, MCP messages, and configuration files are different contracts.

Complete illustrative command template file

MARKDOWN
---
description: Review a ticket using the team checklist
---
Review ticket $ARGUMENTS.
Confirm the reported problem, available evidence, and proposed next step.
Do not change the ticket; return your findings.

For this legacy command-file example, save as .claude/commands/review-ticket.md and invoke /review-ticket T-2291. The template is fixed; T-2291 replaces $ARGUMENTS for this invocation. The release version uses the same pattern with an environment argument. Current skills can also provide explicit commands.

Which omitted settings use defaults or leave features unconfigured?

Check your understanding · explain the design in your own words

How should a team explicitly reuse a checklist while choosing its target environment?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Claude Code mechanisms and examples Which runtime reads CLAUDE.md? Guidance versus enforcement

Study: the memory hierarchy CLAUDE.md — the memory layers (and the exam-speak decoder) Slash command System prompt Subagent Domain 2 · Claude Code

Return to Q43's situation and clause-by-clause explanation

Q44. Reviewers keep merging unformatted generated code. Each option below can produce formatted output — which one automatically runs after matching Write/Edit operations? A) Add "always run prettier after edits" to the project CLAUDE.md B) A skill the model loads when formatting seems relevant C) A PostToolUse hook matching Write|Edit that runs prettier on the written file D) A slash command /format that authors run before pushing

Understand Q44 · the situation and each part of the question

The real situation behind this question

The team wants files formatted automatically after the assistant changes them using Write or Edit. An instruction saying always format is easy to understand, but understanding is not the same as executing a command after every relevant event. This question asks for the event mechanism that causes the follow-up action, while recognizing that edits made outside those tools still need other checks.

Read the question in parts

Part 1 · automatically

No additional user command or model decision should be required after the matching edit.

Part 2 · Write or Edit

The requirement names the specific lifecycle events to match, rather than all possible filesystem changes.

Part 3 · Runtime scope: CLAUDE.md

This question assumes the Claude Code configuration environment. Its instruction-file conventions do not automatically apply to a custom messages.create loop. Production can use either runtime, so identify the named runtime rather than assuming all deployed agents ignore files.

What you are being asked to decide

Which mechanism automatically formats files after the specified edit events? Automate formatting at the correct event boundary.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
CLAUDE.md (memory file)A Markdown instruction file read as context by Claude Code.
Slash commandA named invocation that expands or runs a configured command or prompt procedure.
Skill (Claude Code)A reusable set of task instructions, normally described in SKILL.md with optional scripts and resources.
Hook (Claude Code)A configured handler that runs when a lifecycle event occurs.

Study: the memory hierarchy CLAUDE.md — the memory layers (and the exam-speak decoder) Slash command Deterministic Harness Domain 2 · Claude Code

Understand Q44's answer · full reasoning and worked examples
Claude synthesized · the point, straight

The requirement is "automatically, after every matching Write/Edit" — that is an event, not a judgment. A CLAUDE.md line or a skill depends on the model remembering; a /format command depends on the author remembering. Only a PostToolUse hook matched on Write|Edit is bound to the event itself, so the formatter runs every time, whether anyone thought of it or not.

Connect the design to the situation

A matching edit hook invokes Prettier; CI catches unformatted changes from other paths.

Best answer: C. A matching post-edit hook can run formatting regardless of whether the model remembers to request it. Check formatter failures and back it with CI validation. A manual command or written reminder alone does not run after every matching event.

What each choice would do here

A · Why this does not meet the full requirement

Add "always run prettier after edits" to the project CLAUDE.md

Instructions depend on model compliance.

The model may comply with this instruction most of the time, but the text does not register an event handler. Missing the formatting step remains possible on a particular edit.

B · Why this does not meet the full requirement

A skill the model loads when formatting seems relevant

A relevant skill need not run after every edit.

A skill is useful when formatting is selected as a task. It is not inherently guaranteed to run after each Write/Edit operation simply because formatting seems relevant.

C · Why this meets the requirement

A PostToolUse hook matching Write|Edit that runs prettier on the written file

The hook binds the formatter to the edit event; handle command failures and keep CI checks.

The post-tool hook associates those events with the formatter command. Ensure the command handles the target file correctly and reports failures; CI remains important for changes from other paths.

D · Why this does not meet the full requirement

A slash command /format that authors run before pushing

A manual command can be forgotten, so it is not the automatic event mechanism.

A manual format command can be part of a useful workflow, but it can be forgotten. That does not meet the specified requirement for automatic execution after each matching event.

Walk through complete payloads or code · every step explained

Illustrative examples, not recorded live calls. Check each block's direction and endpoint: API requests, API responses, MCP messages, and configuration files are different contracts.

Complete minimal hook settings file

JSON
{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Write|Edit",
        "hooks": [
          {
            "type": "command",
            "command": "python3 .claude/hooks/format_changed_file.py"
          }
        ]
      }
    ]
  }
}

Place in the appropriate Claude Code settings file. This is host configuration, not a Messages API request. PostToolUse names the event, matcher restricts which tools trigger it, and the command hook launches the script.

Complete illustrative formatter handler

PYTHON
# .claude/hooks/format_changed_file.py
# Illustrative formatter hook. Requires prettier in the project's node_modules.
import json
from pathlib import Path
import subprocess
import sys

payload = json.load(sys.stdin)
project = Path(payload["cwd"]).resolve()
raw = Path(payload["tool_input"]["file_path"])
file = (raw if raw.is_absolute() else project / raw).resolve()
if not file.is_relative_to(project):
    raise ValueError("Changed file is outside this project")
if file.suffix in {".js", ".jsx", ".ts", ".tsx", ".json", ".css"}:
    subprocess.run([str(project / "node_modules/.bin/prettier"), "--write", str(file)], check=True, cwd=project)

The host supplies event JSON on stdin. The handler reads the changed file path and calls a project-installed formatter without constructing a shell command from that path. It checks location and a small extension list; it does not cover every editor or formatter setup. A failing formatter must be visible, and CI still checks the repository.

Which omitted settings use defaults or leave features unconfigured?

Check your understanding · explain the design in your own words

Which mechanism automatically formats files after the specified edit events?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Claude Code mechanisms and examples Official hook configuration and event fields Which runtime reads CLAUDE.md? Guidance versus enforcement

Study: the memory hierarchy CLAUDE.md — the memory layers (and the exam-speak decoder) Slash command Deterministic Harness Domain 2 · Claude Code

Return to Q44's situation and clause-by-clause explanation

Q45. The model key is set in user settings, shared project settings.json, settings.local.json, and a CLI flag, while the managed policy pins permissions. For settings keys, what is the precedence chain, strongest first? A) project settings > settings.local.json > CLI flags > user settings > managed policy B) CLI flags > managed policy > settings.local.json > project settings > user settings C) managed policy > settings.local.json > CLI flags > project settings > user settings D) managed policy > CLI flags > settings.local.json > project settings > user settings

Understand Q45 · the situation and each part of the question

The real situation behind this question

An organization, a developer, and a repository can each supply configuration. If two sources set the same key, the client needs a defined priority order. The question is about resolving that conflict, not about loading all instruction text into context. Imagine a managed restriction, a command-line choice, and a local project value all trying to control one setting; only the applicable higher-priority value wins for that key.

Read the question in parts

Part 1 · settings precedence

Compare configuration values for the same setting, rather than treating every source as an independent instruction paragraph.

Part 2 · managed policy

An organization's applicable policy cannot be bypassed merely by adding a command-line override.

What you are being asked to decide

How do conflicting configuration settings resolve across scopes? Resolve applicable settings according to their precedence.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
precedencePrecedence: which setting wins when multiple sources set the same applicable key.
managedManaged policy: organization-controlled settings/restrictions with higher priority where applicable.

Study: settings precedence settings precedence — cascade + clamp, layer by layer Enterprise managed policy Domain 2 · Claude Code

Understand Q45's answer · full reasoning and worked examples
Claude synthesized · the point, straight

For a single-valued settings key the chain is managed policy > CLI flags > settings.local.json > shared project settings.json > user settings. The trap is putting CLI flags above managed policy — an org policy is never overridden by a flag. Note the managed policy here only pins permissions, so it says nothing about model; for that key the CLI flag wins.

Connect the design to the situation

An organization restriction cannot be bypassed by a developer's lower-priority setting.

Best answer: D. Use the documented settings precedence for competing scalar values: managed, CLI, local project, shared project, then user. Managed settings only affect keys they configure, and collection/permission merge rules need separate attention. This is not the merge model for CLAUDE.md prose.

What each choice would do here

A · Why this does not meet the full requirement

project settings > settings.local.json > CLI flags > user settings > managed policy

This incorrectly puts shared project settings above stronger sources.

This order wrongly elevates shared project values over stronger sources. It would let a repository override controls or explicit choices that the stated precedence gives higher authority.

B · Why this does not meet the full requirement

CLI flags > managed policy > settings.local.json > project settings > user settings

CLI flags do not override applicable managed policy.

Command-line flags can override ordinary lower-level configuration, but they do not outrank applicable managed policy. The first two positions therefore violate the authority boundary being tested.

C · Why this does not meet the full requirement

managed policy > settings.local.json > CLI flags > project settings > user settings

CLI flags precede local project settings, so these middle entries are reversed.

This is close, but it reverses the relationship between an explicit command-line value and the local project file. The question tests the whole order, not just which source comes first.

D · Why this meets the requirement

managed policy > CLI flags > settings.local.json > project settings > user settings

This is the stated settings precedence; a policy governing one key does not invent a value for another key.

Apply the priority per conflicting key. A managed value for one setting does not erase unrelated lower-level settings; distinguish conflict resolution from deleting all lower-level configuration.

Check your understanding · explain the design in your own words

How do conflicting configuration settings resolve across scopes?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Claude Code mechanisms and examples

Study: settings precedence settings precedence — cascade + clamp, layer by layer Enterprise managed policy Domain 2 · Claude Code

Return to Q45's situation and clause-by-clause explanation

Q46. A session opens at the root of a monorepo carrying an enterprise CLAUDE.md, a user CLAUDE.md, a project CLAUDE.md, a nested packages/api/CLAUDE.md, and .claude/rules/terraform.md with paths: ["terraform/**/*"] frontmatter. What is in context at session start? A) Enterprise + user + project memory all load together as a union; the nested file and the paths-scoped rule join only when work touches their subtree or matching files B) Only the project CLAUDE.md — the most specific memory file overrides the rest C) All five files — memory always loads in full at session start D) Only the enterprise file — the top layer overrides everything beneath it

Understand Q46 · the situation and each part of the question

The real situation behind this question

A project has general instructions plus additional guidance for a specific subtree and a rule limited to matching paths. Loading every specialized instruction into every task would create unnecessary context, while ignoring general guidance would lose shared conventions. The question asks how broad and conditional instruction layers combine as work moves through the repository. It is not the same winner-takes-all problem as conflicting configuration values.

Read the question in parts

Part 1 · general layers combine

Applicable organization, user, and project guidance can contribute together instead of selecting only one file.

Part 2 · nested or path-scoped

Specialized instructions become relevant when the work reaches their directory or matches their path conditions.

Part 3 · Runtime scope: CLAUDE.md

This question assumes the Claude Code configuration environment. Its instruction-file conventions do not automatically apply to a custom messages.create loop. Production can use either runtime, so identify the named runtime rather than assuming all deployed agents ignore files.

What you are being asked to decide

Which instruction files apply immediately, and which wait until relevant files are used? Distinguish combined instruction context from configuration overrides.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
frontmatterFrontmatter: the configuration header at the beginning of a skill or rule file.
CLAUDE.mdCLAUDE.md: a file of instructions; it is not an executable permission gate.

Example: CLAUDE.md Study: the memory hierarchy CLAUDE.md — the memory layers (and the exam-speak decoder) Frontmatter Domain 2 · Claude Code

Understand Q46's answer · full reasoning and worked examples
Claude synthesized · the point, straight

You need to see that memory loads in two tiers. The enterprise, user, and project CLAUDE.md files all load at startup as a union — nothing overrides anything. The nested packages/api/CLAUDE.md and the paths-scoped rule load lazily, only when work touches their subtree or matching files. So a design that loads everything up front, or lets one file win, misreads how memory works.

Connect the design to the situation

Root instructions load first; API-specific instructions join when work enters that part of the repo.

Best answer: A. Broad instruction files load at startup for the working directory. Nested files and path-scoped rules load when the documented file-reading conditions apply. They add context; they are not a machine-enforced last-file-wins settings map.

What each choice would do here

A · Why this meets the requirement

Enterprise + user + project memory all load together as a union; the nested file and the paths-scoped rule join only when work touches their subtree or matching files

General instruction layers combine; nested/path-scoped guidance loads when its conditions apply.

The general layers form the broad context, and conditional rules join when their scope applies. This keeps the model informed about the current work without eagerly loading every unrelated subtree rule.

B · Why this does not meet the full requirement

Only the project CLAUDE.md — the most specific memory file overrides the rest

Instruction files are not a winner-takes-all settings override system.

A project instruction file does not simply replace all broader instructions. That would discard applicable organization and user guidance instead of combining the relevant layers.

C · Why this does not meet the full requirement

All five files — memory always loads in full at session start

Loading every nested instruction eagerly defeats path-scoped loading.

Eagerly loading every specialized rule would defeat the point of scoped instruction loading. The scenario explicitly distinguishes instructions relevant now from those needed only for certain files.

D · Why this does not meet the full requirement

Only the enterprise file — the top layer overrides everything beneath it

Organization instructions do not automatically erase all other instruction text.

Organization guidance can constrain other instructions, but its presence does not mean all project-specific conventions disappear. Think in terms of applicable instructions and conflict authority, not one surviving file.

Check your understanding · explain the design in your own words

Which instruction files apply immediately, and which wait until relevant files are used?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Claude Code mechanisms and examples Which runtime reads CLAUDE.md? Guidance versus enforcement

Example: CLAUDE.md Study: the memory hierarchy CLAUDE.md — the memory layers (and the exam-speak decoder) Frontmatter Domain 2 · Claude Code

Return to Q46's situation and clause-by-clause explanation

Q47. Official docs describe skills as "model-invoked." Decoded exactly, the term means: A) the model executes the skill's bundled scripts itself, inside its own inference B) the model CHOOSES the skill by reading its frontmatter description, and Claude Code — the harness — performs the invocation C) the skill only runs when the user invokes it by typing /name D) the harness selects the skill deterministically when a lifecycle event fires

Understand Q47 · the situation and each part of the question

The real situation behind this question

The phrase model-invoked describes how a skill is selected: the model can notice that a task matches the skill's description and request its use. It does not describe where scripts run. The question exists because the word invoked can be mistaken for the model directly executing code. Separate the decision to use instructions from the host machinery that loads content and executes allowed operations.

Read the question in parts

Part 1 · frontmatter description

This is the skill's advertised purpose, which helps the model judge relevance.

Part 2 · harness performs invocation

Claude Code supplies the actual loading and execution environment, subject to its controls.

What you are being asked to decide

What does model-invoked mean when describing a skill? Interpret model-invoked as a selection decision, not code execution.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
Frontmatter — the config block machinery reads, above the contentA metadata block at the beginning of a Markdown file, between lines containing three hyphens.
Claude CodeAnthropic's coding-agent application and runtime.
HarnessThe application code around the model call. It prepares context, handles results, checks policy, and runs tools.
Skill (Claude Code)A reusable set of task instructions, normally described in SKILL.md with optional scripts and resources.

Study: skills vs slash vs subagents Frontmatter Harness Skill Hook Domain 2 · Claude Code

Understand Q47's answer · full reasoning and worked examples
Claude synthesized · the point, straight

"Model-invoked" splits into two roles. The model invokes in the sense that it reads each skill's frontmatter description and decides the skill is relevant; the harness — Claude Code — then does the actual loading and any tool execution. The model never runs bundled scripts inside inference, and this is not the deterministic, event-fired path a hook takes.

Connect the design to the situation

The model sees a skill description, decides it is relevant, and the host loads it.

Best answer: B. Model-invoked means the model can select the skill through the runtime. The runtime performs any configured invocation and tool execution. A skill can also be user-invoked when supported; it is not limited to one trigger style.

What each choice would do here

A · Why this does not meet the full requirement

the model executes the skill's bundled scripts itself, inside its own inference

Choosing instructions is different from executing bundled code inside inference.

A script still needs an execution tool and runtime. Generating tokens about using a script does not execute that script inside the model's inference process.

B · Why this meets the requirement

the model CHOOSES the skill by reading its frontmatter description, and Claude Code — the harness — performs the invocation

The model can choose relevance; the host handles the actual loading/tool execution.

The model selects based on the task and available descriptions; the host carries out the supported invocation. This is the same selection-versus-execution distinction used for ordinary tool calls.

C · Why this does not meet the full requirement

the skill only runs when the user invokes it by typing /name

Skills can also be explicitly invoked, but are not limited to that route.

A user can explicitly choose a skill, but that is not the only selection path. This option incorrectly rules out the automatic relevance-based behavior named in the question.

D · Why this does not meet the full requirement

the harness selects the skill deterministically when a lifecycle event fires

Deterministic event dispatch describes a hook rather than model-selected skill use.

An event handler can choose a command after a lifecycle event without semantic model selection. That describes hook behavior, which is a different mechanism from the skill-selection wording here.

Walk through complete payloads or code · every step explained

Illustrative examples, not recorded live calls. Check each block's direction and endpoint: API requests, API responses, MCP messages, and configuration files are different contracts.

Complete illustrative skill instruction file

MARKDOWN
---
name: review-diff
description: Review a code diff and report actionable correctness issues.
context: fork
agent: Explore
---
Inspect the relevant diff and surrounding code without making changes.
Return each finding with its file location, evidence, and practical impact.

This is a SKILL.md file, not a Messages API body. name identifies the skill; description advertises when it is relevant; context: fork requests isolated subagent context; agent chooses the host agent type. The body supplies instructions. Removing context/agent changes this example to ordinary inline loading; model selection and host execution remain separate responsibilities.

Which omitted settings use defaults or leave features unconfigured?

Check your understanding · explain the design in your own words

What does model-invoked mean when describing a skill?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Claude Code mechanisms and examples

Study: skills vs slash vs subagents Frontmatter Harness Skill Hook Domain 2 · Claude Code

Return to Q47's situation and clause-by-clause explanation

Q48. In SKILL.md frontmatter, context: fork (with an agent: key on its own line beneath it) means exactly: A) the skill clones the repository into a temporary git worktree before running B) the skill runs concurrently with the main conversation and merges its transcript back in C) the skill forks a full copy of the current session, history included, and continues both D) the skill body runs in an isolated subagent context — the named agent executes it there, so verbose output never pollutes the main conversation; omitting context loads the body inline, the default

Understand Q48 · the situation and each part of the question

The real situation behind this question

A skill can perform verbose analysis that you do not want mixed into the main conversation. The context: fork setting describes running that skill in a separate subagent context. The word fork may remind you of git or operating-system processes, but here the question concerns conversation isolation. It does not promise a repository clone, parallel execution, or a complete copy of every prior message.

Read the question in parts

Part 1 · context fork

The isolated resource is the agent's working context for this task.

Part 2 · inline default

Without the separate-context setting, skill instructions are loaded into the current conversation according to the host's behavior.

What you are being asked to decide

What does context: fork isolate when a skill runs? Separate conversation isolation from filesystem or concurrency behavior.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
skillSkill: reusable instructions and optional resources/scripts loaded by a compatible host.
frontmatterFrontmatter: the configuration header at the beginning of a skill or rule file.
SubagentA worker assigned a scoped task with its own context and configured tools.

Study: workflows vs agents Context window Frontmatter Subagent Skill Domain 2 · Claude Code

Understand Q48's answer · full reasoning and worked examples
Claude synthesized · the point, straight

context: fork is about isolation, not copying. The skill body runs in a separate subagent context, executed by the agent named on the agent: line, so its verbose output never lands in the main conversation. It is not a git worktree, not parallel-and-merge, and not a full clone of the session. Omit context and the body simply loads inline.

Connect the design to the situation

A detailed release-check task runs in a subagent context and returns its findings.

Best answer: D. context: fork requests execution in a separate subagent context. It does not mean a Git worktree or a full duplicate of every conversation detail. Pass required information and specify the expected return.

What each choice would do here

A · Why this does not meet the full requirement

the skill clones the repository into a temporary git worktree before running

Context isolation does not necessarily create a filesystem worktree.

A git worktree is a filesystem and repository arrangement. Separate model context can exist while using the same project files, so do not infer a worktree from this setting.

B · Why this does not meet the full requirement

the skill runs concurrently with the main conversation and merges its transcript back in

Fork does not promise parallel execution or merge every transcript back.

Isolation and concurrency are different properties. A separate context need not run simultaneously, and returning its result does not mean merging the complete verbose transcript into the parent.

C · Why this does not meet the full requirement

the skill forks a full copy of the current session, history included, and continues both

It is not a promise to duplicate the complete main conversation and continue both.

The setting is not a guarantee that the host duplicates every message and continues two identical conversations. Use the host's documented input and result behavior rather than the everyday meaning of fork.

D · Why this meets the requirement

the skill body runs in an isolated subagent context — the named agent executes it there, so verbose output never pollutes the main conversation; omitting context loads the body inline, the default

The skill runs in a separate agent context; verify what inputs/results the host supplies.

The host runs the skill body in the selected isolated agent context and returns the relevant outcome. This protects the main context from detailed exploration while still allowing the task result to be used.

Walk through complete payloads or code · every step explained

Illustrative examples, not recorded live calls. Check each block's direction and endpoint: API requests, API responses, MCP messages, and configuration files are different contracts.

Complete illustrative skill instruction file

MARKDOWN
---
name: review-diff
description: Review a code diff and report actionable correctness issues.
context: fork
agent: Explore
---
Inspect the relevant diff and surrounding code without making changes.
Return each finding with its file location, evidence, and practical impact.

This is a SKILL.md file, not a Messages API body. name identifies the skill; description advertises when it is relevant; context: fork requests isolated subagent context; agent chooses the host agent type. The body supplies instructions. Removing context/agent changes this example to ordinary inline loading; model selection and host execution remain separate responsibilities.

Which omitted settings use defaults or leave features unconfigured?

Check your understanding · explain the design in your own words

What does context: fork isolate when a skill runs?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Claude Code mechanisms and examples

Study: workflows vs agents Context window Frontmatter Subagent Skill Domain 2 · Claude Code

Return to Q48's situation and clause-by-clause explanation

Q49. A public repo has the @claude workflow committed and ANTHROPIC_API_KEY in secrets. Maintainers' @claude comments trigger runs, but when an outside contributor comments "@claude fix this," nothing happens at all. Root cause? A) The API key is missing from the contributor's fork B) The workflow file lacks the pull_request_review_comment event C) The Action checks the commenter's permission before running — the contributor lacks write access, the deliberate gate against drive-by prompt injection via public comments D) The pinned model version has been deprecated

Understand Q49 · the situation and each part of the question

The real situation behind this question

A repository automation responds to comments, but comments from an outside contributor do not start the same work that an authorized maintainer's comments start. Public text is an easy place for an attacker to request privileged automation. The question asks you to recognize an intentional authorization check at the trigger boundary rather than assuming the model or its API configuration is broken.

Read the question in parts

Part 1 · public comment

Anyone may be able to supply text, so the text alone should not authorize privileged execution.

Part 2 · different commenter permissions

The observed behavior follows who triggered the action, which points to an access gate before model work.

What you are being asked to decide

Why might a public comment fail to start an otherwise working automation? Recognize authorization at an automation's trigger boundary.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
workflowWorkflow: a process whose stages or branches are defined in application code.
Prompt injection — direct user attacks and hidden document instructionsPrompt injection tries to make the application follow instructions it should not trust. A direct attack comes from an application user. An indirect attack is hidden in material the application reads, such as a PDF, retrieved page, or tool result.

Study: the @claude workflow Prompt injection Workflow Headless mode Domain 2 · Claude Code

Understand Q49's answer · full reasoning and worked examples
Claude synthesized · the point, straight

The deciding fact is who commented: maintainers work, an outsider doesn't, and nothing at all runs. That pattern is a permission gate, not a missing secret or event — the Action checks the commenter's write access before it ever invokes the model. That gate is deliberate: on a public repo any comment is untrusted text, and it must not be able to spend the repo's API key.

Connect the design to the situation

Maintainers can trigger the workflow; an untrusted outside commenter cannot start it under the configured policy.

Best answer: C. Under the stated permission-gated workflow, the outside commenter lacks the configured authority to trigger the run. Check the actual action version and workflow permissions before diagnosing a real incident. Public text should not automatically gain access to repository credentials.

What each choice would do here

A · Why this does not meet the full requirement

The API key is missing from the contributor's fork

The trusted workflow's credentials are not expected to come from the commenter's fork.

The trusted workflow should not depend on borrowing a secret from an untrusted contributor's fork. The stated difference concerns trigger authorization, not where the contributor stores an API key.

B · Why this does not meet the full requirement

The workflow file lacks the pull_request_review_comment event

A missing event could matter, but the described authorization difference is the intended clue.

A missing event subscription could prevent a category of comments from triggering anything. It would not by itself explain the described distinction between authorized and unauthorized commenters on the relevant event.

C · Why this meets the requirement

The Action checks the commenter's permission before running — the contributor lacks write access, the deliberate gate against drive-by prompt injection via public comments

The action's permission policy blocks an unauthorized trigger before model work.

The automation checks the actor's permissions before allowing the request to reach privileged work. This reduces drive-by instruction attacks through public comments; it is an access policy, not a model refusal.

D · Why this does not meet the full requirement

The pinned model version has been deprecated

A deprecated model would not explain a commenter-permission distinction by itself.

A retired model would affect requests using that model regardless of which commenter supplied the text. It does not fit the permission-dependent pattern described by the question.

Check your understanding · explain the design in your own words

Why might a public comment fail to start an otherwise working automation?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Claude Code mechanisms and examples

Study: the @claude workflow Prompt injection Workflow Headless mode Domain 2 · Claude Code

Return to Q49's situation and clause-by-clause explanation

Q50. A developer's local sessions always follow her personal conventions — concise answers, vitest over jest — but headless @claude runs on GitHub ignore them completely while still honoring every rule in the repo's CLAUDE.md. Root cause? A) The Actions runner only checks out the repo — project CLAUDE.md, settings, rules, and skills load, but her ~/.claude/CLAUDE.md user layer does not exist in CI; on GitHub, the committed layers are the only voice B) Headless mode disables the memory system entirely, so any CLAUDE.md compliance is coincidental C) The enterprise managed policy strips user memory from CI runs D) Her conventions file is missing the frontmatter that marks it CI-eligible

Understand Q50 · the situation and each part of the question

The real situation behind this question

A developer's local assistant follows conventions that she placed in her home-directory instruction file. The same repository runs in a fresh CI environment and no longer follows those personal conventions. A checkout copies repository files, not the contents of her laptop's home directory. The question asks which context actually exists in the new environment before blaming the model for ignoring instructions.

Read the question in parts

Part 1 · fresh CI runner

Assume only files and configuration that the workflow explicitly provisions are present.

Part 2 · personal home instructions

These live outside the repository and are not transferred by a normal checkout.

Part 3 · Runtime scope: CLAUDE.md

This question assumes the Claude Code configuration environment. Its instruction-file conventions do not automatically apply to a custom messages.create loop. Production can use either runtime, so identify the named runtime rather than assuming all deployed agents ignore files.

What you are being asked to decide

Why do personal local instructions disappear on a fresh CI runner? Account for which instruction files exist in each environment.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
CLAUDE.mdCLAUDE.md: a file of instructions; it is not an executable permission gate.
headlessHeadless: running without the interactive terminal conversation, often in automation.
Enterprise managed policy (managed settings)Configuration deployed by an organization to impose product settings and restrictions.
Frontmatter — the config block machinery reads, above the contentA metadata block at the beginning of a Markdown file, between lines containing three hyphens.

Study: the memory hierarchy CLAUDE.md — the memory layers (and the exam-speak decoder) settings precedence — cascade + clamp, layer by layer Enterprise managed policy Frontmatter Workflow Domain 2 · Claude Code

Understand Q50's answer · full reasoning and worked examples
Claude synthesized · the point, straight

The runs honor the repo's CLAUDE.md but ignore her personal conventions. What CI has is what the workflow checked out: project memory, settings, rules, skills. Her ~/.claude/CLAUDE.md lives in her home directory, which never exists on a fresh runner. Nothing is being stripped or disabled — the user layer simply isn't there, so any convention CI must follow has to be committed.

Connect the design to the situation

The checkout contains project instructions; the runner does not contain the developer's home-directory memory.

Best answer: A. The CI runner does not automatically contain a developer's home-directory files. It sees what the workflow checks out or explicitly configures. Commit shared conventions to the appropriate project file rather than assuming personal context travels to CI.

What each choice would do here

A · Why this meets the requirement

The Actions runner only checks out the repo — project CLAUDE.md, settings, rules, and skills load, but her ~/.claude/CLAUDE.md user layer does not exist in CI; on GitHub, the committed layers are the only voice

A fresh environment only receives the instruction/configuration files actually provisioned there.

Put shared conventions in reviewed repository instructions or explicitly provision approved CI configuration. The model cannot follow a personal file that was never supplied to the runner.

B · Why this does not meet the full requirement

Headless mode disables the memory system entirely, so any CLAUDE.md compliance is coincidental

Headless operation does not disable all project memory.

Running without an interactive terminal does not imply that all instruction loading is disabled. Check which files are present before concluding that observed compliance was accidental.

C · Why this does not meet the full requirement

The enterprise managed policy strips user memory from CI runs

There is no evidence an organization policy stripped an existing file.

A managed policy could affect behavior, but the scenario does not show one deleting an existing file. The simpler established fact is that the local home file was never copied.

D · Why this does not meet the full requirement

Her conventions file is missing the frontmatter that marks it CI-eligible

A special CI-eligible frontmatter flag is not the missing mechanism here.

The missing ingredient is the instruction content in the CI environment, not a special eligibility label. Adding imaginary metadata to an absent file cannot make CI receive it.

Check your understanding · explain the design in your own words

Why do personal local instructions disappear on a fresh CI runner?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Claude Code mechanisms and examples Which runtime reads CLAUDE.md? Guidance versus enforcement

Study: the memory hierarchy CLAUDE.md — the memory layers (and the exam-speak decoder) settings precedence — cascade + clamp, layer by layer Enterprise managed policy Frontmatter Workflow Domain 2 · Claude Code

Return to Q50's situation and clause-by-clause explanation

Concept drills (25)

Source: Concept drills.

Q250. A legal-research group runs Claude Code sessions that last most of a working day. Auto-compaction regularly kicks in, and afterwards the case citations Claude gathered early on are gone from the conversation. The group wants a script that pulls every citation out of the transcript at the exact point before anything is summarised, whether a person typed the command or the context limit triggered it. On which hook event should the script be registered? A) Stop, because it fires each time Claude finishes a response and can therefore scan the transcript frequently B) SessionEnd, because it fires once the session closes and can read the complete transcript in one pass C) UserPromptSubmit, filtering for prompts whose text starts with the compaction slash command D) PreCompact with no matcher, so it runs before both manual and automatic compaction and receives the transcript path

Understand Q250 · the situation and each part of the question

The real situation behind this question

A small legal-research group uses Claude Code as a research assistant over long days of case review. Early in each session Claude collects dozens of citations while reading briefs. By mid-afternoon the context fills and Claude Code compacts the conversation on its own. The summary keeps the thread of the argument but drops many exact citation strings, which the associates then have to find again by hand. They want a reliable, automatic capture of citations at the only moment it is still possible: just before summarisation, regardless of who or what triggered it.

Read the question in parts

Part 1 · at the exact point before anything is summarised

The hook must fire before compaction runs, not after the session or on unrelated events.

Part 2 · whether a person typed the command or the context limit triggered it

Both manual and automatic compaction must be covered, so a filter on typed prompts is not enough.

What you are being asked to decide

Which hook runs right before Claude Code summarises a long conversation? Match a lifecycle moment to the hook event that fires at that moment.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
PreCompactthe hook event that runs just before the conversation is summarised, manual or automatic
auto-compactionsummarisation Claude Code triggers itself when the context window fills

Study: Hooks: deterministic control inside Claude Code hook compaction context window

Understand Q250's answer · full reasoning and worked examples
Claude synthesized · the point, straight

Compaction is not a tool call and not the end of a turn; it is its own lifecycle event. PreCompact fires before both manual and automatic compaction with the transcript path in hand, so it is the one place to capture detail that summarisation will drop.

Connect the design to the situation

An all-day research session loses early citations when auto-compaction runs.

Best answer: D. PreCompact is the lifecycle event that fires immediately before compaction, for both the manual command and the automatic trigger, and its input carries the transcript path. SessionEnd sounds complete but runs hours after the mid-session compaction has already discarded the early detail from the conversation.

What each choice would do here

A · Why this does not meet the full requirement

Stop, because it fires each time Claude finishes a response and can therefore scan the transcript frequently

Stop fires on every response, not at compaction, so it is noisy and not tied to the moment that matters.

A Stop hook would fire after every single response Claude gives, dozens of times a day. It could scan the transcript each time, but it has no idea when compaction is about to happen and produces constant redundant work.

B · Why this does not meet the full requirement

SessionEnd, because it fires once the session closes and can read the complete transcript in one pass

SessionEnd runs after the whole session, long after mid-session compaction already happened.

SessionEnd would fire once at the end of the day. By then the in-session compaction already happened, so the transcript file may still exist, but the requirement was capture at the moment before summarisation, and the running session never benefits.

C · Why this does not meet the full requirement

UserPromptSubmit, filtering for prompts whose text starts with the compaction slash command

UserPromptSubmit only sees typed prompts, so the automatic trigger is missed entirely.

A UserPromptSubmit filter catches only prompts a person types. Automatic compaction triggered by the context limit never passes through a typed prompt, so the most common case in this workflow would be silently missed.

D · Why this meets the requirement

PreCompact with no matcher, so it runs before both manual and automatic compaction and receives the transcript path

PreCompact runs right before compaction for both triggers and gets the transcript path, which is exactly the required moment.

Registering on PreCompact without a matcher covers both the manual and auto triggers. The script receives the transcript path in its input and can copy or parse the full pre-summary conversation before any detail is lost.

Walk through complete payloads or code · every step explained

Illustrative examples, not recorded live calls. Check each block's direction and endpoint: API requests, API responses, MCP messages, and configuration files are different contracts.

Register a PreCompact hook in .claude/settings.json

JSON
{
  "hooks": {
    "PreCompact": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "python3 .claude/hooks/extract_citations.py"
          }
        ]
      }
    ]
  }
}

No matcher means the hook runs for both the manual and auto triggers. The script reads the hook input on stdin, which includes transcript_path and trigger, and writes the citations to a file before summarisation.

Which omitted settings use defaults or leave features unconfigured?

Check your understanding · explain the design in your own words

Which hook runs right before Claude Code summarises a long conversation?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Study: Hooks: deterministic control inside Claude Code

Study: Hooks: deterministic control inside Claude Code hook compaction context window

Return to Q250's situation and clause-by-clause explanation

Q251. A data-science platform requires every Python file to use a 100-character line limit, and the build fails on anything else. The rule sits in the committed project CLAUDE.md. A contractor's personal instruction file says "wrap at 79 characters", and several of the contractor's sessions have produced files that failed the build. Which statement about fixing this is exactly right? A) Adding a lineLength key to the committed .claude/settings.json makes Claude Code enforce the width on every generated file B) Any CLAUDE.md level is guidance the model weighs; a PostToolUse hook on Write and Edit that runs the formatter makes the width deterministic C) Project CLAUDE.md is loaded after the personal file, so it deterministically overrides it and the failures must come from something else D) Moving the rule into an organisation-wide managed CLAUDE.md guarantees compliance because users cannot override managed instructions

Understand Q251 · the situation and each part of the question

The real situation behind this question

A data-science platform team runs a strict build that rejects Python files over 100 characters wide. The rule has lived in the project CLAUDE.md for months and most sessions respect it. A contractor joined with a personal instruction file from a previous job that says to wrap at 79. In some sessions the model follows the personal line, the resulting files fail the build, and review time is wasted. The team lead wants a fix that does not depend on which instruction the model happens to weigh more in a particular session.

Read the question in parts

Part 1 · the build fails on anything else

This is a hard requirement with a real cost, so a best-effort instruction is not an acceptable answer.

Part 2 · A contractor's personal instruction file says

Two instruction files conflict, which shows that instruction placement alone cannot decide the outcome reliably.

Part 3 · Which statement about fixing this is exactly right?

Pick the statement whose mechanism is accurate, not merely a change that might reduce failures.

What you are being asked to decide

How do you guarantee a formatting rule when instruction files disagree? Separate guidance (instruction files at any level) from enforcement (hooks that run code).

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
PostToolUsea hook that runs your command after a tool such as Write or Edit succeeds
deterministicthe formatter produces the same result regardless of what the model chose
managed CLAUDE.mdan organisation-level instruction file; still loaded as context, not executed

Study: Team instructions versus enforced rules Study: What hooks guarantee and what they do not CLAUDE.md hook deterministic

Understand Q251's answer · full reasoning and worked examples
Claude synthesized · the point, straight

Instruction files at any level, even managed ones, are context the model weighs, so a conflicting personal file can still win. When a rule must hold, move the guarantee into code that the harness runs: a PostToolUse formatter hook for Claude's writes, backed by CI for everything else.

Connect the design to the situation

A personal instruction file fights the project line-length rule and breaks the build.

Best answer: B. CLAUDE.md files at every level, including managed ones, are loaded into context as instructions, so conflicting guidance can still win in a given session. A PostToolUse hook runs the formatter as code after each Write or Edit, so the width no longer depends on which instruction the model followed. The managed-file answer is the tempting one, but it only raises the priority of advice; it does not execute anything.

What each choice would do here

A · Why this does not meet the full requirement

Adding a lineLength key to the committed .claude/settings.json makes Claude Code enforce the width on every generated file

There is no settings key that formats generated code; settings configure the runtime, not code style.

Claude Code settings hold permissions, environment variables, hooks and model choices. There is no line-length or code-style key, so this would be silently ignored while the team believes the problem is solved.

B · Why this meets the requirement

Any CLAUDE.md level is guidance the model weighs; a PostToolUse hook on Write and Edit that runs the formatter makes the width deterministic

Instruction files advise; a formatter hook after each write deterministically fixes the width for Claude's edits.

This names both halves correctly. Instruction files are guidance at every level. A PostToolUse hook matching Write and Edit runs the formatter on the changed file each time, so Claude's output is reformatted to 100 characters regardless of which instruction won; CI still covers edits made outside Claude.

C · Why this does not meet the full requirement

Project CLAUDE.md is loaded after the personal file, so it deterministically overrides it and the failures must come from something else

Load order does not turn guidance into a guarantee; conflicting instructions can still win.

This claims load order produces a deterministic override. Project and user files are both placed in context; more specific files tend to carry more weight, but the model still reads both, and the observed build failures prove the conflict is not resolved.

D · Why this does not meet the full requirement

Moving the rule into an organisation-wide managed CLAUDE.md guarantees compliance because users cannot override managed instructions

A managed instruction file is still context for the model, so priority rises but nothing is enforced.

A managed CLAUDE.md is deployed by administrators and cannot be excluded by users, but it is still text in context. It may lower the failure rate, yet the requirement is that no failing file reaches the build, which advice cannot promise.

Walk through complete payloads or code · every step explained

Illustrative examples, not recorded live calls. Check each block's direction and endpoint: API requests, API responses, MCP messages, and configuration files are different contracts.

Formatter hook registered in committed project settings

JSON
{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Write|Edit",
        "hooks": [
          {
            "type": "command",
            "command": "jq -r '.tool_input.file_path' | xargs ruff format --line-length 100"
          }
        ]
      }
    ]
  }
}

The hook reads the edited file path from the hook input and runs the formatter on it. The instruction in CLAUDE.md can stay as an explanation; the hook is what makes the rule hold.

Which omitted settings use defaults or leave features unconfigured?

Check your understanding · explain the design in your own words

How do you guarantee a formatting rule when instruction files disagree?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Study: Team instructions versus enforced rules Study: What hooks guarantee and what they do not

Study: Team instructions versus enforced rules Study: What hooks guarantee and what they do not CLAUDE.md hook deterministic

Return to Q251's situation and clause-by-clause explanation

Q252. A mobile team's CLAUDE.md says "new screens must support accessibility." Claude Code keeps producing screens where a single icon has a content description, while buttons have no labels and touch targets are too small. Tests and CI are already configured. What is the root cause of the thin results? A) The instruction names a goal but no observable criteria, so Claude meets it minimally; it needs checkable requirements that tests can verify B) The instruction must live in a .claude/rules file to become binding, since CLAUDE.md content is treated as optional background C) CLAUDE.md is only consulted for files at the repository root, so screen files in nested folders never see the instruction D) Claude Code drops CLAUDE.md after each compaction, so the instruction fades as the session grows longer

Understand Q252 · the situation and each part of the question

The real situation behind this question

A mobile team building a banking app added one line to its project instructions: new screens must support accessibility. Claude Code picks the line up in every session, and each new screen does contain some accessibility work, usually one described icon. Buttons still lack labels and several tap areas are below platform minimums. The team already has UI tests and a CI pipeline. The lead is trying to decide whether the instruction is being ignored or whether it simply never said what done looks like.

Read the question in parts

Part 1 · a single icon has a content description

Claude did act on the instruction, which points away from a loading failure and toward vague wording.

Part 2 · Tests and CI are already configured

Verification infrastructure exists, so the missing piece is criteria it can check, not new tooling.

What you are being asked to decide

Why does Claude do the bare minimum on a broad instruction? Diagnose an under-specified instruction versus a loading or enforcement problem.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
acceptance criteriaspecific, checkable outcomes a screen must meet before it counts as done
CLAUDE.mdproject instructions loaded into every session as guidance

Study: Three mechanisms, three different jobs Study: CLAUDE.md: the memory hierarchy CLAUDE.md eval

Understand Q252's answer · full reasoning and worked examples
Claude synthesized · the point, straight

If Claude acts on an instruction but only barely, the instruction lacks observable criteria. Specific, checkable requirements improve what Claude produces, and the same criteria turned into tests or CI checks are what actually confirm the requirement is met.

Connect the design to the situation

"Support accessibility" yields one labelled icon and nothing else.

Best answer: A. Claude is following the instruction, just at the lowest bar the words allow, because "support accessibility" states no testable outcome. Rewriting it as concrete checks (every interactive element labelled, minimum touch target size, an automated accessibility test per screen) gives Claude a target and gives CI something to verify. Moving the same vague sentence into a rules file changes where it loads, not how specific it is.

What each choice would do here

A · Why this meets the requirement

The instruction names a goal but no observable criteria, so Claude meets it minimally; it needs checkable requirements that tests can verify

A goal without criteria invites the minimum; specific checks plus tests fix both the output and its verification.

Rewriting the instruction as a checklist, such as labels on every interactive element, a minimum touch target, and an accessibility test per screen, gives Claude an unambiguous target. The same criteria become CI assertions, so the requirement is both clearer and verified.

B · Why this does not meet the full requirement

The instruction must live in a .claude/rules file to become binding, since CLAUDE.md content is treated as optional background

Rules files are also guidance; relocating a vague sentence does not make it specific.

A rules file without paths loads exactly like CLAUDE.md, and one with paths loads when matching files are touched. Either way it is still guidance; the vague sentence would produce the same minimal screens.

C · Why this does not meet the full requirement

CLAUDE.md is only consulted for files at the repository root, so screen files in nested folders never see the instruction

Project CLAUDE.md is loaded for the whole session, not only for root-level files.

Project CLAUDE.md at the repository root is loaded at session start and applies while Claude edits files anywhere in the tree. The screens do show partial accessibility work, which proves the instruction was read.

D · Why this does not meet the full requirement

Claude Code drops CLAUDE.md after each compaction, so the instruction fades as the session grows longer

Project CLAUDE.md is reloaded after compaction, and the problem appears in fresh sessions too.

After compaction Claude Code re-reads the project CLAUDE.md from disk, so the instruction does not fade. The thin screens also appear early in fresh sessions, which rules out a length-related cause.

Check your understanding · explain the design in your own words

Why does Claude do the bare minimum on a broad instruction?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Study: Three mechanisms, three different jobs Study: CLAUDE.md: the memory hierarchy

Study: Three mechanisms, three different jobs Study: CLAUDE.md: the memory hierarchy CLAUDE.md eval

Return to Q252's situation and clause-by-clause explanation

Q253. A game studio keeps separate standards for shader code, level data files and localisation strings. A lead put each standard in its own file under .claude/rules/ so that only the relevant one would be in context while Claude works in that area. None of the files has frontmatter. What actually happens? A) All three files load at the start of every session, so every standard is in context regardless of what is edited B) Claude Code infers the scope from each file name and loads it only for folders with a matching name C) Each file stays dormant until a CLAUDE.md imports it, so none of the three standards reaches Claude D) Claude Code refuses to start and reports that every rules file requires a paths header

Understand Q253 · the situation and each part of the question

The real situation behind this question

A game studio's repository holds engine shaders, JSON level definitions, and localisation tables, and each area has its own style guide. The lead wanted to stop loading all three guides into every Claude Code session, both to save context and to stop shader advice leaking into translation work. She moved each guide into its own file under .claude/rules/ and assumed that was enough. A week later engineers notice the localisation guidance showing up while Claude edits shader code.

Read the question in parts

Part 1 · only the relevant one would be in context

The goal is conditional loading, which requires a mechanism that decides by file path.

Part 2 · None of the files has frontmatter

Without a paths list there is nothing telling Claude Code when to load each file, so default loading applies.

What you are being asked to decide

What does a rules file do if it has no paths header? Know the exact loading behaviour of path-scoped rules versus unscoped ones.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
paths frontmattera YAML list of globs at the top of a rules file that limits when it loads
YAMLthe header format used for the paths list

Study: .claude/rules: path-scoped conventions frontmatter yaml context window

Understand Q253's answer · full reasoning and worked examples
Claude synthesized · the point, straight

Putting guidance in .claude/rules/ only scopes it when the file declares paths globs. Without that frontmatter a rules file loads every session like CLAUDE.md, so selective loading needs an explicit glob per standard.

Connect the design to the situation

Three studio standards all load in every session because nobody added paths.

Best answer: A. A rules file without paths frontmatter is loaded unconditionally at session start, with the same standing as project CLAUDE.md. To load a standard only for its area, each file needs a paths list of globs such as shaders/** so it activates when Claude works with matching files. The file-name inference answer describes the desired behaviour, but Claude Code does not infer scope from names.

What each choice would do here

A · Why this meets the requirement

All three files load at the start of every session, so every standard is in context regardless of what is edited

Without paths, a rules file loads every session, so the scoping goal is not met.

With no paths condition, each rules file is treated like project memory and loaded at launch. Every session therefore carries all three standards. Adding paths such as shaders/**, levels/**/*.json and localisation/** restores the intended selective loading.

B · Why this does not meet the full requirement

Claude Code infers the scope from each file name and loads it only for folders with a matching name

Scope comes only from the paths globs, never from the file name.

Naming a file shaders.md does not scope it to a shaders folder. Claude Code never guesses scope from names; only explicit globs in the paths field restrict when a rule applies.

C · Why this does not meet the full requirement

Each file stays dormant until a CLAUDE.md imports it, so none of the three standards reaches Claude

Rules files are discovered automatically; no import is needed for them to load.

Imports are a CLAUDE.md feature for pulling in other files, but rules files do not depend on them. Claude Code discovers every file in .claude/rules/ on its own, so the standards do reach Claude, just not selectively.

D · Why this does not meet the full requirement

Claude Code refuses to start and reports that every rules file requires a paths header

Frontmatter is optional; missing paths changes scope, it does not cause an error.

Claude Code starts normally. Frontmatter is optional in rules files; its absence simply means the file has no path condition. No error or warning is raised, which is why the lead did not notice.

Walk through complete payloads or code · every step explained

Illustrative examples, not recorded live calls. Check each block's direction and endpoint: API requests, API responses, MCP messages, and configuration files are different contracts.

A scoped rules file for shader code

TEXT
---
paths:
  - "shaders/**"
  - "**/*.hlsl"
---
# Shader standards
- Use half precision for colour values unless a comment justifies float.
- Every shader declares its target profile at the top.

The paths list is what makes this file conditional; without it the same file would be loaded in every session.

Which omitted settings use defaults or leave features unconfigured?

Check your understanding · explain the design in your own words

What does a rules file do if it has no paths header?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Study: .claude/rules: path-scoped conventions

Study: .claude/rules: path-scoped conventions frontmatter yaml context window

Return to Q253's situation and clause-by-clause explanation

Q254. A Go team registers gofmt -w on the edited file as a PreToolUse hook matching Edit and Write, expecting every file Claude touches to end up formatted. After a week, files Claude modified are still unformatted in review. What is the cause? A) Formatting is only applied when the requirement is written in CLAUDE.md so that Claude runs the tool itself B) Hooks cannot launch external binaries, so gofmt is skipped and only built-in checks run C) The matcher must be Bash because formatters are shell commands, so an Edit matcher never fires D) PreToolUse runs before the edit is applied, so gofmt formats the old file and Claude's change lands afterwards

Understand Q254 · the situation and each part of the question

The real situation behind this question

A Go backend team wanted formatting to stop being a review topic. An engineer added a hook that runs gofmt on whatever file Claude edits, and chose PreToolUse because it sounded like the place to prepare a file. Nobody tested it on a real edit. A week later reviewers still see mixed indentation and import order in files Claude changed, and the team wonders whether hooks are reliable at all or whether the configuration is wrong.

Read the question in parts

Part 1 · as a PreToolUse hook matching Edit and Write

The hook timing is before the tool runs, which is the detail that decides what file content it sees.

Part 2 · files Claude modified are still unformatted

The hook runs, but its effect is overwritten, which points to timing rather than a missing hook.

What you are being asked to decide

Why does a formatter hook set to run before edits leave files unformatted? Pick the hook timing that matches the job: block before, fix after.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
PreToolUseruns before the tool call; suited to allowing or blocking it
PostToolUseruns after the tool call succeeds; suited to formatting or checking the result

Study: Hooks: deterministic control inside Claude Code Study: What hooks guarantee and what they do not hook deterministic

Understand Q254's answer · full reasoning and worked examples
Claude synthesized · the point, straight

Hook timing decides what the hook sees. PreToolUse can inspect or block a call before it happens, but a formatter there works on the stale file; fixing what Claude wrote requires PostToolUse.

Connect the design to the situation

gofmt runs as PreToolUse and formats the stale file, not Claude's change.

Best answer: D. PreToolUse fires before the tool executes, so the formatter rewrites the previous version on disk and the new content from Edit or Write then replaces it unformatted. PostToolUse fires after the write succeeds, which is when a formatter can act on what Claude actually produced. Putting the requirement in CLAUDE.md would only ask Claude to remember, which is the exact gap the hook was meant to close.

What each choice would do here

A · Why this does not meet the full requirement

Formatting is only applied when the requirement is written in CLAUDE.md so that Claude runs the tool itself

An instruction is guidance; the hook exists to avoid relying on Claude remembering.

Asking Claude to run gofmt through CLAUDE.md makes formatting depend on the model remembering every time. The whole point of a hook is that the harness runs the command whether or not the model thinks of it.

B · Why this does not meet the full requirement

Hooks cannot launch external binaries, so gofmt is skipped and only built-in checks run

Command hooks run any shell command, including formatters.

Command hooks execute arbitrary shell commands with the user's permissions, so gofmt runs fine. That is precisely why the team saw no error: the formatter ran successfully, just on the wrong version of the file.

C · Why this does not meet the full requirement

The matcher must be Bash because formatters are shell commands, so an Edit matcher never fires

Matchers name the tool Claude uses; Edit and Write are valid matchers for file changes.

Matchers match the tool Claude is calling, not the kind of command the hook runs. Edit and Write are exactly the tools that change files; a Bash matcher would only fire when Claude runs shell commands.

D · Why this meets the requirement

PreToolUse runs before the edit is applied, so gofmt formats the old file and Claude's change lands afterwards

Before-the-edit timing formats stale content; the new write then overwrites it.

At PreToolUse time the file on disk is the old version, or does not exist yet for a new Write. gofmt formats that, then Edit or Write applies Claude's new content. Moving the same command to PostToolUse makes it format the result.

Walk through complete payloads or code · every step explained

Illustrative examples, not recorded live calls. Check each block's direction and endpoint: API requests, API responses, MCP messages, and configuration files are different contracts.

Correct timing: format after the write

JSON
{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          {
            "type": "command",
            "command": "jq -r '.tool_input.file_path' | xargs gofmt -w"
          }
        ]
      }
    ]
  }
}

Same command, different event. PostToolUse receives the path of the file just written, so gofmt acts on Claude's actual output.

Which omitted settings use defaults or leave features unconfigured?

Check your understanding · explain the design in your own words

Why does a formatter hook set to run before edits leave files unformatted?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Study: Hooks: deterministic control inside Claude Code Study: What hooks guarantee and what they do not

Study: Hooks: deterministic control inside Claude Code Study: What hooks guarantee and what they do not hook deterministic

Return to Q254's situation and clause-by-clause explanation

Q255. At a fintech company, two developers each start a Claude Code session in the same checkout: one upgrades the logging library, the other adds a new report endpoint on a different branch. Within an hour one session's test run picks up the other's half-written files, and a branch switch in one session changes the files the other is editing. What is the underlying cause and fix? A) Claude Code does not support concurrent sessions; run the two tasks one after the other in a single session B) The two sessions share a single context window; clear the conversation in each session before switching tasks C) Both sessions lack a lock file in settings; enable file locking so edits from one session are hidden from the other D) Both sessions share one working directory; give each its own git worktree on its own branch and run one session per worktree

Understand Q255 · the situation and each part of the question

The real situation behind this question

Two developers at a fintech company wanted to move faster by running Claude Code sessions side by side on the same repository. One asked Claude to upgrade the logging library across services, the other to add a reporting endpoint. They both opened sessions in the same folder. Soon one session's tests failed on code the other had only half written, and when one checked out a different branch, the other session's open edits vanished from disk. They need both tasks running at once without interference.

Read the question in parts

Part 1 · in the same checkout

Both sessions read and write the same files on disk, which is the shared resource causing collisions.

Part 2 · a branch switch in one session changes the files the other is editing

Branches alone cannot isolate sessions when they share a single working directory.

What you are being asked to decide

Why do two Claude sessions in one folder trip over each other? Identify filesystem isolation as the fix for parallel sessions.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
git worktreea second working directory for the same repository, checked out on its own branch
sessionone running Claude Code conversation with its own context

Study: Separate checkouts and handoffs Study: Plan mode vs direct execution and the Explore subagent worktree isolation Claude Code

Understand Q255's answer · full reasoning and worked examples
Claude synthesized · the point, straight

Parallel sessions have separate conversations but not separate files. When they share a checkout, edits, tests and branch switches collide; a worktree per session gives each its own directory and branch, leaving integration to a normal merge.

Connect the design to the situation

Two sessions in one checkout see each other's half-written files.

Best answer: D. The sessions have independent conversations but share one set of files, so edits, test runs and branch switches collide. A git worktree gives each session its own directory and branch from the same repository, which isolates the files; merging the branches later is still normal integration work. Running the tasks one after another would avoid the collision but gives up the parallelism the team wanted.

What each choice would do here

A · Why this does not meet the full requirement

Claude Code does not support concurrent sessions; run the two tasks one after the other in a single session

Concurrent sessions are supported; sequencing only avoids the need for isolation.

Running the tasks in sequence would prevent the interference, but Claude Code supports many concurrent sessions and the team explicitly wants parallel work. This trades away the goal instead of isolating the sessions.

B · Why this does not meet the full requirement

The two sessions share a single context window; clear the conversation in each session before switching tasks

Sessions already have separate contexts; the shared resource is the directory.

Each Claude Code session already has its own conversation and context window, so clearing it changes nothing about the files. The collision comes from the shared directory, which neither session's context controls.

C · Why this does not meet the full requirement

Both sessions lack a lock file in settings; enable file locking so edits from one session are hidden from the other

There is no settings option that hides one session's file edits from another.

Claude Code settings have no file-locking or edit-hiding feature between sessions. Files on disk are shared by definition; only separate directories keep one session's edits away from the other.

D · Why this meets the requirement

Both sessions share one working directory; give each its own git worktree on its own branch and run one session per worktree

Separate worktrees give each session separate files and a separate branch.

Running git worktree add for each task creates a separate directory with its own branch, backed by the same repository. Each session edits and tests only its own files; integration happens later through a normal merge or pull request.

Walk through complete payloads or code · every step explained

Illustrative examples, not recorded live calls. Check each block's direction and endpoint: API requests, API responses, MCP messages, and configuration files are different contracts.

One worktree per task

TEXT
git worktree add ../app-logging -b chore/logging-upgrade
git worktree add ../app-report -b feat/report-endpoint
cd ../app-logging && claude   # session one
cd ../app-report && claude    # session two

Each session starts in its own directory on its own branch. Merge conflicts can still appear at integration time; worktrees prevent live interference, not every conflict.

Which omitted settings use defaults or leave features unconfigured?

Check your understanding · explain the design in your own words

Why do two Claude sessions in one folder trip over each other?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Study: Separate checkouts and handoffs Study: Plan mode vs direct execution and the Explore subagent

Study: Separate checkouts and handoffs Study: Plan mode vs direct execution and the Explore subagent worktree isolation Claude Code

Return to Q255's situation and clause-by-clause explanation

Q256. An API rename means the client docs for four language SDKs (Python, Go, Java, Ruby) must all be rewritten, and each rewrite requires reading that SDK's source in depth. Holding all four codebases in one conversation would exceed the context window, and the work should run at the same time. Which plan meets both constraints? A) Run one session over all four SDKs in turn and compact the conversation between each language B) Start four sessions in the same checkout, each switching to its own branch before it begins editing C) Create a git worktree per SDK and run one Claude Code session in each, then merge the four branches D) Create one skill with forked context that walks through all four SDKs inside a single forked run

Understand Q256 · the situation and each part of the question

The real situation behind this question

A developer-platform team renamed several API endpoints, which means the reference docs for four SDKs are now wrong. Each SDK has its own idioms, and documenting it correctly means reading its client code, examples and tests. A trial run in a single Claude Code session filled the context before the second SDK was finished. The release is in two days, so the team wants all four rewrites running at once, with each one reading its own SDK thoroughly and none stepping on another's files.

Read the question in parts

Part 1 · would exceed the context window

One conversation cannot hold everything, so the work must be divided across separate contexts.

Part 2 · the work should run at the same time

Parallel sessions will edit the repository simultaneously, so each needs its own working files.

What you are being asked to decide

How do you split a job that is too big for one context and must run in parallel? Recognise that context isolation and file isolation are separate needs.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
context isolationeach task gets its own conversation so one task's reading does not crowd another
worktreea separate working directory and branch for one session

Study: Separate checkouts and handoffs Study: Skill frontmatter options worktree isolation context isolation context window

Understand Q256's answer · full reasoning and worked examples
Claude synthesized · the point, straight

This job needs two different kinds of isolation. Separate sessions stop one conversation from having to hold every codebase, and separate worktrees stop parallel sessions from editing the same files; either one alone leaves one of the constraints unmet.

Connect the design to the situation

Four SDK doc rewrites, each needing deep reading of its own codebase.

Best answer: C. Four sessions give four separate context windows, so no single conversation has to hold every codebase, and four worktrees give each session its own files and branch so they can edit at the same time. A single forked skill does isolate its output from the main conversation, but it is still one context that must read all four SDKs.

What each choice would do here

A · Why this does not meet the full requirement

Run one session over all four SDKs in turn and compact the conversation between each language

Serial and lossy: compaction drops detail and nothing runs in parallel.

One session doing four SDKs in turn is serial by design, and each compaction replaces detail with a summary, so later rewrites lose facts from earlier reading. It addresses neither the parallel requirement nor the quality of the reading.

B · Why this does not meet the full requirement

Start four sessions in the same checkout, each switching to its own branch before it begins editing

Four contexts, but one shared directory, so branch switches collide.

Four sessions do give four separate contexts, solving the size problem. Sharing one checkout means the branch checkouts overwrite each other's files on disk, so the parallel edits collide and tests see mixed states.

C · Why this meets the requirement

Create a git worktree per SDK and run one Claude Code session in each, then merge the four branches

Separate sessions split the context load; separate worktrees keep their files apart.

Each worktree is its own directory on its own branch, and each session has its own context focused on one SDK. The four rewrites run concurrently without file collisions, and the branches are merged afterwards like any other change.

D · Why this does not meet the full requirement

Create one skill with forked context that walks through all four SDKs inside a single forked run

A forked skill is still one context that has to read all four codebases.

A skill with forked context runs in a separate subagent context, which keeps its verbose output out of the main conversation. But it is one fork reading all four codebases, so it hits the same context ceiling and runs nothing in parallel.

Check your understanding · explain the design in your own words

How do you split a job that is too big for one context and must run in parallel?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Study: Separate checkouts and handoffs Study: Skill frontmatter options

Study: Separate checkouts and handoffs Study: Skill frontmatter options worktree isolation context isolation context window

Return to Q256's situation and clause-by-clause explanation

Q257. A health-records team requires every new database migration to be named V__.sql. Claude Code usually complies, but about one migration in ten gets a name like V3__AddTable.sql, which breaks the deploy tool. A teammate proposes adding three good and three bad examples to the project CLAUDE.md. What change actually guarantees non-conforming names never land? A) Create a .claude/rules file scoped to the migrations folder that restates the naming pattern with examples B) Add a PreToolUse hook on Write that checks the file path against the pattern and exits with code 2 and a reason C) Add the six examples to CLAUDE.md with the heading IMPORTANT so the model weighs them above other guidance D) Ask a review subagent at the end of each session to list any migrations whose names do not match the pattern

Understand Q257 · the situation and each part of the question

The real situation behind this question

A health-records team deploys schema changes with a tool that orders migrations by timestamp in the file name. The naming rule is written in the project instructions, and Claude Code follows it most of the time. Roughly one migration in ten comes out with a short sequential name, the deploy tool rejects it, and a release stalls while someone renames the file. A teammate wants to add more examples to the instructions. The lead asks whether any wording change can make the rule hold every time.

Read the question in parts

Part 1 · about one migration in ten

The rule is already understood; the failures are occasional, which more guidance cannot eliminate.

Part 2 · guarantees non-conforming names never land

The requirement is prevention every time, which needs a deterministic check before the file is written.

What you are being asked to decide

How do you make sure a file-naming rule is never broken? Choose enforcement code over stronger instructions for a checkable rule.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
exit code 2the hook result that blocks the tool call and sends the message back to Claude
mechanically checkablea rule a short script can verify with no judgment involved
guardraila control that stops a bad action rather than hoping it is avoided

Study: Team instructions versus enforced rules Study: Hooks: deterministic control inside Claude Code hook deterministic guardrail

Understand Q257's answer · full reasoning and worked examples
Claude synthesized · the point, straight

When a rule can be checked by a script, occasional misses are an enforcement problem, not a wording problem. A PreToolUse hook that tests the file name and blocks with a reason makes the rule hold every time, while instructions stay as explanation.

Connect the design to the situation

One migration in ten gets a wrong name despite clear instructions.

Best answer: B. A PreToolUse hook runs as code before every Write, so a name that fails the regular expression is blocked and the reason is returned to Claude, which can retry with a valid name. Examples in CLAUDE.md or a scoped rules file improve the odds but remain instructions the model can miss one time in ten. A review subagent detects problems only after the files exist, and its check is itself model judgment.

What each choice would do here

A · Why this does not meet the full requirement

Create a .claude/rules file scoped to the migrations folder that restates the naming pattern with examples

A scoped rules file is guidance that loads at the right time, not a check.

Scoping the reminder to migrations keeps it relevant and out of unrelated sessions. It is loaded as context when Claude works with those files, so it is the same kind of guidance as CLAUDE.md, just better targeted.

B · Why this meets the requirement

Add a PreToolUse hook on Write that checks the file path against the pattern and exits with code 2 and a reason

Code runs before every write and blocks bad names, returning the reason to Claude.

The hook receives the tool input, including the file path, before the write happens. A script tests the name against the pattern and exits with code 2 plus a message when it fails, so the write is blocked and Claude gets a precise reason to correct the name.

C · Why this does not meet the full requirement

Add the six examples to CLAUDE.md with the heading IMPORTANT so the model weighs them above other guidance

Louder instructions are still instructions; the one-in-ten miss can recur.

Emphasis and examples genuinely raise compliance, and they are worth keeping as explanation. But the output is still a model choice, so the occasional bad name remains possible and the deploy tool will still break on it.

D · Why this does not meet the full requirement

Ask a review subagent at the end of each session to list any migrations whose names do not match the pattern

Detective and after the fact, and the check relies on another model's judgment.

An end-of-session review would report bad names after they exist, and a model-based reviewer can itself miss a case. It is a detective control at the wrong time, useful for audits but not for a guarantee.

Walk through complete payloads or code · every step explained

Illustrative examples, not recorded live calls. Check each block's direction and endpoint: API requests, API responses, MCP messages, and configuration files are different contracts.

Hook script that blocks a bad migration name

PYTHON
import json, re, sys

event = json.load(sys.stdin)
path = event.get("tool_input", {}).get("file_path", "")
name = path.rsplit("/", 1)[-1]
if "/migrations/" in path and not re.fullmatch(r"V\d{12}__[a-z0-9_]+\.sql", name):
    print(f"Migration name {name} must match V<yyyymmddHHMM>__<snake_case>.sql", file=sys.stderr)
    sys.exit(2)
sys.exit(0)

Registered as a PreToolUse hook on Write. Exit code 2 blocks the call and the stderr text is shown to Claude, which retries with a valid name.

Which omitted settings use defaults or leave features unconfigured?

Check your understanding · explain the design in your own words

How do you make sure a file-naming rule is never broken?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Study: Team instructions versus enforced rules Study: Hooks: deterministic control inside Claude Code

Study: Team instructions versus enforced rules Study: Hooks: deterministic control inside Claude Code hook deterministic guardrail

Return to Q257's situation and clause-by-clause explanation

Q258. Before changing how permissions are checked in a large Rails monolith, a developer asks Claude Code how authorization works. The logic is spread across concerns, mixins, callbacks and a policy layer in roughly thirty files. Claude opens two files and gives a confident but partial answer. Which approach gives a thorough answer without filling the main conversation with file dumps? A) Paste the full list of thirty file paths into the prompt and ask Claude to read all of them in this session B) Run the compaction command first so that the main conversation has more room for the files it reads C) Enable extended thinking so Claude reasons more carefully about the two files it has already read D) Delegate the tracing to the Explore subagent, asking it to follow every call path and return a summary

Understand Q258 · the situation and each part of the question

The real situation behind this question

A developer at a subscription-software company needs to change how access checks work, but the authorization logic has grown over ten years. It lives in model concerns, controller callbacks, mixins and a separate policy layer. Asking Claude Code for an explanation produced a tidy answer based on two files that missed the callback chain entirely. The developer wants the full picture before planning a change, and also wants to keep the working conversation focused on that change rather than on thirty pasted files.

Read the question in parts

Part 1 · spread across concerns, mixins, callbacks and a policy layer

Understanding requires reading widely across many files, which is verbose discovery work.

Part 2 · without filling the main conversation with file dumps

The reading should happen somewhere other than the main context, with only findings returned.

What you are being asked to decide

How do you get a deep code walkthrough without flooding your session? Pick the delegation mechanism for wide, read-heavy discovery.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
Explore subagenta built-in read-only helper that searches the codebase in its own context
context isolationverbose reading stays in the helper's context; only the summary returns

Study: Plan mode vs direct execution and the Explore subagent subagent context isolation Claude Code

Understand Q258's answer · full reasoning and worked examples
Claude synthesized · the point, straight

Shallow answers on sprawling code come from shallow reading, and forcing deep reading into the main session trades one problem for another. The Explore subagent reads widely in its own context and returns a summary, giving depth without polluting the working conversation.

Connect the design to the situation

Authorization logic is scattered across thirty Rails files.

Best answer: D. The Explore subagent is a read-only helper that searches and reads across the codebase in its own context window and hands back a condensed result, so the investigation can be broad while the main conversation stays clean. Pasting all thirty paths would force a thorough read, but every file would land in the main context the developer needs for the change itself.

What each choice would do here

A · Why this does not meet the full requirement

Paste the full list of thirty file paths into the prompt and ask Claude to read all of them in this session

Thorough, but all thirty files crowd the main conversation.

Listing every file would make Claude read them all, so the answer would likely be complete. The cost is that all that raw code now sits in the main context, crowding out the planning and editing that follow.

B · Why this does not meet the full requirement

Run the compaction command first so that the main conversation has more room for the files it reads

Freeing space does not make the investigation broader or smarter.

Compacting first frees context space, but the problem was shallow reading, not lack of room. Claude would still stop after a couple of files unless the investigation itself is set up to be thorough.

C · Why this does not meet the full requirement

Enable extended thinking so Claude reasons more carefully about the two files it has already read

Deeper reasoning over two files cannot reveal code that was never read.

Extended thinking gives Claude more room to reason, but the answer was partial because the relevant files were never opened. More reasoning over the same two files will produce a more elaborate version of the same incomplete picture.

D · Why this meets the requirement

Delegate the tracing to the Explore subagent, asking it to follow every call path and return a summary

Wide reading happens in a separate context and returns a summary.

Claude Code can hand discovery to the Explore subagent, which is optimised for searching and reading without editing. It traces the callbacks and policies in its own context and returns a summary with file references, leaving the main conversation ready for planning.

Check your understanding · explain the design in your own words

How do you get a deep code walkthrough without flooding your session?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Study: Plan mode vs direct execution and the Explore subagent

Study: Plan mode vs direct execution and the Explore subagent subagent context isolation Claude Code

Return to Q258's situation and clause-by-clause explanation

Q259. A nightly job runs claude -p with the prompt "Confirm every feature flag in flags.yaml is still referenced in the code" and a JSON output format. It reports "all flags in use" every night, yet engineers keep finding dead flags. What is the most likely cause? A) A single instance cannot check itself; a second headless instance must confirm every verdict the first one gives B) The prompt asks for a verdict with no required evidence, so Claude samples some flags and generalises; require each flag listed with the file and line where it is used C) The JSON output format truncates long answers, so the list of unused flags is cut off before it is printed D) Print mode runs without file tools, so Claude answers from the prompt text alone and never reads flags.yaml

Understand Q259 · the situation and each part of the question

The real situation behind this question

A consumer-app company uses feature flags heavily and wants to delete ones that no longer do anything. An engineer set up a nightly job that asks Claude Code, in headless mode, to confirm every flag is still referenced. Each morning the job reports that all flags are in use. Meanwhile engineers deleting code keep stumbling on flags with no references at all. The team is unsure whether the tool is broken, the output is being mangled, or the job simply asks the wrong question.

Read the question in parts

Part 1 · Confirm every feature flag in flags.yaml is still referenced

The prompt requests a confirmation, not a per-flag result with proof, so a quick yes satisfies it.

Part 2 · engineers keep finding dead flags

The verdict is wrong in a consistent direction, pointing to a shallow check rather than random failure.

What you are being asked to decide

Why does an automated check keep saying everything is fine when it is not? Diagnose missing validation criteria in a headless task.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
headlessrunning Claude Code non-interactively with -p, as in CI jobs
evidencethe concrete file and line proving each claim, so the result can be checked

Study: Claude Code in CI/CD headless eval deterministic

Understand Q259's answer · full reasoning and worked examples
Claude synthesized · the point, straight

A check that returns only a verdict can be satisfied by a partial search. Requiring every item with concrete evidence makes the output complete and verifiable, and when the check is a plain string search, a deterministic script is the stronger design.

Connect the design to the situation

A nightly flag audit always reports zero unused flags.

Best answer: B. The prompt defines success as a yes-or-no statement, so a plausible verdict after a partial search satisfies it. Requiring a per-flag table with file and line evidence, and marking flags with no evidence as unused, turns the claim into something checkable; for a pure string search, a deterministic script is even better. A second instance reviewing the same vague verdict inherits the same missing criteria.

What each choice would do here

A · Why this does not meet the full requirement

A single instance cannot check itself; a second headless instance must confirm every verdict the first one gives

A second reviewer with the same vague criteria repeats the same gap.

Adding a reviewer instance doubles cost without adding criteria. If the reviewer is asked to confirm the same verdict, it can make the same sampling shortcut, so the dead flags remain invisible.

B · Why this meets the requirement

The prompt asks for a verdict with no required evidence, so Claude samples some flags and generalises; require each flag listed with the file and line where it is used

Without required evidence per item, a partial search can still produce a clean verdict.

Asked only to confirm, Claude can check a handful of flags, find them used, and conclude the rest are too. Requiring every flag in a table with a file and line, and treating a missing reference as unused, forces a complete pass and lets the job verify the output.

C · Why this does not meet the full requirement

The JSON output format truncates long answers, so the list of unused flags is cut off before it is printed

JSON output wraps the full result; it does not cut findings off.

The JSON output format returns the full result along with metadata such as cost and session id. It does not shorten the answer, and the answer here is short anyway because it contains only a verdict.

D · Why this does not meet the full requirement

Print mode runs without file tools, so Claude answers from the prompt text alone and never reads flags.yaml

Print mode still reads files; read-only tools do not need approval.

Headless print mode keeps the same tools as an interactive session. Read, Grep and Glob are read-only and run without approval, so Claude can open flags.yaml and search the code; the failure is in what it was asked to prove.

Walk through complete payloads or code · every step explained

Illustrative examples, not recorded live calls. Check each block's direction and endpoint: API requests, API responses, MCP messages, and configuration files are different contracts.

A prompt that demands evidence

TEXT
claude -p "For EVERY key in flags.yaml, search the source tree.
Return JSON: [{\"flag\": ..., \"references\": [\"path:line\", ...]}].
A flag with an empty references list is UNUSED. Do not summarise; list every flag." --output-format json

The result now covers every flag and every claim is checkable; the job can also compare the flag count in the output with flags.yaml.

Which omitted settings use defaults or leave features unconfigured?

Check your understanding · explain the design in your own words

Why does an automated check keep saying everything is fine when it is not?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Study: Claude Code in CI/CD

Study: Claude Code in CI/CD headless eval deterministic

Return to Q259's situation and clause-by-clause explanation

Q260. Compliance at an insurance firm states that Claude Code must never open files under the secrets/ folder in any engineer's session. The rule is currently a sentence in the project CLAUDE.md, and one engineer's personal instruction file tells Claude to "read whatever you need to finish the task." Where should the rule live so that it holds in every session? A) In a CLAUDE.local.md at the repository root, because it is read last and overrides earlier instruction files B) In the committed .claude/settings.json as a deny rule on reading secrets/, backed by a hook for shell access C) In an organisation-wide managed CLAUDE.md, because personal instruction files cannot remove managed instructions D) In a .claude/rules file with paths set to secrets/, so the prohibition loads whenever those files come up

Understand Q260 · the situation and each part of the question

The real situation behind this question

An insurance firm keeps service credentials in a secrets folder that is excluded from most tooling. Compliance wants assurance that Claude Code never reads those files in any engineer's session. Today the rule is one sentence in the project instructions. An engineer who moved from a startup has a personal instruction file telling Claude to read whatever it needs. An audit found one session where Claude opened a credential file while debugging a connection error, and compliance now wants a rule that does not depend on which instruction wins.

Read the question in parts

Part 1 · must never open files under the secrets/ folder

This is an absolute prohibition, which requires a control that blocks the action rather than discourages it.

Part 2 · one engineer's personal instruction file tells Claude

Instructions already conflict, showing that any instruction-based rule can lose in some session.

Part 3 · holds in every session

The control must work regardless of personal configuration, which points to settings evaluated by the client.

What you are being asked to decide

Where do you put a rule that Claude must never break? Separate enforcement locations (settings, hooks) from guidance locations (every CLAUDE.md level).

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
deny rulea permission entry in settings that blocks a matching tool call before it runs
managed CLAUDE.mdan organisation-deployed instruction file; loaded as guidance, not enforced
CLAUDE.mdinstruction files at any level; the model reads and weighs them

Study: Where enforcement actually lives Study: Permissions and settings precedence settings-precedence CLAUDE.md managed policy

Understand Q260's answer · full reasoning and worked examples
Claude synthesized · the point, straight

Instruction files are guidance at every level, including managed and path-scoped ones, so a competing instruction can still win. A rule that must hold goes where the client enforces it: permission deny rules in settings, plus a hook for paths those rules do not cover.

Connect the design to the situation

A personal instruction file competes with a no-secrets rule written in CLAUDE.md.

Best answer: B. A permission deny rule is evaluated by the Claude Code client before a tool runs, so the read is refused no matter what any instruction says, and deny rules from any settings level cannot be overridden by an allow elsewhere. Every CLAUDE.md variant, including managed and path-scoped ones, is text the model weighs. File deny rules cover Claude's file tools, so shell commands need their own deny rule or hook.

What each choice would do here

A · Why this does not meet the full requirement

In a CLAUDE.local.md at the repository root, because it is read last and overrides earlier instruction files

A local instruction file is still guidance, and it is personal and uncommitted.

CLAUDE.local.md is a personal, git-ignored instruction file, so it would not even reach other engineers. Even where it loads, it is text in context; the model can still weigh the engineer's broader instruction more heavily in a given moment.

B · Why this meets the requirement

In the committed .claude/settings.json as a deny rule on reading secrets/**, backed by a hook for shell access

The client enforces a deny rule before the tool runs, whatever any instruction says.

A deny rule such as Read(./secrets/**) in committed project settings is checked by the client before the tool call, and a deny at any settings level wins over allows. Because file rules govern Claude's file tools, a Bash deny rule or PreToolUse hook closes the shell path too.

C · Why this does not meet the full requirement

In an organisation-wide managed CLAUDE.md, because personal instruction files cannot remove managed instructions

Managed instructions cannot be excluded, but they are still advice the model weighs.

A managed instruction file is the most tempting wrong answer: administrators deploy it and users cannot exclude it. It is still loaded into context as guidance, so a debugging session can still decide that reading a credential file is necessary.

D · Why this does not meet the full requirement

In a .claude/rules file with paths set to secrets/**, so the prohibition loads whenever those files come up

Scoped guidance loads when secrets are touched, which is too late and still not enforced.

A path-scoped rule loads when Claude works with matching files, which is roughly the moment of the violation. It is also guidance, not a block, so the same session that decided to read the file can proceed.

Walk through complete payloads or code · every step explained

Illustrative examples, not recorded live calls. Check each block's direction and endpoint: API requests, API responses, MCP messages, and configuration files are different contracts.

Enforcement lives in settings, not prose

JSON
{
  "permissions": {
    "deny": [
      "Read(./secrets/**)",
      "Edit(./secrets/**)",
      "Bash(cat secrets/*)"
    ]
  }
}

Committed in .claude/settings.json, these rules are evaluated by the client for every engineer. For stronger coverage of shell access, add a PreToolUse hook on Bash that rejects any command mentioning secrets/, or deploy the rules through managed settings.

Which omitted settings use defaults or leave features unconfigured?

Check your understanding · explain the design in your own words

Where do you put a rule that Claude must never break?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Study: Where enforcement actually lives Study: Permissions and settings precedence

Study: Where enforcement actually lives Study: Permissions and settings precedence settings-precedence CLAUDE.md managed policy

Return to Q260's situation and clause-by-clause explanation

Q261. A platform engineer wrote a release-notes skill that drafts notes from merged pull requests, and it works well on her laptop. Teammates who pulled the latest main branch report that it does not exist for them. She had saved it at ~/.claude/skills/release-notes/SKILL.md. What is the simplest change that gives it to everyone who clones this repository? A) Register the skill by name in the project settings file so that Claude Code knows to load it for all users B) Paste the skill body into the project CLAUDE.md so that it is loaded into every teammate's sessions C) Add a user-invocable line to the skill frontmatter so that it becomes visible to users other than its author D) Move it to .claude/skills/release-notes/SKILL.md inside the repository and commit that directory

Understand Q261 · the situation and each part of the question

The real situation behind this question

A platform engineer built a skill that reads merged pull requests and drafts release notes in the company's format. She tested it for a week and announced it in the team channel. Several teammates pulled main and tried it, but Claude Code did not recognise it. She had created it with the defaults on her own machine, in her home directory. The team wants every current and future engineer who clones the repository to have the same skill without any manual setup.

Read the question in parts

Part 1 · saved it at ~/.claude/skills/release-notes/SKILL.md

The skill lives in a personal location outside the repository, so version control never carries it.

Part 2 · everyone who clones this repository

The sharing mechanism must be the repository itself, which points to a committed project directory.

What you are being asked to decide

Where do you save a skill so the whole team gets it? Match skill scope to its storage location.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
project skilla skill stored in the repository's .claude/skills folder and shared through git
SKILL.mdthe file that defines a skill: frontmatter plus instructions

Study: Skills vs slash commands vs subagents skill agent-skills CLAUDE.md

Understand Q261's answer · full reasoning and worked examples
Claude synthesized · the point, straight

Skill scope follows location: the home directory is personal, the repository's .claude/skills/ is shared. Committing the skill folder into the project is the simplest way to give it to every clone while keeping it on demand.

Connect the design to the situation

A skill in the home directory is invisible to teammates.

Best answer: D. Skills in ~/.claude/skills are personal and live only in that user's home directory, so a git pull can never deliver them. Project skills in .claude/skills/ inside the repository are discovered automatically for anyone who clones it once the directory is committed. Pasting the body into CLAUDE.md shares the text but turns an on-demand procedure into always-loaded context.

What each choice would do here

A · Why this does not meet the full requirement

Register the skill by name in the project settings file so that Claude Code knows to load it for all users

Skills are discovered from their folders; no settings registration exists or is needed.

Claude Code finds skills by scanning the personal and project skills directories. There is no settings key that lists skills by name, so this edit would do nothing and the skill would still be missing for teammates.

B · Why this does not meet the full requirement

Paste the skill body into the project CLAUDE.md so that it is loaded into every teammate's sessions

Shares the text but loads it every session instead of on demand.

Everyone would receive the text, but a skill's value is that its full instructions load only when invoked. Putting a long procedure in CLAUDE.md spends context in every session and removes the clean slash-command entry point.

C · Why this does not meet the full requirement

Add a user-invocable line to the skill frontmatter so that it becomes visible to users other than its author

Visibility to other users is about location, not a frontmatter flag.

Frontmatter can control whether a user can invoke a skill from the slash menu, and it is on by default. It has nothing to do with other people's machines, which cannot see a file in her home directory.

D · Why this meets the requirement

Move it to .claude/skills/release-notes/SKILL.md inside the repository and commit that directory

Committed project skills load for anyone who clones the repository.

Moving the folder into the repository's .claude/skills/ and committing it makes it a project skill. Every clone then has the file, Claude Code discovers it automatically, and changes are reviewed like any other code.

Check your understanding · explain the design in your own words

Where do you save a skill so the whole team gets it?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Study: Skills vs slash commands vs subagents

Study: Skills vs slash commands vs subagents skill agent-skills CLAUDE.md

Return to Q261's situation and clause-by-clause explanation

Q262. A consultant opens Claude Code inside a client's repository, which is cloned under a shared workspace folder. Claude starts insisting on a changelog entry for every change, and nothing in the repository says so. The consultant suspects an instruction file somewhere above the repository. Which command answers this directly inside the running session? A) /doctor, which checks the installation and reports problems with the Claude Code setup B) /memory, which lists the instruction files loaded for the session and lets you open each one C) /clear, which empties the conversation so the session starts again without inherited instructions D) /init, which scans the repository and writes a CLAUDE.md describing the conventions it finds

Understand Q262 · the situation and each part of the question

The real situation behind this question

A consultant is brought in to fix a performance issue in a client's service. The client's repositories are all cloned under one shared workspace folder on a jump box. As soon as the consultant starts Claude Code, it insists on writing a changelog entry for every edit, which nobody asked for and which the repository's own instructions never mention. The consultant does not want to hunt through folders by hand and wants a direct answer from inside the session.

Read the question in parts

Part 1 · nothing in the repository says so

The instruction must be coming from a file outside the repository, such as a parent folder or user file.

Part 2 · inside the running session

The answer should come from a session command that inspects what is actually loaded right now.

What you are being asked to decide

How do you see which instruction files a session is using? Pick the diagnostic that reveals loaded memory files.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
memory filesthe CLAUDE.md and related instruction files loaded into a session
parent directorya folder above the repository whose CLAUDE.md is still loaded

Study: Which instructions are loaded Study: CLAUDE.md: the memory hierarchy CLAUDE.md Claude Code

Understand Q262's answer · full reasoning and worked examples
Claude synthesized · the point, straight

When behaviour comes from an unknown instruction, look at what the session actually loaded. /memory lists every loaded memory file, including ones in parent folders, which turns guessing into a direct answer.

Connect the design to the situation

An unexplained rule comes from a CLAUDE.md in a parent folder.

Best answer: B. /memory shows the memory files the session has loaded, including CLAUDE.md files found in parent directories, and opens any of them for editing, so the consultant can see exactly which file introduces the changelog rule. /init creates a new CLAUDE.md from the codebase, which adds instructions rather than revealing existing ones.

What each choice would do here

A · Why this does not meet the full requirement

/doctor, which checks the installation and reports problems with the Claude Code setup

Checks installation health, not instruction files.

/doctor diagnoses installation and configuration health, such as version and setup issues. It is useful when Claude Code misbehaves at a system level, not for tracing which instruction file a behaviour comes from.

B · Why this meets the requirement

/memory, which lists the instruction files loaded for the session and lets you open each one

Lists the loaded instruction files, including those above the repository.

Claude Code loads CLAUDE.md files from the working directory up through its parents, plus user-level memory. /memory lists what was actually loaded and opens any file, so the consultant quickly finds the workspace-level CLAUDE.md with the changelog rule.

C · Why this does not meet the full requirement

/clear, which empties the conversation so the session starts again without inherited instructions

Clears the conversation; the same files load again anyway.

/clear resets the conversation, but instruction files are loaded from disk at session start and again afterwards. The changelog rule would return immediately, and the consultant would learn nothing about its source.

D · Why this does not meet the full requirement

/init, which scans the repository and writes a CLAUDE.md describing the conventions it finds

Generates a new file; it does not reveal which ones are loaded.

/init analyses the codebase and writes a starter CLAUDE.md. That adds another instruction file to the mix and says nothing about the one already imposing the changelog rule, so the mystery gets harder, not easier.

Check your understanding · explain the design in your own words

How do you see which instruction files a session is using?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Study: Which instructions are loaded Study: CLAUDE.md: the memory hierarchy

Study: Which instructions are loaded Study: CLAUDE.md: the memory hierarchy CLAUDE.md Claude Code

Return to Q262's situation and clause-by-clause explanation

Q263. A design-system repository keeps Storybook story files next to their components, as Card.stories.tsx beside Card.tsx, across about sixty folders at different depths. The team wants its story-writing conventions applied only when Claude works on story files. Which setup does that? A) An import line in the root CLAUDE.md that pulls in a separate story-conventions file at startup B) A CLAUDE.md inside src/ with the story conventions, so they load whenever Claude works under that folder C) A rules file whose paths list is ["**/.stories.tsx"], so it applies to story files at any depth D) A rules file whose paths list is ["src/.stories.tsx"], so it applies to story files under the source folder

Understand Q263 · the situation and each part of the question

The real situation behind this question

A company maintains a shared component library with a story file next to each component so designers can preview it. Story files have their own conventions: argument naming, how controls are declared, which decorators to use. Those rules are irrelevant and distracting when Claude edits the components themselves. The folders are nested to different depths because components are grouped by family. The team wants the story rules to appear only when a story file is being worked on, wherever it lives.

Read the question in parts

Part 1 · across about sixty folders at different depths

The pattern must match at any nesting level, which requires a recursive glob rather than a single folder.

Part 2 · only when Claude works on story files

The conventions must load conditionally by file type, not for a whole folder or every session.

What you are being asked to decide

Which glob scopes rules to one file type spread across many folders? Write the glob that matches a cross-cutting file type.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
globa file pattern; ** matches any number of folders
co-locatedstory files live in the same folder as the component they describe

Study: .claude/rules: path-scoped conventions frontmatter yaml CLAUDE.md

Understand Q263's answer · full reasoning and worked examples
Claude synthesized · the point, straight

When a file type is scattered through the tree, scope by pattern, not by folder. A rules file whose paths use a recursive glob such as **/*.stories.tsx loads for every matching file at any depth and for nothing else.

Connect the design to the situation

Story files sit beside components in sixty nested folders.

Best answer: C. The recursive pattern **/*.stories.tsx matches story files in every folder at every depth, and a rules file with that paths list loads only when Claude works with matching files. The single-star pattern only matches files directly inside src/, missing almost all of the sixty folders. A CLAUDE.md in src/ loads for every file there, components included.

What each choice would do here

A · Why this does not meet the full requirement

An import line in the root CLAUDE.md that pulls in a separate story-conventions file at startup

Imports load at startup for every session, so nothing is scoped.

Imported files in CLAUDE.md are expanded when the session starts, so this is equivalent to putting the conventions in the root file. They would be present for every task, story-related or not.

B · Why this does not meet the full requirement

A CLAUDE.md inside src/ with the story conventions, so they load whenever Claude works under that folder

Loads for every file under src/, not only story files.

A CLAUDE.md in src/ is loaded when Claude works with files under src/, which includes every component file. The story conventions would then show up during component edits, which is exactly the noise the team wants to avoid.

C · Why this meets the requirement

A rules file whose paths list is ["**/*.stories.tsx"], so it applies to story files at any depth

Recursive glob plus path scoping matches every story file and nothing else.

The double star crosses any number of folders, so every Card.stories.tsx and Button.stories.tsx matches wherever it sits. Because the list is in paths frontmatter, the conventions load only when Claude reads or edits one of those files.

D · Why this does not meet the full requirement

A rules file whose paths list is ["src/*.stories.tsx"], so it applies to story files under the source folder

A single star does not cross folders, so nested story files are missed.

In a glob, a single star matches within one path segment, so src/*.stories.tsx only matches story files sitting directly in src/. Components nested in family folders would never trigger the rule, and the team would think scoping was broken.

Check your understanding · explain the design in your own words

Which glob scopes rules to one file type spread across many folders?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Study: .claude/rules: path-scoped conventions

Study: .claude/rules: path-scoped conventions frontmatter yaml CLAUDE.md

Return to Q263's situation and clause-by-clause explanation

Q264. A team lead wrote the team's commit-message convention into her own ~/.claude/CLAUDE.md, and her sessions follow it perfectly. The CI job that runs claude -p on a build runner to prepare release commits ignores the convention entirely, and so do her teammates' sessions. What explains this? A) Print mode skips every instruction file, so headless runs never see conventions from any CLAUDE.md B) User-level instructions apply only after they are imported from the project CLAUDE.md of each repository C) User-level instructions load only in interactive sessions that are started by the same account that created the file D) The file lives in her home directory on her machine, so the runner and teammates never have it; it belongs in the committed project CLAUDE.md

Understand Q264 · the situation and each part of the question

The real situation behind this question

A team lead cares about clean history and wrote a detailed commit-message convention into her personal Claude Code instructions. Her own sessions produce perfect messages. The team also has a CI job on a build runner that uses Claude Code headless to prepare release commits, and those messages ignore the convention. Teammates' sessions ignore it too. She assumed the instructions were attached to the project because she wrote them while working in it, and now wants to understand why only she benefits.

Read the question in parts

Part 1 · into her own ~/.claude/CLAUDE.md

The instruction is stored in a personal location that exists only in her home directory.

Part 2 · on a build runner

CI runs on a different machine with only the repository checkout, so personal files never appear there.

What you are being asked to decide

Why does a convention work for one person but not for CI or teammates? Match instruction scope to where the file lives and who can see it.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
user-level CLAUDE.mdpersonal instructions in one user's home directory, applied to all their projects
build runnera CI machine that checks out the repository and runs Claude Code headless

Study: CLAUDE.md: the memory hierarchy Study: Which instructions are loaded CLAUDE.md headless

Understand Q264's answer · full reasoning and worked examples
Claude synthesized · the point, straight

Instruction files apply where they physically exist. A personal ~/.claude/CLAUDE.md never leaves one machine, so a team convention must live in the committed project CLAUDE.md to reach teammates and CI.

Connect the design to the situation

A commit convention in a personal file never reaches the build runner.

Best answer: D. ~/.claude/CLAUDE.md is a personal file on one machine; nothing copies it to a build runner or to other developers. A CLAUDE.md committed in the repository travels with every clone, including the one CI checks out. Headless runs do load instruction files, so print mode is not the cause.

What each choice would do here

A · Why this does not meet the full requirement

Print mode skips every instruction file, so headless runs never see conventions from any CLAUDE.md

Headless runs load instruction files the same way interactive ones do.

Print mode loads project and user instruction files just like an interactive session. If the runner had the file, it would apply. The difference is that the runner's account has no such file at all.

B · Why this does not meet the full requirement

User-level instructions apply only after they are imported from the project CLAUDE.md of each repository

User-level files load on their own for that user; imports are not required.

A user-level CLAUDE.md is loaded automatically for every project that user opens. No import is needed, which is why the lead's own sessions work without any change to the repository.

C · Why this does not meet the full requirement

User-level instructions load only in interactive sessions that are started by the same account that created the file

Loading does not depend on interactivity; the file simply is not on those machines.

Instruction loading does not depend on interactivity or on which account wrote the file. Each machine loads the user file of whoever runs Claude Code there, and on the runner that file does not contain her convention.

D · Why this meets the requirement

The file lives in her home directory on her machine, so the runner and teammates never have it; it belongs in the committed project CLAUDE.md

Only the committed project file reaches other machines and people.

The file sits in her home directory, outside any repository, so git never carries it. Teammates and the runner therefore never load it. Moving the convention into the committed project CLAUDE.md puts it into every clone and every CI checkout.

Check your understanding · explain the design in your own words

Why does a convention work for one person but not for CI or teammates?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Study: CLAUDE.md: the memory hierarchy Study: Which instructions are loaded

Study: CLAUDE.md: the memory hierarchy Study: Which instructions are loaded CLAUDE.md headless

Return to Q264's situation and clause-by-clause explanation

Q265. A dependency-audit skill lists every transitive package, its licence and its known advisories, often thousands of lines. After running it, developers find Claude drifting toward the audit instead of the feature they were building. The team adds context: fork to the skill's frontmatter. Which statement about that change is exactly right? A) It runs the skill in a separate subagent context and returns only the final result to the main conversation B) It switches the skill to a smaller model, which produces shorter output and therefore less clutter in the session C) It stops Claude from invoking the skill automatically, so the audit only runs when a user types its name D) It copies the whole current conversation into the skill so the audit can use everything discussed so far

Understand Q265 · the situation and each part of the question

The real situation behind this question

A security-minded team built a skill that audits dependencies: every transitive package, its licence and any published advisories. The output is thorough and often runs to thousands of lines. Developers run it mid-task, and afterwards Claude keeps returning to licence questions instead of the feature at hand, because the audit now dominates the conversation. Someone adds the fork setting to the skill's frontmatter, and the team wants to be sure what that setting does and does not change.

Read the question in parts

Part 1 · often thousands of lines

The skill's intermediate output is large enough to crowd the working conversation.

Part 2 · Which statement about that change is exactly right?

The item tests the precise behaviour of the fork setting, not a general way to reduce noise.

What you are being asked to decide

What does context: fork do to a skill? Know the exact effect of the fork setting versus other frontmatter fields.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
context: forkfrontmatter that runs the skill in its own subagent context
subagenta helper with a separate context that returns a result to the caller

Study: Skill frontmatter options Study: Skills vs slash commands vs subagents skill frontmatter context isolation

Understand Q265's answer · full reasoning and worked examples
Claude synthesized · the point, straight

context: fork changes where a skill runs, not who can call it or which model it uses. The skill executes in its own subagent context without the conversation history, and only its result returns, so verbose work cannot derail the main task.

Connect the design to the situation

A noisy audit skill derails the developer's main task.

Best answer: A. context: fork runs the skill as a subagent in its own context, with the skill content as its task, so the thousands of lines of intermediate output stay there and only the result comes back. The forked run does not receive the conversation history. Preventing automatic invocation is a different frontmatter field.

What each choice would do here

A · Why this meets the requirement

It runs the skill in a separate subagent context and returns only the final result to the main conversation

Isolated run, result only returned: exactly what fork does.

With context: fork the skill runs in its own subagent context, optionally with a chosen agent type. The package-by-package output stays in that context, and the main conversation receives only the summary, so the developer's task stays in focus.

B · Why this does not meet the full requirement

It switches the skill to a smaller model, which produces shorter output and therefore less clutter in the session

Model choice is a separate field; fork changes where the skill runs.

A skill can set a different model in its frontmatter, but that is a separate field and does not isolate anything. A smaller model would still pour its output into the main conversation.

C · Why this does not meet the full requirement

It stops Claude from invoking the skill automatically, so the audit only runs when a user types its name

That is the job of disable-model-invocation, not context: fork.

Restricting invocation to users is controlled by disable-model-invocation. The fork setting does not change who can trigger the skill; it changes where the work happens once it is triggered.

D · Why this does not meet the full requirement

It copies the whole current conversation into the skill so the audit can use everything discussed so far

A forked skill starts without the conversation history; it gets the skill content as its task.

This reverses the real behaviour. A forked skill runs as a subagent whose task is the skill content; it does not inherit the conversation history. If the audit needs context from the conversation, the arguments passed to the skill must carry it.

Walk through complete payloads or code · every step explained

Illustrative examples, not recorded live calls. Check each block's direction and endpoint: API requests, API responses, MCP messages, and configuration files are different contracts.

Skill frontmatter with a forked context

TEXT
---
name: dependency-audit
description: Audit transitive dependencies for licence and advisory issues.
context: fork
---
List every transitive dependency with licence and known advisories.
Return only: packages needing action, why, and the suggested fix.

The full scan happens in the forked context; the instructions also ask for a compact result, which is what the main conversation receives.

Which omitted settings use defaults or leave features unconfigured?

Check your understanding · explain the design in your own words

What does context: fork do to a skill?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Study: Skill frontmatter options Study: Skills vs slash commands vs subagents

Study: Skill frontmatter options Study: Skills vs slash commands vs subagents skill frontmatter context isolation

Return to Q265's situation and clause-by-clause explanation

Q266. A developer must add account deletion to a SaaS product. Legal rules about what must be kept for audit, how backups are handled, and how long invoices are retained are not written down anywhere; only the developer and a lawyer know them. Before any code is written, what is the best way to bring the unstated constraints into the design? A) Ask Claude to scan the existing deletion jobs and infer the legal retention rules from how the code behaves today B) Start with a failing end-to-end deletion test and let each failure reveal which data and systems are involved C) Ask Claude to interview the developer with targeted questions about retention, backups and audit needs, then write a spec from the answers D) Ask Claude to compare three open-source account-deletion libraries and recommend the one with the most features

Understand Q266 · the situation and each part of the question

The real situation behind this question

A small SaaS company has to ship account deletion to satisfy a privacy regulation. Deleting a row is easy; deciding what must survive is not. Invoices have to be kept for years, audit logs have their own rules, and backups raise questions nobody has written down. The developer has notes from a meeting with the company lawyer, and some of it is only in memory. The developer wants Claude Code to help, but a design that ignores one rule would mean costly rework or a compliance problem.

Read the question in parts

Part 1 · are not written down anywhere

No file or document holds the constraints, so reading the codebase cannot surface them.

Part 2 · Before any code is written

The constraints must shape the design first, which rules out discovery through implementation.

What you are being asked to decide

How do you get requirements that only you know into Claude's plan? Choose the interview pattern when constraints are undocumented.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
interview patternClaude asks the developer structured questions before proposing a design
requirement gatheringcollecting constraints and rules before designing a solution

Study: Plan mode vs direct execution and the Explore subagent elicitation requirement-gathering Claude Code

Understand Q266's answer · full reasoning and worked examples
Claude synthesized · the point, straight

When the constraints exist only in people's heads, no amount of reading code or libraries will find them. Having Claude interview the developer and write the answers into a spec brings those constraints into the design before any code depends on them.

Connect the design to the situation

Legal retention rules for account deletion exist only in conversation.

Best answer: C. The missing information is not in the code or in any library; it is in people's heads, so the fastest path is for Claude to ask focused questions and turn the answers into a spec before planning. Inferring rules from existing jobs only reproduces what the code already does, which may be exactly what the legal rules contradict.

What each choice would do here

A · Why this does not meet the full requirement

Ask Claude to scan the existing deletion jobs and infer the legal retention rules from how the code behaves today

Code shows current behaviour, not the legal rules it may already violate.

Reading current deletion jobs shows how the system behaves now, which is useful context. It cannot reveal a rule that exists only in a lawyer's advice, and if the current code is non-compliant, inferring from it bakes the problem in.

B · Why this does not meet the full requirement

Start with a failing end-to-end deletion test and let each failure reveal which data and systems are involved

Tests reveal technical wiring, not unwritten legal obligations.

A failing test is a good way to find which tables and services are touched by deletion. It says nothing about which data must legally be kept, so the design could pass every test and still break retention obligations.

C · Why this meets the requirement

Ask Claude to interview the developer with targeted questions about retention, backups and audit needs, then write a spec from the answers

The knowledge is in people, so asking them surfaces it before design.

Claude asks focused questions, such as which records must be retained, for how long, what happens to backups, and who can restore, and the developer answers from the legal notes. The answers become a written spec that the plan and later reviews can rely on.

D · Why this does not meet the full requirement

Ask Claude to compare three open-source account-deletion libraries and recommend the one with the most features

A library comparison cannot know this company's retention obligations.

Comparing libraries is a reasonable later step once requirements are clear. Feature counts do not encode this company's retention periods or audit needs, so the choice would be made before the real constraints are known.

Check your understanding · explain the design in your own words

How do you get requirements that only you know into Claude's plan?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Study: Plan mode vs direct execution and the Explore subagent

Study: Plan mode vs direct execution and the Explore subagent elicitation requirement-gathering Claude Code

Return to Q266's situation and clause-by-clause explanation

Q267. The team replaced an old logging helper and updated the project CLAUDE.md last week. Everyone's sessions now use the new helper except one developer's, which still writes calls to the old helper. That developer has pulled the latest main. The lead suspects a personal or local instruction file still describes the old helper. Which step confirms or rules out that suspicion before anything is edited? A) Make the new-helper instruction in the project CLAUDE.md more emphatic and see whether the behaviour changes B) Have the developer delete the whole ~/.claude directory so that only the project configuration remains C) Ask Claude in that session which logging helper it should use, and compare its answer with the project file D) Run /memory in that developer's session and check each loaded file for the outdated logging instruction

Understand Q267 · the situation and each part of the question

The real situation behind this question

A payments team retired an old logging helper and replaced it with a structured one. The project instructions were updated and merged, and most developers saw Claude switch immediately. One developer's sessions keep writing calls to the old helper, which reviewers then reject. The developer insists they are on the latest code. The lead remembers that this developer used to keep personal notes for Claude and suspects one of them still describes the retired helper, but wants proof before anyone edits or deletes files.

Read the question in parts

Part 1 · That developer has pulled the latest main

The committed project file is current, so the difference must come from files outside it.

Part 2 · before anything is edited

The step must be diagnostic and non-destructive, confirming the cause first.

What you are being asked to decide

How do you check whether an old instruction file is overriding a new team rule? Diagnose from loaded files before changing configuration.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
CLAUDE.local.mda personal, uncommitted instruction file in the project that only one developer has
loaded filesthe instruction files a session actually read at startup

Study: Which instructions are loaded Study: Read the filenames before applying a hierarchy CLAUDE.md Claude Code

Understand Q267's answer · full reasoning and worked examples
Claude synthesized · the point, straight

When one session behaves differently, look at what that session loaded before changing anything. /memory shows every instruction file in play, so a stale personal or local file is found directly instead of being guessed at.

Connect the design to the situation

One developer's sessions still use a retired logging helper.

Best answer: D. /memory lists every instruction file that session loaded, such as user-level CLAUDE.md, CLAUDE.local.md or a parent-folder file, and opens them, so the lead can find the stale text directly. Asking Claude to recite a convention shows what it currently believes, not which file taught it, and deleting ~/.claude destroys settings and history without confirming anything.

What each choice would do here

A · Why this does not meet the full requirement

Make the new-helper instruction in the project CLAUDE.md more emphatic and see whether the behaviour changes

Changes configuration before diagnosing, and may not beat a conflicting file.

Louder wording in the project file might win sometimes, but it changes configuration before the cause is known. If a personal file conflicts, the two instructions keep competing and the behaviour stays inconsistent.

B · Why this does not meet the full requirement

Have the developer delete the whole ~/.claude directory so that only the project configuration remains

Destructive and still does not identify the cause.

Deleting ~/.claude removes personal settings, credentials and session history, and it would not touch a CLAUDE.local.md inside the project. It is destructive, possibly ineffective, and still leaves the lead without an explanation.

C · Why this does not meet the full requirement

Ask Claude in that session which logging helper it should use, and compare its answer with the project file

Shows the belief, not the file it came from.

Claude will report whatever it currently weighs most, perhaps the old helper. That confirms the symptom but not the source: the stale text could be in a user file, a local file or a parent directory, and the answer does not say which.

D · Why this meets the requirement

Run /memory in that developer's session and check each loaded file for the outdated logging instruction

Lists the actual loaded files so the stale one can be found.

/memory shows exactly which memory files the session loaded and lets the lead open each one. If a CLAUDE.local.md or user-level file still describes the old helper, it will be visible, and the fix becomes a targeted edit of that one file.

Check your understanding · explain the design in your own words

How do you check whether an old instruction file is overriding a new team rule?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Study: Which instructions are loaded Study: Read the filenames before applying a hierarchy

Study: Which instructions are loaded Study: Read the filenames before applying a hierarchy CLAUDE.md Claude Code

Return to Q267's situation and clause-by-clause explanation

Q268. An incident-response team writes postmortems with twelve required sections. Engineers paste their own saved versions of a long drafting prompt into Claude Code, and the versions have drifted so some drafts miss sections. The team wants one versioned procedure anyone can run on demand with an incident ID. What should they build? A) Give each engineer a shell alias that runs Claude Code headless with the drafting prompt from a local text file B) Put the full drafting prompt in the root CLAUDE.md so it is present in every session for every engineer C) Add a rules file scoped to postmortems/** so the drafting procedure appears whenever those files are opened D) Create a committed project skill such as .claude/skills/postmortem/SKILL.md with an argument hint for the incident ID

Understand Q268 · the situation and each part of the question

The real situation behind this question

An incident-response team at a logistics company writes a postmortem after every major outage. Their template has twelve sections, from timeline to follow-up owners. Each engineer keeps a personal copy of a long drafting prompt and pastes it into Claude Code. Over months the copies diverged, and recent drafts have missed the customer-impact and follow-up sections. The team lead wants one procedure, reviewed like code, that anyone can start at the end of an incident by giving the incident ID.

Read the question in parts

Part 1 · the versions have drifted

The procedure must have a single source of truth under version control, not personal copies.

Part 2 · anyone can run on demand with an incident ID

The mechanism must be explicitly invoked and accept an argument, which is what a skill or command provides.

What you are being asked to decide

How do you give a team one repeatable prompt they can run whenever needed? Pick the packaging for an on-demand team workflow.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
project skilla committed, named procedure anyone on the team can invoke
argument hintfrontmatter that shows what input the command expects, such as an incident ID

Study: Skills vs slash commands vs subagents skill slash command agent-skills

Understand Q268's answer · full reasoning and worked examples
Claude synthesized · the point, straight

A procedure people run on demand needs a name, an input and one reviewed source. A committed project skill provides all three, while always-loaded instructions, path-triggered rules and personal aliases each miss at least one.

Connect the design to the situation

Drifting copies of a postmortem prompt produce incomplete drafts.

Best answer: D. A committed project skill is invoked by name, takes the incident ID as an argument, and gives every engineer the same reviewed procedure. Putting the prompt in CLAUDE.md shares it but loads it into every unrelated session, and a scoped rules file only appears when postmortem files are touched, which is not the same as running a procedure on demand.

What each choice would do here

A · Why this does not meet the full requirement

Give each engineer a shell alias that runs Claude Code headless with the drafting prompt from a local text file

Per-machine copies drift again and are not reviewed with the code.

Aliases make the prompt quick to run, but each engineer still keeps a local copy. The copies will drift the same way, and changes are never reviewed alongside the repository.

B · Why this does not meet the full requirement

Put the full drafting prompt in the root CLAUDE.md so it is present in every session for every engineer

Shared, but always loaded and never explicitly invoked.

Everyone would get the same text, fixing the drift. But the long prompt would sit in context during every unrelated session, and nothing marks when the procedure should run or which incident it applies to.

C · Why this does not meet the full requirement

Add a rules file scoped to postmortems/** so the drafting procedure appears whenever those files are opened

Triggers on file paths, not on demand, and only as guidance.

A scoped rules file loads guidance when Claude works on files under postmortems/. That helps with formatting existing drafts, but it cannot be run with an incident ID and does nothing until a file already exists.

D · Why this meets the requirement

Create a committed project skill such as .claude/skills/postmortem/SKILL.md with an argument hint for the incident ID

One versioned procedure, run by name, with the incident ID as input.

A SKILL.md committed under .claude/skills/postmortem/ becomes a slash command that every clone has. Its frontmatter can describe the expected incident ID, and the body holds the reviewed twelve-section procedure, so each run follows the same steps.

Walk through complete payloads or code · every step explained

Illustrative examples, not recorded live calls. Check each block's direction and endpoint: API requests, API responses, MCP messages, and configuration files are different contracts.

A committed postmortem skill

TEXT
---
name: postmortem
description: Draft a postmortem with all twelve required sections for an incident.
argument-hint: <incident-id>
---
Draft the postmortem for incident $ARGUMENTS.
Include every section: summary, impact, customer impact, timeline, detection,
root cause, contributing factors, what went well, what went poorly, actions,
owners, follow-up dates. Mark any section with missing data as TODO.

Invoked as /postmortem INC-4821. The file is reviewed and versioned with the repository, so every engineer runs the same procedure.

Which omitted settings use defaults or leave features unconfigured?

Check your understanding · explain the design in your own words

How do you give a team one repeatable prompt they can run whenever needed?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Study: Skills vs slash commands vs subagents

Study: Skills vs slash commands vs subagents skill slash command agent-skills

Return to Q268's situation and clause-by-clause explanation

Q269. A developer has four tasks queued for Claude Code this afternoon. Which one most warrants starting in plan mode rather than asking for the change directly? A) Bump one library by a patch version exactly as a published security advisory instructs B) Move app state from a global store to a server-cache library across seventy components, with several possible migration orders C) Correct a misspelled word in one user-facing error message that a support ticket quoted exactly D) Rename a confusingly named local variable inside a single function that already has full test coverage

Understand Q269 · the situation and each part of the question

The real situation behind this question

A front-end developer at a travel-booking company has a to-do list for the afternoon. Three items are small: a typo a customer reported, a variable name that confuses readers, and a patch upgrade required by a security notice. The fourth is a long-discussed migration away from a global state store toward a server-cache library, touching around seventy components. Several migration orders are possible, some safer than others. The developer wants to use Claude Code efficiently and avoid rework on the one task that can go badly wrong.

Read the question in parts

Part 1 · most warrants starting in plan mode

The question asks which task benefits from exploring and planning before any edits are made.

Part 2 · with several possible migration orders

Multiple valid approaches signal a design decision that should be made deliberately first.

What you are being asked to decide

Which kind of task should start with a plan instead of edits? Match task shape to plan mode versus direct execution.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
plan modea read-only mode where Claude explores and proposes a plan before editing
decompositionbreaking a large change into ordered steps before starting

Study: Plan mode vs direct execution and the Explore subagent Claude Code decomposition

Understand Q269's answer · full reasoning and worked examples
Claude synthesized · the point, straight

Plan mode earns its cost when a task is broad, ambiguous and has several reasonable approaches. Small, precisely described changes go straight to execution; a many-file migration with competing strategies should be explored and planned first.

Connect the design to the situation

A seventy-component state migration versus three one-line fixes.

Best answer: B. The state migration touches many files, has several valid strategies, and needs dependencies mapped before any edit, which is what plan mode is for: read-only exploration and a plan to review first. The other three are small, clearly specified changes where planning adds a step without reducing risk.

What each choice would do here

A · Why this does not meet the full requirement

Bump one library by a patch version exactly as a published security advisory instructs

The advisory already states the exact change: direct execution fits.

Security advisories usually state the exact version to move to. Claude can apply it and run the test suite directly. If the upgrade surprised anyone, that would appear in the test run, not in a plan.

B · Why this meets the requirement

Move app state from a global store to a server-cache library across seventy components, with several possible migration orders

Many files, several valid orders, dependencies to map: plan first.

This change spans dozens of files and needs a strategy: which components first, how to run both systems side by side, how to test each step. Plan mode lets Claude explore read-only and propose an order the developer approves before any file changes.

C · Why this does not meet the full requirement

Correct a misspelled word in one user-facing error message that a support ticket quoted exactly

Exact, one-line and fully specified: direct execution fits.

The fix is a single known string in a single file. Plan mode would make Claude explore and present a plan for a change the developer can already describe exactly, adding a review step with nothing to decide.

D · Why this does not meet the full requirement

Rename a confusingly named local variable inside a single function that already has full test coverage

Scoped to one function with tests: direct execution fits.

A local rename inside one function, protected by tests, is small and low risk. Asking directly lets Claude make the edit and run the tests; planning would not surface anything the tests would not.

Check your understanding · explain the design in your own words

Which kind of task should start with a plan instead of edits?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Study: Plan mode vs direct execution and the Explore subagent

Study: Plan mode vs direct execution and the Explore subagent Claude Code decomposition

Return to Q269's situation and clause-by-clause explanation

Q270. A monorepo's 700-line CLAUDE.md mixed Go, SQL, Helm and front-end conventions, and Go error-handling advice kept appearing in SQL files. The team split it into four files and added an import line for each at the top of the root CLAUDE.md. The bleed continues exactly as before. What is the root cause? A) Imported files are pulled in at launch, so all four sets are in context for every file; conditional loading needs rules files with paths globs B) A user-level instruction file loaded before the project file is repeating the Go advice in every session C) Imported files are loaded only after a matching file is opened, so the conventions arrive too late to shape the edit D) Import lines only resolve absolute paths, so the four files silently fail to load and older cached copies are used

Understand Q270 · the situation and each part of the question

The real situation behind this question

A platform company's monorepo holds Go services, SQL migrations, Helm charts and a React front end. Over two years its CLAUDE.md grew to seven hundred lines. Engineers noticed Claude applying Go error-wrapping advice to SQL files and React naming to Helm values. A developer tidied things by splitting the file into four technology files and importing them from the root CLAUDE.md. The file is much easier to read now, but the cross-technology bleed in Claude's output has not changed at all.

Read the question in parts

Part 1 · added an import line for each at the top of the root CLAUDE.md

The split uses imports, whose loading time decides whether anything became conditional.

Part 2 · The bleed continues exactly as before

The change did not alter what is in context, which is the clue to how imports load.

What you are being asked to decide

Why does splitting CLAUDE.md into imported files not stop rules from bleeding? Tell always-loaded imports apart from path-conditional rules.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
importa line in CLAUDE.md that pulls another file into context at startup
paths globfrontmatter that makes a rules file load only for matching files

Study: .claude/rules: path-scoped conventions Study: CLAUDE.md: the memory hierarchy CLAUDE.md frontmatter context window

Understand Q270's answer · full reasoning and worked examples
Claude synthesized · the point, straight

Splitting CLAUDE.md with imports improves organisation but not scope, because imports are expanded at startup. To keep a technology's conventions out of unrelated edits, put them in rules files with paths globs that load only for matching files.

Connect the design to the situation

Four imported files still put Go advice into SQL edits.

Best answer: A. Imports in CLAUDE.md are expanded when the session starts, so splitting the file changed its organisation but not what is in context: every convention is still present for every edit. Path-scoped rules files with paths frontmatter load only when Claude works on matching files, which is what stops Go advice from reaching SQL edits.

What each choice would do here

A · Why this meets the requirement

Imported files are pulled in at launch, so all four sets are in context for every file; conditional loading needs rules files with paths globs

Imports load up front; only paths-scoped rules load conditionally.

Imported files are expanded into the session when it starts, exactly as if their text were in the root file. Moving each technology into a rules file with paths such as **/*.go or migrations/**/*.sql is what makes each set load only for matching files.

B · Why this does not meet the full requirement

A user-level instruction file loaded before the project file is repeating the Go advice in every session

Nothing suggests a user file; the change the team made explains the result.

A user-level file could add conventions, but nothing here points to one and the Go advice matches the project's own file. The simpler explanation is that the split changed nothing about when content loads.

C · Why this does not meet the full requirement

Imported files are loaded only after a matching file is opened, so the conventions arrive too late to shape the edit

Imports are expanded at launch, not on demand.

This describes path-scoped rules, not imports, and even reversed it would not explain continued bleed. Imports are resolved at launch, so all four sets are present from the first message.

D · Why this does not meet the full requirement

Import lines only resolve absolute paths, so the four files silently fail to load and older cached copies are used

Relative imports work; the files load, which is why the bleed continues.

CLAUDE.md imports accept relative paths, resolved from the importing file. The four files do load, which is exactly why the conventions still appear. There is no cache of older copies involved.

Check your understanding · explain the design in your own words

Why does splitting CLAUDE.md into imported files not stop rules from bleeding?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Study: .claude/rules: path-scoped conventions Study: CLAUDE.md: the memory hierarchy

Study: .claude/rules: path-scoped conventions Study: CLAUDE.md: the memory hierarchy CLAUDE.md frontmatter context window

Return to Q270's situation and clause-by-clause explanation

Q271. A consultancy uses one repository and Claude Code to produce reports for many clients. A regulated bank needs British spelling, a mandatory risk-disclosure section and a stricter source policy, but only for its own reports; every other client keeps the defaults in the root CLAUDE.md. Analysts start each job from the client's folder. Which configuration fits? A) Add the bank's rules as environment variables in the project settings file so that they are applied to each run B) Create clients/bank/CLAUDE.md with the extra rules, so jobs started in that folder load it on top of the root defaults C) Add an "if the client is the bank" block to the root CLAUDE.md so the model applies the stricter rules when it recognises that client D) Put the bank's rules into each analyst's personal instruction file so that every report they write follows them

Understand Q271 · the situation and each part of the question

The real situation behind this question

A research consultancy produces market reports for dozens of clients from one repository, each client in its own folder. The root instructions define house style, citation format and source standards. A new client, a regulated bank, needs British spelling, a mandatory risk-disclosure section and peer-reviewed sources only, and its compliance team will check every report. The other clients must not change. Analysts already start each job from the relevant client folder, and the partners want the bank's rules to apply automatically without anyone remembering a special step.

Read the question in parts

Part 1 · but only for its own reports

The rules must be scoped to one client's work, not added globally for every job.

Part 2 · Analysts start each job from the client's folder

The launch directory already identifies the client, which directory-level instruction files can use.

What you are being asked to decide

How do you apply special rules for one client without affecting the others? Use directory scoping of instruction files for a subset of work.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
directory-level CLAUDE.mdan instruction file in a subfolder, loaded with its parents when work starts there
defaultsthe root instructions that every client's work inherits

Study: CLAUDE.md: the memory hierarchy Study: Which instructions are loaded CLAUDE.md settings-precedence

Understand Q271's answer · full reasoning and worked examples
Claude synthesized · the point, straight

Instruction files layer by directory: a session loads the CLAUDE.md in its launch folder and every parent. Putting client-specific rules in that client's folder scopes them precisely, where a conditional in the root file leaks them everywhere and relies on the model to notice.

Connect the design to the situation

One bank client needs stricter report rules; other clients keep defaults.

Best answer: B. Claude Code loads CLAUDE.md files from the launch directory and its parents, so a clients/bank/CLAUDE.md adds the bank's rules to the root defaults only for jobs started there. A conditional block in the root file puts the bank's rules into every client's session and relies on the model to recognise when they apply.

What each choice would do here

A · Why this does not meet the full requirement

Add the bank's rules as environment variables in the project settings file so that they are applied to each run

Settings configure the runtime; environment variables are not instructions.

The settings file can set environment variables for the tools Claude runs, but those are not instructions the model reads. The report rules would not reach the model, so the bank's requirements would be silently ignored.

B · Why this meets the requirement

Create clients/bank/CLAUDE.md with the extra rules, so jobs started in that folder load it on top of the root defaults

Scoped by folder, layered on the defaults, and shared through the repository.

When an analyst starts Claude Code in clients/bank, it loads that folder's CLAUDE.md along with the root file, so the bank rules add to the defaults. Jobs started in any other client folder never see them, and the file is committed for every analyst.

C · Why this does not meet the full requirement

Add an "if the client is the bank" block to the root CLAUDE.md so the model applies the stricter rules when it recognises that client

Always loaded for every client and depends on the model spotting the condition.

A conditional block works only if the model notices the condition, and it places the bank's rules in context for every other client too. A slip in either direction produces a wrong report, which is the kind of risk the partners want to remove.

D · Why this does not meet the full requirement

Put the bank's rules into each analyst's personal instruction file so that every report they write follows them

Would apply to every client the analyst serves and is not shared.

Personal instruction files apply to everything that analyst does, so other clients' reports would pick up British spelling and the risk section. They also are not shared, so a new analyst would miss the rules entirely.

Check your understanding · explain the design in your own words

How do you apply special rules for one client without affecting the others?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Study: CLAUDE.md: the memory hierarchy Study: Which instructions are loaded

Study: CLAUDE.md: the memory hierarchy Study: Which instructions are loaded CLAUDE.md settings-precedence

Return to Q271's situation and clause-by-clause explanation

Q272. A database team defines three Claude Code subagents: schema-reader should only inspect code, migration-writer creates migration files, and release-runner executes the deploy script. In a trial, schema-reader edited a file while "helpfully" fixing a typo. How should the team make sure each subagent can only use the tools of its role? A) Give all three subagents every tool and have the main agent route tasks so that each role gets suitable work B) Add a deny rule for Edit and Write to the project settings so that no agent in the session can modify files C) Add a sentence to each subagent's system prompt stating which tools it may use and which it must avoid D) Set the tools field in each subagent's definition, for example Read, Grep and Glob only for schema-reader

Understand Q272 · the situation and each part of the question

The real situation behind this question

A database team split their migration workflow across three Claude Code subagents to keep responsibilities clear: one that reads schema and code, one that writes migration files, and one that runs the deploy script. During a trial the schema reader spotted a typo in a comment and fixed it, editing a file nobody expected it to touch. It was harmless, but the team realised that the same freedom could let the reader run the deploy script. They want the roles enforced, not merely described.

Read the question in parts

Part 1 · schema-reader should only inspect code

This role must be read-only, so write and shell tools must be unavailable to it.

Part 2 · can only use the tools of its role

The control must be per subagent and must enforce, which rules out shared or advisory options.

What you are being asked to decide

How do you stop a helper agent from using tools outside its role? Scope capability per subagent in configuration rather than instructions.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
tools fieldthe list in a subagent definition that sets which tools it can call
least privilegeeach role gets only the capabilities its job needs
subagenta specialised helper with its own prompt, context and tool set

Study: Tool availability versus permission Study: Read an allowed-tools list precisely subagent least privilege allowlist

Understand Q272's answer · full reasoning and worked examples
Claude synthesized · the point, straight

Describing a role in a prompt is guidance; limiting its tools is enforcement. Setting the tools list in each subagent's definition gives each role exactly its capabilities, while a shared deny rule is too broad and routing is still a model choice.

Connect the design to the situation

A read-only helper edited a file while fixing a typo.

Best answer: D. The tools field in a subagent's frontmatter defines which tools that subagent can call, so schema-reader simply has no Edit or Write to use. A prompt sentence is guidance the subagent already overrode once, and a project-wide deny rule would also block migration-writer, whose job is to write files.

What each choice would do here

A · Why this does not meet the full requirement

Give all three subagents every tool and have the main agent route tasks so that each role gets suitable work

Routing is a choice made by a model, not a restriction.

Routing work carefully keeps most tasks with the right role, but every subagent could still call every tool. The trial failure was exactly a subagent choosing an extra action inside its assigned task, which routing does not prevent.

B · Why this does not meet the full requirement

Add a deny rule for Edit and Write to the project settings so that no agent in the session can modify files

Blocks the writer role too, since it applies to everyone.

A deny rule in project settings is enforced, which is the right kind of control, but at the wrong scope. It would apply to every agent in the session, so migration-writer could no longer create migration files.

C · Why this does not meet the full requirement

Add a sentence to each subagent's system prompt stating which tools it may use and which it must avoid

Instructions are guidance; the reader already ignored its role once.

A sentence in the subagent prompt describes the role well, and it is worth keeping. But it is guidance, and the trial already showed a helpful model overriding it. It cannot stop the reader from editing or running the deploy script.

D · Why this meets the requirement

Set the tools field in each subagent's definition, for example Read, Grep and Glob only for schema-reader

Each role's tool list is enforced by configuration.

In .claude/agents/schema-reader.md, setting tools to Read, Grep and Glob gives that subagent only those capabilities. migration-writer gets Read and Write, release-runner gets Bash, and each is restricted at the configuration level.

Walk through complete payloads or code · every step explained

Illustrative examples, not recorded live calls. Check each block's direction and endpoint: API requests, API responses, MCP messages, and configuration files are different contracts.

A read-only subagent definition

TEXT
---
name: schema-reader
description: Inspects schema and data-access code and reports findings. Never modifies files.
tools: Read, Grep, Glob
---
You analyse database schema and queries and report findings with file references.

The tools line is what enforces the role; the description and body explain it. Omitting tools would make the subagent inherit every tool, including Edit and Bash.

Which omitted settings use defaults or leave features unconfigured?

Check your understanding · explain the design in your own words

How do you stop a helper agent from using tools outside its role?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Study: Tool availability versus permission Study: Read an allowed-tools list precisely

Study: Tool availability versus permission Study: Read an allowed-tools list precisely subagent least privilege allowlist

Return to Q272's situation and clause-by-clause explanation

Q273. A billing agent built on the Agent SDK can call an issue_refund tool. Finance now requires a named approver to sign off every refund before money moves; the agent should still identify refunds and prepare them. Which change meets the requirement? A) Keep issue_refund but cap each run at one turn so the agent can issue at most a single refund per conversation B) Keep issue_refund and add a system prompt rule saying the agent must never issue a refund without approval C) Keep issue_refund and add a PostToolUse hook that notifies the approver about each refund as soon as it is issued D) Remove issue_refund from the agent and give it a propose_refund tool that only writes a pending request to the approval queue

Understand Q273 · the situation and each part of the question

The real situation behind this question

An online retailer runs a billing agent built on the Agent SDK. It reads customer tickets, checks orders and, until now, issued refunds directly through a tool. After an audit, finance ruled that every refund needs sign-off from a named approver before any money moves. The agent is still valuable for finding eligible cases and preparing the amounts and reasons. The engineering lead has to change the design so the agent keeps doing the analysis while the actual refund can only happen after a person approves it.

Read the question in parts

Part 1 · before money moves

Approval must happen before execution, so any after-the-fact control fails the requirement.

Part 2 · should still identify refunds and prepare them

The agent keeps its analysis role and needs a way to hand off a complete proposal.

What you are being asked to decide

How do you make an agent ask for approval instead of acting? Separate proposing an action from executing it when approval is required.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
human in the loopa person must approve before a consequential action executes
request-only toola tool that records a pending request and performs no restricted action

Study: Request approval without executing the action Study: Where enforcement actually lives HITL least privilege Agent SDK

Understand Q273's answer · full reasoning and worked examples
Claude synthesized · the point, straight

If a human must approve before an action happens, the agent must not hold the ability to perform it. Replace the executing tool with a request-only path, and let a separately authorised executor act after sign-off; notifications and prompt rules do not stop the action.

Connect the design to the situation

A billing agent must propose refunds, not issue them.

Best answer: D. Removing issue_refund means the agent cannot move money at all, and propose_refund records a pending request that a separate, authorised executor completes after the approver signs off. A notification after issuing is too late because the refund already happened, and a prompt rule is guidance the agent can still break.

What each choice would do here

A · Why this does not meet the full requirement

Keep issue_refund but cap each run at one turn so the agent can issue at most a single refund per conversation

Limits volume, not authority; one unapproved refund still happens.

Limiting turns reduces how many actions a run can take but does not remove the authority to refund. A single unapproved refund in the only turn still violates the requirement, and the limit also cripples the agent's analysis.

B · Why this does not meet the full requirement

Keep issue_refund and add a system prompt rule saying the agent must never issue a refund without approval

Guidance only; the capability to refund remains.

A system prompt rule states the policy clearly and will usually be followed. The agent still holds a working refund tool, so a confused or manipulated run can issue a refund anyway, which the finance rule does not allow.

C · Why this does not meet the full requirement

Keep issue_refund and add a PostToolUse hook that notifies the approver about each refund as soon as it is issued

Detective and after the fact: the money has already moved.

A PostToolUse notification runs after issue_refund has completed, so the approver learns about money that has already left. It is a useful audit signal, but it is detective, not preventive, and fails the explicit before-money-moves rule.

D · Why this meets the requirement

Remove issue_refund from the agent and give it a propose_refund tool that only writes a pending request to the approval queue

The agent can only propose; execution waits for approval elsewhere.

Without issue_refund the agent has no way to move money. propose_refund writes a pending record with order, amount and reason; after the approver signs off, a separate service with refund permission executes it, ideally once per request id.

Walk through complete payloads or code · every step explained

Illustrative examples, not recorded live calls. Check each block's direction and endpoint: API requests, API responses, MCP messages, and configuration files are different contracts.

Agent options: the refund capability is gone

PYTHON
from claude_agent_sdk import ClaudeAgentOptions

options = ClaudeAgentOptions(
    mcp_servers={"billing": billing_server},
    allowed_tools=[
        "mcp__billing__lookup_order",
        "mcp__billing__propose_refund",
    ],
    disallowed_tools=["mcp__billing__issue_refund"],
)

The billing server should also stop exposing issue_refund to this agent, and the agent's backend identity should lack refund permission. A separate executor processes approved requests.

Which omitted settings use defaults or leave features unconfigured?

Check your understanding · explain the design in your own words

How do you make an agent ask for approval instead of acting?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Study: Request approval without executing the action Study: Where enforcement actually lives

Study: Request approval without executing the action Study: Where enforcement actually lives HITL least privilege Agent SDK

Return to Q273's situation and clause-by-clause explanation

Q274. A custom agent loop built on the Messages API triages support tickets. Its registry currently offers eight tools, including refund_order, close_account and reset_password, and a new tool is added most months. The triage job needs only read_ticket, search_kb and add_label. A security review asks for a configuration that stays safe as the registry grows. Which one? A) Build the request's tools array from an explicit list of read_ticket, search_kb and add_label, so nothing else is ever offered B) Offer every registry tool except refund_order, close_account and reset_password, which are filtered out by name C) Offer every registry tool and log each call to a restricted tool so the security team can review misuse weekly D) Offer every registry tool and state in the system prompt that only the three triage tools may be used

Understand Q274 · the situation and each part of the question

The real situation behind this question

A software company's support team uses a custom agent loop on the Messages API to triage incoming tickets. The application keeps a shared tool registry for several agents, and it now includes powerful tools such as refunds, account closure and password resets. Platform engineers add a tool most months. A security review noticed the triage agent is offered every registered tool even though it only reads tickets, searches the knowledge base and adds labels, and asked for a configuration that stays safe as the registry keeps growing.

Read the question in parts

Part 1 · a new tool is added most months

The design must remain safe for tools that do not exist yet, which favours default exclusion.

Part 2 · stays safe as the registry grows

Blocking only today's dangerous tools is insufficient; future tools must be excluded unless approved.

What you are being asked to decide

How do you limit an agent to the tools it needs even as new tools appear? Choose allowlist over denylist for least-privilege tool exposure.

Keep all the stated requirements in view. An option may be useful elsewhere while addressing only part of this situation.

Words and related concepts · open glossary explanations
TermMeaning here
allowlistonly listed tools are offered; everything else is excluded by default
tool registrythe application's catalogue of tools that could be offered
least privilegethe agent gets exactly the capabilities its job needs

Study: Tool availability versus permission Study: Read an allowed-tools list precisely allowlist least privilege tool registry

Understand Q274's answer · full reasoning and worked examples
Claude synthesized · the point, straight

Least privilege means naming what an agent may use, not what it may not. An explicit allowlist keeps new tools out by default, while denylists, prompt rules and logs each leave the agent able to call something it should not.

Connect the design to the situation

A triage agent needs three of eight tools, and more are added monthly.

Best answer: A. An explicit allowlist means the model is only offered the three triage tools, and a tool added next month is excluded until someone deliberately adds it. A name-based denylist blocks today's dangerous tools but offers each new tool automatically, which is the growth risk the review raised.

What each choice would do here

A · Why this meets the requirement

Build the request's tools array from an explicit list of read_ticket, search_kb and add_label, so nothing else is ever offered

Only the needed tools are offered, and new ones stay out by default.

The harness builds the tools array from three named entries, so the model can only request those operations. When a new tool is registered next month, triage never sees it unless someone deliberately adds it. Backend credentials for triage should be read-mostly as a second layer.

B · Why this does not meet the full requirement

Offer every registry tool except refund_order, close_account and reset_password, which are filtered out by name

New tools are offered automatically until someone adds them to the denylist.

Filtering out three names blocks today's risky tools. The next tool added, perhaps delete_attachment, would be offered to triage automatically until someone remembers to extend the filter, which is exactly the growth risk raised.

C · Why this does not meet the full requirement

Offer every registry tool and log each call to a restricted tool so the security team can review misuse weekly

Detects misuse after the fact instead of preventing it.

Weekly log review would reveal misuse eventually, which is valuable for audit. But the refund or account closure would already have happened, so it detects damage rather than preventing it.

D · Why this does not meet the full requirement

Offer every registry tool and state in the system prompt that only the three triage tools may be used

Every tool is still offered; the prompt is only guidance.

The model would still see refund, closure and reset tools in its request, and a system prompt rule is guidance. A confused or injected ticket could lead the agent to call a powerful tool that was offered to it.

Walk through complete payloads or code · every step explained

Illustrative examples, not recorded live calls. Check each block's direction and endpoint: API requests, API responses, MCP messages, and configuration files are different contracts.

Build the tools array from an allowlist

PYTHON
TRIAGE_TOOLS = ["read_ticket", "search_kb", "add_label"]

def tools_for_triage(registry):
    return [registry[name] for name in TRIAGE_TOOLS]

response = client.messages.create(
    model=MODEL,
    max_tokens=1024,
    tools=tools_for_triage(REGISTRY),
    messages=messages,
)
🏭 Production shape: registry of decorated tool functions

In production the registry holds @beta_tool functions, not hand-written dicts. The SDK builds each definition from the function. The runner only knows the tools you pass; if the model names any other tool, the runner returns an error result and runs nothing.

PYTHON
import os
from typing import Annotated

import anthropic
from anthropic import beta_tool
from pydantic import Field

from app.tickets import service  # your own ticket service

client = anthropic.Anthropic()  # reads ANTHROPIC_API_KEY
MODEL = os.environ.get("CLAUDE_MODEL", "claude-sonnet-5")


@beta_tool(name="add_label", description="Add one triage label to a ticket.")
def add_label(
    ticket_id: Annotated[str, Field(description="The ticket id, e.g. T-2291.")],
    label: Annotated[str, Field(description="One label from the triage list, e.g. billing.")],
) -> str:
    return service.add_label(ticket_id, label)


# read_ticket, search_kb, close_ticket, issue_refund are defined the same way
REGISTRY = {t.name: t for t in [read_ticket, search_kb, add_label, close_ticket, issue_refund]}
TRIAGE_TOOLS = ["read_ticket", "search_kb", "add_label"]


def triage(messages: list) -> object:
    runner = client.beta.messages.tool_runner(
        model=MODEL, max_tokens=1024,
        tools=[REGISTRY[name] for name in TRIAGE_TOOLS],  # only these exist for this agent
        messages=messages,
        max_iterations=8,
    )
    return runner.until_done()

What the SDK generates:

JSON
{
  "name": "add_label",
  "description": "Add one triage label to a ticket.",
  "input_schema": {
    "type": "object",
    "properties": {
      "ticket_id": {"type": "string", "description": "The ticket id, e.g. T-2291.", "title": "Ticket Id"},
      "label": {"type": "string", "description": "One label from the triage list, e.g. billing.", "title": "Label"}
    },
    "required": ["ticket_id", "label"],
    "additionalProperties": false
  }
}

Tools in app/tools/tickets.py (+ the registry); the triage runner in app/agents/triage.py.

Only named tools are ever offered. The dispatcher should also refuse any tool name outside the list, in case a model output names one anyway.

Not supplied in this example · settings and defaults

context_management — not supplied here. No server compaction strategy is enabled by this body. Host/manual compaction is separate.

output_config — not supplied here. No output_config schema or effort override is supplied. A prompt asking for JSON does not provide schema enforcement.

tool_choice — not supplied here. With tools supplied, the default is auto: the model chooses whether to request a tool. Without tools, no supplied tool can be selected.

system — not supplied here. No application system instructions are supplied through this field. User messages still provide task text.

stop_sequences — not supplied here. No custom stop strings are configured. Generation can still stop for end_turn, tool_use, max_tokens, or another documented reason.

stream — not supplied here. For a direct non-streaming create/parse call, the result is one message rather than an event stream. A stream helper configures this separately.

thinking — not supplied here. No explicit thinking override is shown. Behavior depends on the selected model; omission does not universally mean thinking is off.

cache_control — not supplied here. No top-level automatic cache marker is supplied. Check nested system/tool/content blocks for separate cache_control markers.

metadata — not supplied here. No application user reference is supplied through metadata. Authentication still comes from the request credentials.

betas — not explicitly supplied. No beta list appears in these calls. SDK/client configuration can add headers; inspect those before assuming no beta header is sent.

Which omitted settings use defaults or leave features unconfigured?

Check your understanding · explain the design in your own words

How do you limit an agent to the tools it needs even as new tools appear?

Describe the situation, identify the controlling requirement, and explain what the chosen design does before and after the critical step. Then choose one alternative and explain which part of this situation it fails to address. Use the example rather than memorizing the answer letter.

Study: Tool availability versus permission Study: Read an allowed-tools list precisely

Study: Tool availability versus permission Study: Read an allowed-tools list precisely allowlist least privilege tool registry

Return to Q274's situation and clause-by-clause explanation