CCAR-F Claude Code Configuration and Workflows Practice Question
A platform team wants Claude Code to automatically run the project's formatter after every file edit made by the assistant, so that generated code always matches the repository style without manual intervention. Which configuration should the team use?
⚠ Common exam trap
The trap here is believing that instructions in a memory file or a manually invoked slash command enforce automatic post-edit behavior, when only hooks provide deterministic execution tied to tool events.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Define a `PostToolUse` hook in `.claude/settings.json` that matches the file-editing tool and invokes the formatter command.
Claude Code hooks are configured in settings files and bind shell commands to lifecycle events. A `PostToolUse` hook that matches the file-editing tool and runs the formatter guarantees the formatter executes after each edit, which is the deterministic behavior the platform team wants for repository-wide style consistency.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Define a `PostToolUse` hook in `.claude/settings.json` that matches the file-editing tool and invokes the formatter command.
Why this is correct
Hooks in Claude Code settings can be bound to lifecycle events such as `PostToolUse`, which fires after a tool call completes. By matching the file-editing tool and running the formatter, the team ensures formatting happens automatically after each edit, exactly matching the requirement for consistent style without manual steps.
- ✗
Set the `CLAUDE_CODE_AUTO_FORMAT` environment variable to `true` in the shell profile before launching Claude Code.
Why it's wrong here
Claude Code does not provide a `CLAUDE_CODE_AUTO_FORMAT` environment variable; automatic formatting is achieved through hooks, not a built-in toggle. Setting an unrecognized variable has no effect, so the team would still end up with unformatted edits and a false sense that formatting is being enforced.
- ✗
Create a custom slash command named `/format` and instruct developers to run it after each assistant edit.
Why it's wrong here
A slash command is invoked manually by a human, so it does not fire automatically after assistant edits. This shifts the burden back onto developers and reintroduces the risk of unformatted code whenever someone forgets to run the command, which contradicts the goal of automatic formatting after every edit.
- ✗
Add the formatter invocation to the `CLAUDE.md` memory file as an instruction the assistant should follow after each edit.
Why it's wrong here
Memory files provide guidance the model may follow, but they do not guarantee execution and cannot run shell commands themselves. Relying on prose instructions means formatting depends on the model's discretion and could be skipped, so this does not deliver the deterministic post-edit behavior the platform team requires.
About these practice questions
One of 271 original CCAR-F practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Anthropic exam blueprint
This CCAR-F practice question is part of Courseiva's free Anthropic certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the CCAR-F exam.