CCDV-F Claude Code Practice Question
A developer is working in a large monorepo and wants Claude Code to automatically run `npm run lint` and `npm run test` after every file edit it makes, without needing to ask each time. Which Claude Code feature should the developer configure to achieve this?
⚠ Common exam trap
The trap here is assuming that documenting commands in CLAUDE.md or creating a slash command makes them run automatically, when only a lifecycle hook actually enforces event-driven execution.
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
✓
Configure a PostToolUse hook in `.claude/settings.json` that matches the Edit and Write tools and runs the lint and test commands.
Hooks are the deterministic automation mechanism in Claude Code. A PostToolUse hook bound to the Edit and Write tools executes a configured shell command every time those tools complete, which guarantees `npm run lint` and `npm run test` run after each change without any prompt. Documentation files, slash commands, and permission flags influence behavior or require manual action but cannot enforce automatic post-edit execution.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
Configure a PostToolUse hook in `.claude/settings.json` that matches the Edit and Write tools and runs the lint and test commands.
Why this is correct
Claude Code hooks let you register shell commands that fire automatically in response to lifecycle events such as PostToolUse. By matching Edit and Write tools and pointing the hook at `npm run lint` and `npm run test`, the developer ensures those commands run deterministically after each file change, which is exactly the automated, no-prompt behavior requested here.
- ✗
Add a CLAUDE.md file at the repository root that documents the lint and test commands.
Why it's wrong here
CLAUDE.md provides project context and instructions that Claude Code reads, but it does not guarantee automatic execution of shell commands after every edit. It is a guidance mechanism, not an enforced hook, so relying on it to always run lint and test would give inconsistent results and cannot be considered a reliable configuration for this requirement.
- ✗
Enable the `--auto-approve` flag in the project's `.claude/settings.json` so Claude Code can decide when to run the commands.
Why it's wrong here
There is no `--auto-approve` setting in `.claude/settings.json` that causes arbitrary command execution after edits. Permission settings affect whether Claude Code may run a tool without prompting, but they do not schedule lint or test runs. The developer would still have to rely on the model choosing to execute those commands, which is not deterministic.
- ✗
Create a custom slash command named `/lint-test` in `.claude/commands` that runs both commands.
Why it's wrong here
Custom slash commands are invoked manually by the developer and are not triggered by tool events. Even if the command runs lint and test correctly, it still requires the developer to type it after every edit, so it does not satisfy the requirement that the commands run automatically without asking. This is a manual convenience, not event-driven automation.
About these practice questions
This CCDV-F question is part of Courseiva's 257-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. 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 CCDV-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 CCDV-F exam.