Skip to content
CCAR-F Prep

Domain 3 · 20% of exam

Claude Code Configuration & Workflows cheat sheet

The idea this domain hangs on

Every configuration question is two questions: who gets it (scope) and when does it load (always, on matching files, on demand, or every time without exception).

Who gets itWhere it lives
Only you, every project~/.claude/ (CLAUDE.md, rules/, skills/, commands/, agents/, settings.json); MCP user scope in ~/.claude.json
Only you, this projectCLAUDE.local.md, .claude/settings.local.json; MCP local scope in ~/.claude.json
The whole team, on cloneCLAUDE.md or .claude/CLAUDE.md, .claude/rules/, .claude/skills/, .claude/commands/, .claude/agents/, .claude/settings.json, .mcp.json
Everyone in the organisationManaged policy
When it loadsMechanism
Every session, at launchCLAUDE.md, @imported files, rules without paths:
When Claude works with matching filesRules with a paths: glob; subdirectory CLAUDE.md when Claude reads files there
On demandSkills and commands
Every time, guaranteedHooks and settings.json (CLAUDE.md is guidance)
  • The workflow tasks follow the same test: plan mode when the approach is undecided (3.4), concrete examples over more prose (3.5), -p or the CI job hangs (3.6).

CLAUDE.md hierarchy (3.1)

ScopeLocationShared via git?
Managed policyOS-specific system path (e.g. /etc/claude-code/CLAUDE.md)N/A — cannot be excluded
User~/.claude/CLAUDE.mdNo
Project.claude/CLAUDE.md or root CLAUDE.mdYes
Directorysubdirectory CLAUDE.mdYes (loads on demand)
LocalCLAUDE.local.md (any level)No — gitignore it
  • Load order: broadest → most specific; CLAUDE.local.md loads after CLAUDE.md at the same level.
  • Conflict handling: files are concatenated, never overridden. "Claude may pick one arbitrarily" on a real conflict — remove the contradiction.
  • Enforcement: CLAUDE.md is guidance, not enforcement — for a rule that must hold every time, use settings.json or a hook.
  • Exam trap: new teammate gets inconsistent behaviour after cloning → conventions are almost always sitting in someone's ~/.claude/CLAUDE.md instead of project-level.
  • Directory-level file loads the first time Claude reads or edits a file in that subdirectory, after start-up — one reason two sessions behave differently.

@ import syntax

  • Directive is a bare @path on its own line — no @import keyword in current docs (the exam guide calls the feature "@import" anyway).
  • Relative paths resolve from the importing file, not the launch directory.
  • Imports load at launch — they organise, they save no context. To shrink context, use path-scoped rules (3.3).
  • Importing a file from outside the project triggers an approval dialog.
  • Max recursion depth: 4 hops (older docs said 5).
  • Skips markdown code spans/fenced blocks — backtick a path to mention without importing.
  • Cross-worktree personal prefs: import a home-directory file, e.g. @~/.claude/my-project-instructions.md.

File handling

  • Block-level HTML comments are stripped before CLAUDE.md enters context (free maintainer notes).
  • A CLAUDE.md over 4 MiB is skipped entirely.
  • claudeMdExcludes — glob patterns that skip other teams' CLAUDE.md files in a monorepo; cannot exclude managed policy.
  • .claude/rules/ is discovered recursively and supports symlinks; ~/.claude/rules/ loads before project rules and neither overrides.
GoalMechanism
Organise a large file for editing@ imports or .claude/rules/
Reduce what loads into context.claude/rules/ with paths:
Load a procedure only when neededa skill
Guarantee something happens or is blockeda hook or settings.json

settings.json precedence (separate system from CLAUDE.md!)

managed > CLI args > local > project > user (strict — a deny at any level can't be overridden by any other level)

FileScopeShared?
~/.claude/settings.jsonUserNo
.claude/settings.jsonProjectYes
.claude/settings.local.jsonProject-personalNo
enterprise managed-settings.jsonOS-specific pathN/A
  • /init — generates/improves CLAUDE.md from codebase analysis.
  • /memory — exam answer for verifying which memory files are loaded; never triggers loading (current product: /memory edits memory files and toggles auto memory, /context all lists what loaded under Memory files).
  • Not-followed ladder: loaded? → scope → conflict → specificity → must it hold every run (hook/settings).
  • Recommended size: under 200 lines per CLAUDE.md.

Slash commands & skills (3.2)

CommandSkill
File shapeflat .mddirectory + SKILL.md
Path.claude/commands/name.md.claude/skills/name/SKILL.md
Name conflict—skill wins
  • Scoping: .claude/ = project (git-shared); ~/.claude/ = personal. A loose .md in .claude/skills/ is never discovered.
  • Two questions: who gets it (shared/personal) × when it loads (always/on demand).
  • Precedence: enterprise > personal > project — a same-named personal skill silently shadows the team's; give a variant its own name (/review-strict).
  • name — sets the / command you type; the directory name also invokes the skill.
  • description + when_to_use — truncated at 1,536 chars in the skill listing; key use case first.
  • $ARGUMENTS — all args; auto-appended as ARGUMENTS: <value> if unreferenced.
  • $N / $ARGUMENTS[N] — positional, 0-based ($0 = first arg).
  • !`cmd` — runs shell command pre-send; placeholder becomes real output.
  • context: fork — isolated subagent context; pair with agent: (Explore/Plan/general-purpose, default general-purpose). The fork sees the SKILL.md body as its prompt, the agent type's configuration and CLAUDE.md (not for Explore/Plan or with omitClaudeMd) — never the conversation.
  • Don't fork: guidelines-only skills, skills that need the conversation, small output.
  • background (with fork) — defaults to true; false makes the invoking turn wait.
  • allowed-tools — current docs: pre-approves for the invoking turn only (NOT a restriction). Exam-guide answer: restricts tool access. Real boundary: disallowed-tools or a deny rule.
  • argument-hint — current docs: autocomplete hint, e.g. [issue-number], nothing enforced. Exam-guide answer for "developers forget the parameter".
  • disable-model-invocation: true — user-only invocation, description hidden from context.
  • user-invocable: false — Claude-only invocation, hidden from / menu.
  • Skill(name) exact match / Skill(name *) prefix match — permission rule syntax.
  • MCP prompts as commands: /mcp__servername__promptname.
  • Four "forks": context: fork skill (no conversation) · --fork-session (whole session, yes) · forked subagent (yes) · ordinary subagent (no, spawn prompt only).
  • Decision rule: CLAUDE.md = always-loaded facts; skills = on-demand procedures; hook = guarantee.

Path-specific rules (3.3)

---
paths: ["terraform/**/*", "**/*.tf"]
---
  • Lives in .claude/rules/*.md, discovered recursively.
  • No paths field → loads at launch, same priority as .claude/CLAUDE.md.
  • Trigger: Claude working with a matching file — reading is enough, no write, no invocation.
  • Several matching rules: all load; no "most specific glob wins" tiebreak.
  • Brace expansion: src/**/*.{ts,tsx}. Any test file anywhere: **/*.test.*.
  • src/components/*.tsx = that directory only; src/**/*.tsx = any depth.
  • *.md = anywhere under the project; /*.md = project root only.
  • ~/.claude/rules/ = personal, applies to every project; loads before project rules, so project rules sit later in context — but neither overrides the other: on a conflict Claude may follow either.
  • After /compact: root CLAUDE.md re-injected; nested CLAUDE.md and path rules reload only when a matching file is next touched.
  • Splitting into rules without paths, or into @ imports, saves no context — paths is what makes loading conditional.
  • Verify what loaded: /memory on the exam; /context all in today's product.
  • Use over directory CLAUDE.md when a file type is scattered across many directories (e.g. co-located tests).
  • Use over root CLAUDE.md when the convention shouldn't burn tokens on unrelated file types.

Plan mode vs direct execution (3.4)

  • Enter: Shift+Tab · /plan prefix · claude --permission-mode plan.
  • Restricts: edits, until plan approved (exception: bypassPermissions sessions).
  • Approve options: first is "Yes, and use auto mode"; the rest vary by session (typically "Yes, manually approve edits" / "No, keep planning").
  • Ctrl+G — edit the plan directly in your text editor.
  • Approving exits plan mode into the chosen mode; Shift+Tab again leaves without approving.
  • Project default: permissions.defaultMode: "plan" in .claude/settings.json (auto/bypassPermissions as defaultMode are ignored in project and local settings).
ModeRuns w/o asking
defaultreads only
acceptEditsreads, edits, common fs commands
planreads + classifier-approved (if auto available)
autoeverything, safety-checked
dontAskpre-approved only
bypassPermissionseverything (explicit ask rules and the destructive-command circuit breaker still prompt)
  • Deciding question: is the approach already determined? Not difficulty, stakes or file count. More than one reasonable way, or scope unknown → plan; otherwise → direct.
  • 30-file mechanical rename → direct. One-file change with two defensible designs → plan.
  • Hybrid: plan the migration, approve, then execute directly. "Stay in plan mode throughout" is wrong — plan decides, execution executes.
  • Plan mode protects the codebase; Explore protects the context window. Context exhaustion during discovery → Explore.
  • Explore subagent: read-only (Write/Edit denied); parent's model; thoroughness quick/medium/very thorough.
  • Explore and Plan start without CLAUDE.md and the git status snapshot; other built-in and custom subagents load both unless omitClaudeMd is set. Both are one-shot (no agent ID, cannot be resumed) — use general-purpose or a custom subagent for resumable work.
  • Workflow: Explore → Plan → Implement → Commit. Skip the plan if you could describe the diff in one sentence.

Iterative refinement (3.5)

SituationTechnique
Inconsistent prose interpretation2-3 concrete input/output examples, each where a reasonable implementer would guess wrong
Complex transform, many edge casesTest-driven iteration (paste the failures, don't describe them)
One edge case mishandled (nulls in a migration)One test case: the null input and its exact expected output
Unfamiliar domainInterview pattern (Claude asks questions first)
Unknown code / unknown requirements / bothPlan mode / interview / interview then plan
Fixes interactBatch feedback, one message
Fixes independentSequential feedback
Must hold every timeA hook, not another round of feedback
  • Interacting? Does fixing A change the right fix for B? Independent? Could they ship in separate PRs? Coupling decides — not file, severity or effort.
  • /compact <instructions> — targeted summary mid-session.
  • --fork-session (with --continue/--resume) or /branch — compare divergent fixes.
  • /rewind (or Esc-Esc) — restores code/conversation/both. A file only Bash changed isn't tracked; once Claude has edited a file with its editing tools, /rewind also undoes later Bash changes to it. Last 100 checkpoints kept.
  • Writer/Reviewer pattern — independent session reviews without the writer's reasoning bias.

CI/CD integration (3.6)

  • -p / --print — non-interactive mode. The most tested fact in Domain 3. Invented distractors: CLAUDE_HEADLESS, --batch, --headless, --ci, < /dev/null; --max-turns 1 doesn't fix a hang.
  • --output-format: text (default) / json (+ total_cost_usd, cost breakdown) / stream-json (NDJSON).
  • --json-schema — validated output in print mode; lands in structured_output field with --output-format json (not result, which is text). Missing structured_output → fail the job, never "no findings".
  • --bare — skips hooks/skills/plugins/MCP/auto-memory/CLAUDE.md; reproducible; will become -p default.
  • Runner-independent CI: --setting-sources project (partial: managed policy, ~/.claude.json, auto memory still read) · --strict-mcp-config + --mcp-config (declared servers only) · --bare (full, but no CLAUDE.md).
  • Bounding: -p has no turn limit by default — set --max-turns; cap spend with --max-budget-usd.
  • dontAsk mode — deny-by-default, for locked-down CI.
  • Piped stdin cap: 10MB. SIGTERM on -p → aborts turn, runs SessionEnd hooks, exit 143.
  • Session isolation: same session that wrote code reviews it worse (retains self-justifying reasoning) — use an independent claude -p invocation; --continue/--resume into the generating session undoes it.
  • Duplicate PR comments: prior findings in context and an instruction to report only new or still-unaddressed issues — both halves. Re-run-aware fields: finding_id, previously_reported.
  • Duplicate test scenarios: existing test files in context. Low-value tests: testing standards, valuable-test criteria and fixtures in CLAUDE.md.
  • CLAUDE.md in CI: loads exactly as interactive for a plain -p run (not under --bare) — the exam's way to supply testing standards, fixtures, review criteria.
  • Batch API: 50% cheaper, up to 24h, no latency SLA → never for pre-merge (blocking) checks; fine for nightly/weekly.
  • GitHub Actions: built on Agent SDK; @claude mention (default trigger_phrase); app needs read & write on Contents/Issues/Pull requests; claude_args = full CLI passthrough; no documented default turn cap — pass --max-turns via claude_args.
  • CI gate idea: fail on non-empty plugin_errors / mcp_server_errors in the stream-json system/init event.

Known exam-guide vs current-docs divergences

See research/divergences/domain-3.md for full detail. Quick list:

  • allowed-tools restricts (exam guide) vs pre-approves (current docs; disallowed-tools is the real boundary).
  • argument-hint prompts for required parameters (exam guide) vs autocomplete hint only (current docs).
  • /memory verifies loaded memory files (exam guide) vs /context all lists what loaded, /memory edits (current docs).
  • CLAUDE.md supplies CI project context (exam guide) vs --bare, which skips CLAUDE.md, recommended for scripted calls (current docs).
  • "@import syntax" (exam guide's name) vs bare @path, no keyword (current docs).
  • @ import depth: 4 hops now (was 5 in older docs).
  • Slash commands and skills are one merged system in current docs; the exam guide still frames them as two separate features.
  • Positional arguments ($N) are 0-based in current docs.
  • Permission modes now also include auto and dontAsk, beyond the plan/direct binary the exam guide frames.