🎓 Claude Certification Prep

Home › CCAR-F › M03

Claude Code Configuration & Workflows

Domain 3 20% of exam 60 practice questions ~26 min read

CLAUDE.md hierarchy and modular organization, slash commands and skills, path-specific rules, choosing plan mode or direct execution, iterative refinement, and integrating Claude Code into CI/CD.

Skills measured in this domain:
  • 3.1 Configure CLAUDE.md files with appropriate hierarchy, scoping, and modular organization
  • 3.2 Create and configure custom slash commands and skills
  • 3.3 Apply path-specific rules for conditional convention loading
  • 3.4 Determine when to use plan mode vs direct execution
  • 3.5 Apply iterative refinement techniques for progressive improvement
  • 3.6 Integrate Claude Code into CI/CD pipelines

Domain overview

Domain 3, "Claude Code Configuration & Workflows", makes up 20% of the exam (about 12 of 60 questions). This domain doesn't test whether you know keyboard shortcuts; it tests whether you put the right kind of configuration in the right place: which instructions must reach every team member, which conventions should load only when needed, which work must be planned first, and how to run Claude Code in a pipeline without hanging or spamming comments.

Questions in this domain usually tie to three scenarios:

  • Scenario 2 – Code Generation with Claude Code: slash commands, CLAUDE.md, plan mode vs direct execution.
  • Scenario 4 – Developer Productivity: exploring unfamiliar codebases, the Explore subagent, skills for repetitive tasks.
  • Scenario 5 – Claude Code for CI: the -p flag, --output-format json + --json-schema, independent review, avoiding duplicate comments.

An orientation tip for the whole domain: each mechanism answers three questions: when it loads (always, by path, on demand, on an event), who gets it (committed in the repo or kept in ~/.claude/), and whether it is enforced (guidance or a deterministic hook). Most questions are solved by matching the item's requirements against these three axes.

(Sources: CCAR-F Exam Guide, Domain 3; Anthropic Academy: Introduction to agent skills — Skills vs. other Claude Code features; Anthropic Academy: Claude Code 101 — Hooks)

Configuring CLAUDE.md hierarchy and modular organization (3.1)

CLAUDE.md levels

CLAUDE.md is a Markdown file that Claude Code reads automatically at the start of a session, like an "onboarding script" for the codebase; its content is appended to the prompt. There are several levels, and they stack rather than replace one another:

Level Location Shared via version control? Should contain
Managed policy Managed by the organization's platform team Deployed centrally; users can't opt out Mandatory organization policies
User ~/.claude/CLAUDE.md No, only on your machine Personal preferences for all projects
Project CLAUDE.md at the repo root or .claude/CLAUDE.md Yes Shared team standards
Local CLAUDE.local.md (git-ignored) No Private notes for this repo, e.g. architecture decisions while refactoring on your own branch
Directory-level CLAUDE.md in a subdirectory Yes Conventions specific to the code in that directory

Key point

Instructions in ~/.claude/CLAUDE.md apply only to that user and don't travel with the repo. For every team member (including someone who just cloned the repo) to receive them, the instructions must be at the project level and committed.

Diagnosing hierarchy issues

A classic scenario: a new team member reports that Claude "doesn't follow the naming conventions", while everything works fine on the tech lead's machine. The root cause is usually that the conventions were written in the tech lead's ~/.claude/CLAUDE.md (user level), so only the tech lead's machine loads them. Fix: move the content to the project's CLAUDE.md and commit it.

Diagnostic tools: /memory checks which memory files are loaded (use it when behavior is inconsistent across sessions or machines); /context shows what is taking up the context. /init generates a starter CLAUDE.md from the codebase for you to trim down.

Modular organization: @import and .claude/rules/

When CLAUDE.md grows too large, there are two ways to reorganize it:

  1. @import: reference another file with the @path/to/file syntax. Each package can selectively import the relevant standards files, based on its maintainer's domain knowledge.
  2. .claude/rules/: replace one monolithic file with topic-specific files such as testing.md, api-conventions.md, deployment.md.
# packages/payments/CLAUDE.md
Payment processing package. All monetary amounts use the Decimal type, never float.

@../../standards/api-conventions.md
@../../standards/pci-logging.md

The payments package imports the PCI standard; the marketing-site package doesn't. The maintainer decides what is relevant.

Exam trap

@import helps with organization, not with reducing context. At startup, imported files are expanded inline right where they are referenced, so everything is still loaded upfront. If the goal is "load conventions only when needed", think of rules with paths (section 3.3) or skills, not imports.

Writing a CLAUDE.md that Claude actually follows

CLAUDE.md is guidance, not enforced configuration. Every line competes for attention with every other line: the longer the file, the less each rule is followed. Principles from the Claude Code in Action course:

  • Be specific, verifiable, and name the alternative: "Put new API routes in src/api/handlers, one route per file"; "Use named exports, not default exports".
  • Write normally, don't shout: "IMPORTANT" or "YOU MUST" rarely rescues an ignored rule and can make Claude over-apply it; if a rule gets lost, make the file shorter.
  • Move hard rules into hooks: "never push to main" must be a PreToolUse hook (blocking with exit code 2), not a line in CLAUDE.md.
  • Keep revising: when Claude makes the same mistake a second time, add the correction to CLAUDE.md; keep the file to about one page.

(Sources: Anthropic Academy: Claude Code in action — A CLAUDE.md that follows; Anthropic Academy: Claude Code 101 — The CLAUDE.md file; Anthropic Academy: The AI-native SDLC playbook — The CLAUDE.md; Anthropic Skills: claude-api — Prompt Audit: Finding and Removing Dated Prompting Patterns)

Custom slash commands and skills (3.2)

Slash commands: project and user scope

Project-scoped User-scoped
Location .claude/commands/ in the repo ~/.claude/commands/
Sharing Via version control; everyone who clones/pulls gets it Personal only; available in every project on your machine
Example /review runs the team's standard review checklist A command that writes commit messages in your own style

Each command is a .md file: frontmatter (e.g. description, allowed-tools) plus a body that is the prompt expanded on invocation. $ARGUMENTS receives the full argument string; $1, $2 receive positional arguments.

---
description: Review a pull request against the team checklist
allowed-tools: Bash(gh pr diff:*), Bash(gh pr view:*), Read, Grep, Glob
---
Review PR number $ARGUMENTS.
1. Run `gh pr view $ARGUMENTS` and `gh pr diff $ARGUMENTS`.
2. Report only bugs, security vulnerabilities, and spec violations; skip minor style issues.
3. For each finding, give: file:line, issue, severity, suggested fix.

Exam trap

There is no mechanism like ".claude/config.json with a commands array", and commands are not defined in CLAUDE.md either. Team-shared commands must live in the repo's .claude/commands/; if you put them in ~/.claude/commands/, teammates won't get them.

Skills: SKILL.md and frontmatter

A skill is a directory containing a SKILL.md file (exactly that name, "SKILL" in uppercase) with frontmatter and instructions. Project skills live in .claude/skills/<name>/, personal skills in ~/.claude/skills/<name>/. At startup, Claude Code loads only the name and description of each skill; the full SKILL.md is loaded only when a request matches the description (semantic matching) or the skill is invoked directly. So packaging repetitive workflows as skills costs very little context.

Frontmatter fields you need to know for the exam:

Field Effect
name Identifier; defaults to the directory name
description The most important field: Claude relies on it to decide whether to use the skill. It should answer "what the skill does" and "when to use it"
allowed-tools Configures tools for the skill while it runs; the Exam Guide uses it to restrict tools (e.g. to file write operations only) to prevent destructive actions
argument-hint Prompts for required parameters when a developer invokes the skill without arguments
context: fork Runs the skill in an isolated sub-agent context; only the result returns to the main conversation
model Selects the model for the skill
---
name: codebase-impact-analysis
description: Analyzes the impact of a change across the whole codebase. Use when asked "what does changing X affect", before migrating a library or changing a shared API.
argument-hint: "[module or API name to analyze]"
context: fork
allowed-tools: Read, Grep, Glob
---
1. Find every reference to the specified module/API with Grep and Glob.
2. Group by package and count the affected files.
3. Return only a summary table and the 3 biggest risks; do not paste file contents.

Key point

About allowed-tools: the Introduction to Agent Skills course explains that in current Claude Code, this field pre-approves the listed tools (they run without prompting) and does not by itself remove other tools; to exclude tools, use disallowed-tools. On the exam, follow how the Exam Guide frames it: allowed-tools is where you configure a skill's tool scope to prevent destructive actions.

context: fork: when you need it

Use context: fork for skills that produce verbose output (whole-codebase analysis) or exploratory context (brainstorming many alternatives). Without fork, every file read, grep result, and rejected idea spills into the main conversation; with fork, the main conversation receives only the summary.

Personal variants without affecting teammates

To customize a team skill for yourself, create a personal copy in ~/.claude/skills/ with a different name (e.g. review-strict-tuan) instead of editing the review skill in the repo. Why: editing the file in the repo affects the whole team; and when names collide, the precedence order is Enterprise → Personal → Project, so a personal skill with the same name will shadow the project skill on your machine and cause behavior that is hard to diagnose. Plugin skills are namespaced (/plugin-name:skill-name), so they don't conflict.

Progressive disclosure: keep SKILL.md under about 500 lines and move detailed documentation into reference files that Claude reads only when needed; scripts in the skill directory are executed, not loaded into context.

Choosing a mechanism: CLAUDE.md, skill, command, subagent, or hook?

Need Right mechanism Why
Always-applicable standards (TypeScript strict, test commands) CLAUDE.md Always loaded; every task needs them
Task-specific workflows (PR review checklist, migration procedure) Skill Loaded on demand; takes no context when not needed
Prompt templates a developer types deliberately Slash command Manually triggered, predictable behavior
Work that needs its own context or a different tool set (exploration, independent review) Subagent Isolated context; returns only a summary
Rules that must never be skipped (blocking writes to production directories) Hook Deterministic code that can block actions

Exam tip

"Always / every task" → CLAUDE.md. "Only when doing X" → skill. "Must be guaranteed / must never" → hook. "Verbose output pollutes the main conversation" → context: fork or a subagent. "The whole team gets it on clone" → a .claude/... directory in the repo.

(Sources: CCAR-F Exam Guide, Task 3.2; Anthropic Academy: Introduction to agent skills — Creating your first skill, Configuration and multi-file skills, Skills vs. other Claude Code features; Anthropic Academy: Claude Code in action — Verification skills; Claude Cookbooks: Claude Code slash commands — /review-pr-ci)

Path-specific rules (3.3)

Files in .claude/rules/ can declare a YAML frontmatter paths field containing glob patterns. Such a rule loads only when Claude edits a file that matches the pattern, which reduces irrelevant context and saves tokens.

---
paths: ["**/*.test.tsx", "**/*.test.ts"]
---
# Testing conventions
- Use React Testing Library; query by role, not by CSS class.
- Each test file has one describe block named after the component.
- Use fixtures in `test/fixtures/`; don't create fake data inline.
---
paths: ["terraform/**/*"]
---
# Terraform conventions
- Every resource must have `owner` and `cost-center` tags.
- Don't hard-code the region; use the `var.region` variable.

Glob rule or subdirectory CLAUDE.md?

Criterion CLAUDE.md in a subdirectory Rule in .claude/rules/ with paths
Scope Tied to one directory By pattern, wherever the file lives
Test files spread across the codebase (Button.test.tsx next to Button.tsx) Must be duplicated into every directory; hard to maintain A single **/*.test.tsx pattern is enough
Conventions for one concentrated area (terraform/) Works Works (terraform/**/*)
Activation mechanism By directory location Matches the path of the file being edited; deterministic

Exam trap

Putting every convention into the root CLAUDE.md under "React / API / Test" headings and letting Claude infer which part applies relies on inference, which is less reliable and wastes context. Turning each convention into a skill is also wrong if the item requires conventions to apply automatically by file path, because skills must be invoked or depend on Claude choosing to load them.

Scenario example

A codebase has React components (functional + hooks), API handlers (async/await with their own error handling), DB models (repository pattern), and test files placed next to the source everywhere. The team wants Claude to apply the right conventions automatically when generating code. The most maintainable answer: one rule file per area in .claude/rules/ with matching paths (src/components/**/*, src/api/**/*, **/*.test.tsx). Eliminate: a root CLAUDE.md that holds everything (inference), a CLAUDE.md per directory (can't cover scattered test files), skills (don't activate automatically by path).

Plan mode vs direct execution (3.4)

What plan mode is for

In plan mode, Claude reads files and runs commands to explore but cannot edit files until you approve the plan. Turn it on with Shift+Tab until the status bar shows plan mode. Use plan mode when the task involves:

  • Large-scale, multi-file changes (e.g. a library migration affecting 45+ files);
  • Several valid approaches to choose from (e.g. two integration approaches with different infrastructure requirements);
  • Architectural decisions (splitting a monolith into microservices, defining service boundaries).

The core value is exploring and designing before committing to changes, avoiding costly rework. Read the plan carefully and ask "which step is riskiest, which alternatives were rejected" before approving it.

When to use direct execution

Simple, well-scoped changes: a single-file bug fix with a clear stack trace, adding a date check conditional, adding one validation to a function.

Situation Mode Reason
Splitting a monolith into microservices Plan mode Architectural decision, dozens of files
Migrating a logging library across 45+ files Plan mode to investigate, then direct execution following the plan Needs a dependency map first, then execution
Choosing between webhooks and a message queue for an integration Plan mode Several valid approaches, different infrastructure
Single-file bug with a clear stack trace Direct execution Clear scope, one file
Adding an "end date ≥ start date" check Direct execution Small, clear change

Combining: plan, then execute

The recommended workflow is Explore → Plan → Code → Commit: use plan mode to investigate and design, approve the plan, then let Claude execute under the permission mode you choose. You can commit the approved plan as plan.md so the review step can check the diff against it.

The Explore subagent and protecting context

The exploration phase is "noisy": reading dozens of files, grepping, tracing function calls. Claude Code ships with built-in general-purpose, Explore (fast codebase search and navigation), and Plan (research in plan mode before presenting a plan) subagents. The Explore subagent runs in its own context window and returns only a summary: the main conversation records just the question and the answer, not the 15 files that were read. This is how you prevent context window exhaustion in multi-phase tasks.

Supporting commands: /compact <focus instructions> for a directed summary when you're still working on the same feature; /clear when switching to a new feature.

Exam trap

"Start with direct execution and switch to plan mode if it gets complicated" sounds flexible but is wrong when the item has already stated the complexity (dozens of files, service-boundary decisions). Likewise, "write a very detailed request and then execute directly" assumes you already know the right structure without having explored the code.

Key point

Plan mode = safe exploration (no file edits) + design up front. Explore subagent = isolates verbose discovery output and returns a summary. The two complement each other: plan mode decides when edits are allowed, Explore keeps exploration from polluting the main context.

(Sources: CCAR-F Exam Guide, Task 3.4; Anthropic Academy: Claude Code 101 — The explore → plan → code → commit workflow, Context management; Anthropic Academy: Introduction to subagents — What are subagents?; Anthropic Academy: Claude Code in action — Steering long sessions; Anthropic Academy: The AI-native SDLC playbook — Claude Code plan mode as the default starting point)

Iterative refinement techniques (3.5)

When the first result isn't right, how you give feedback determines how many iterations it takes. The Exam Guide lists five techniques:

Technique Use when Example
2–3 concrete input/output examples Prose descriptions are interpreted inconsistently Give 3 "raw address string → normalized object" pairs instead of writing more explanation
Test-driven iteration Behavior can be verified by tests Write tests for expected behavior, edge cases, and performance requirements first; iterate by sharing test failures
Interview pattern Unfamiliar domain with many design considerations "Before coding, ask me the questions you need about cache invalidation and failure modes"
Specific test cases for edge cases One edge case keeps being handled wrong Input with email: null in a migration script → keep the record unchanged and log a warning
One message vs sequential fixes Issues interact / are independent Schema bug and serializer bug depend on each other → one detailed message; three separately visible bugs → fix them one at a time

When prose is interpreted inconsistently, adding more prose rarely helps; concrete input/output examples are the most effective way to communicate expectations.

Test-driven iteration and the interview pattern

For a bug: ask Claude to reproduce the bug as a test, confirm the test fails for the right reason, commit the test, and only then fix the code without changing the test (you can use a hook to block edits to test files during the fix). Add to CLAUDE.md: "Run the tests before reporting completion and paste the output; if a test fails, fix the code, not the test."

In an unfamiliar domain, the interview pattern has Claude ask you about scope, constraints, failure modes, and success criteria before coding, surfacing considerations you hadn't anticipated.

Scenario example

You ask Claude to fix two bugs in an export module: (1) dates are shown in the wrong time zone, (2) the total column rounds incorrectly. Looking at the code, you see that the rounding function uses the time-zone-converted date to look up the exchange rate, so the two bugs interact. The right approach: describe both issues and how they relate in one detailed message; if you fix them one at a time, the first fix can push the second one in the wrong direction. If the two bugs were in two independent modules, sequential fixes would be better because each change is easier to verify.

(Sources: CCAR-F Exam Guide, Task 3.5; Anthropic Academy: The AI-native SDLC playbook — Capture as intent.md, Give Claude a feedback loop; Anthropic Academy: Building with the Claude API — Claude Code in action)

Integrating Claude Code into CI/CD (3.6)

Running non-interactively with -p

In a pipeline, claude "..." opens an interactive session and hangs waiting for input. The -p (or --print) flag runs Claude Code once with no interactive UI: it processes the prompt, writes the result to stdout, and exits, so you can pipe it like any shell tool.

claude -p "Read the build log at out/build.log, identify the most likely cause, and say whether the failure is flaky or real"

By default, -p still loads the same context as an interactive session: CLAUDE.md, hooks, skills, plugins, MCP servers. Add --bare to skip auto-discovery of that configuration, so every CI machine has the same setup and starts faster (requires ANTHROPIC_API_KEY; pass extra configuration through --settings, --mcp-config).

Exam trap

There is no CLAUDE_HEADLESS environment variable and no --batch flag for the Claude Code CLI. Redirecting stdin from /dev/null is a Unix trick, not a supported approach. The answer to "the CI job hangs waiting for input" is -p.

Machine-readable structured output

Combine --output-format json with --json-schema to force output that matches the schema; the schema-conforming object is in the structured_output field of the returned JSON. This is how you produce machine-parseable findings that a script can post as inline PR comments.

claude -p "Review this PR's diff. Report only bugs and security vulnerabilities." \
  --output-format json \
  --json-schema '{"type":"object","properties":{"findings":{"type":"array","items":{"type":"object","properties":{"file":{"type":"string"},"line":{"type":"integer"},"severity":{"type":"string","enum":["critical","important","nit"]},"issue":{"type":"string"},"suggested_fix":{"type":"string"}},"required":["file","line","severity","issue"]}}},"required":["findings"]}' \
  | jq '.structured_output.findings'

The JSON output also includes session_id; a later step can run claude --resume <session_id> to continue with full context (e.g. step 1 plans, step 2 implements).

Permissions when no one is there to approve

Need Configuration
Never hang waiting for approval --permission-mode dontAsk: any action that would have prompted is automatically denied
Grant only the tools needed --allowedTools "..." (a reporting job gets read-only tools)
Limit the number of agent-loop turns --max-turns 5
Skip all permission checks Bypass permissions, only in an isolated container/VM

GitHub Actions and Code Review

  • Code Review (managed): an Anthropic-hosted service through the Claude GitHub app that posts findings as severity-tagged inline comments, with deduplication and ranking. It never approves or blocks a PR and doesn't push fixes; the decision stays with humans.
  • GitHub Action anthropics/claude-code-action@v1: for custom CI such as responding to @claude in comments, scheduled jobs, or making code changes on request. Install it with /install-github-app. Main inputs: prompt (runs automatically on an event, no mention needed), claude_args (a string of CLI flags passed straight to Claude Code), trigger_phrase (default @claude), anthropic_api_key.
- uses: anthropics/claude-code-action@v1
  with:
    anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
    prompt: "Generate a summary of yesterday's commits and open issues"
    claude_args: |
      --allowedTools "mcp__github__list_commits,mcp__github__list_issues"

Giving Claude the right context in CI

  • CLAUDE.md is the channel for project context in CI: testing standards, criteria for what makes a valuable test, available fixtures, review criteria. Documenting these clearly reduces low-value tests.
  • Include existing test files in context when generating tests, so Claude doesn't suggest scenarios the test suite already covers.
  • Re-running a review after new commits: include the previous review's findings in context and ask Claude to report only new or still-unaddressed issues, avoiding duplicate comments.
## Testing (excerpt from CLAUDE.md)
- Test runner: `make test`; integration: `make itest` (requires docker).
- Valuable tests: error branches, boundary values, business rules. Don't write tests for getters/setters.
- Shared fixtures: `tests/fixtures/claims.py` (claim_open, claim_paid, claim_denied).

Session isolation: don't let the author review its own work

The session that just generated the code carries all of its reasoning from writing it, so it is unlikely to question its own decisions when reviewing. Review with an independent instance: a separate claude -p call, a reviewer subagent, or /code-review (which runs in a clean context with no session history). The principle "the less supervision, the more thoroughly you must verify": read the diff instead of trusting the summary, turn tests into a gate with a hook (a Stop hook runs the tests; exit 2 returns the failure to Claude to fix), and verify headless runs through the JSON result and exit code.

Scenario example

An automated review pipeline posts 14 comments on a PR. The developer pushes a fix, the pipeline runs again and reposts 11 old comments plus 2 new ones; the developer starts ignoring the bot. The right fix: on the re-run, include the previous findings in the prompt and ask Claude to report only new or still-unaddressed issues, output through --output-format json + --json-schema so the script posts only the new comments. Not right: increasing --max-turns, or handing the review to the same session that wrote the code.

Key point

The CI trio: -p (no hanging) + --output-format json --json-schema (machine-parseable) + CLAUDE.md (project context). The permissions trio for unattended jobs: --permission-mode dontAsk, --allowedTools, --max-turns.

(Sources: CCAR-F Exam Guide, Task 3.6; Anthropic Academy: Claude Code in action — Permission modes, Scheduled tasks and headless, GitHub Actions and Code Review, Trust it: Verifying unsupervised runs; Anthropic Academy: Claude Code 101 — Code review; Anthropic Academy: The AI-native SDLC playbook — AI in the PR review loop, CI/CD integration and deployment)

Quick summary

  • ~/.claude/CLAUDE.md applies only to that user and isn't shared via git; team standards belong in the repo-root CLAUDE.md or .claude/CLAUDE.md.
  • CLAUDE.local.md holds personal notes for one repo and is git-ignored.
  • /memory shows which memory files are loaded: the first tool to reach for when behavior differs across machines or sessions.
  • @import keeps CLAUDE.md modular but doesn't reduce context (expanded inline at startup).
  • .claude/rules/ splits a monolithic CLAUDE.md into topic-specific files; add paths (globs) so a rule loads only when editing matching files.
  • Conventions for files spread across the codebase (**/*.test.tsx) → a glob rule, not a subdirectory CLAUDE.md.
  • Shared commands: .claude/commands/ (version control); personal: ~/.claude/commands/. $ARGUMENTS receives the arguments.
  • Skill = a directory with SKILL.md; only name + description load initially; key frontmatter: context: fork, allowed-tools, argument-hint.
  • context: fork isolates verbose or exploratory output from the main conversation.
  • Personal skill variants: put them in ~/.claude/skills/ with a different name; precedence on name collisions: Enterprise → Personal → Project.
  • CLAUDE.md = always loaded, universal standards; skill = on demand, task-specific; hook = deterministic hard rules.
  • Plan mode for large, architectural, multi-approach changes; direct execution for small, well-scoped changes; often combine plan, then execute.
  • The Explore subagent isolates discovery output, returns a summary, and prevents context exhaustion.
  • Iterative refinement: 2–3 input/output examples, tests first then iterate on test failures, the interview pattern, interacting issues in one message.
  • CI: -p prevents hangs; --output-format json + --json-schema → structured_output; include prior findings in context to report only new issues; the reviewer must be an independent instance.