試験CCAR-F トピック1 問題112 スレッド
Anthropic CCAR-Fのリアル試験問題集
問題 #: 112
トピック #: 1
問題 #: 112
トピック #: 1
You are using Claude Code to accelerate software development. Your team uses it for code generation, refactoring, debugging, and documentation. You need to integrate it into your development workflow with custom slash commands, CLAUDE.md configurations, and understand when to use plan mode vs direct execution.
Your team's CLAUDE.md includes a rule: "Use 4-space indentation and always run Prettier formatting." Despite this, code reviews reveal that roughly 30% of files Claude Code generates use inconsistent formatting-sometimes 2-space indentation, sometimes missing trailing commas. Adding emphasis ("IMPORTANT: You MUST use Prettier formatting") reduces violations to about 15%, but doesn't eliminate them.
What is the most effective way to ensure all generated code is consistently formatted?
Your team's CLAUDE.md includes a rule: "Use 4-space indentation and always run Prettier formatting." Despite this, code reviews reveal that roughly 30% of files Claude Code generates use inconsistent formatting-sometimes 2-space indentation, sometimes missing trailing commas. Adding emphasis ("IMPORTANT: You MUST use Prettier formatting") reduces violations to about 15%, but doesn't eliminate them.
What is the most effective way to ensure all generated code is consistently formatted?
おすすめの解答:D 解答を投票する
Formatting is deterministic and should be enforced by deterministic tooling rather than stronger natural- language instructions. A PostToolUse hook executes after a successful tool operation. Matching Edit|Write restricts the hook to file modifications, allowing the edited file path to be passed directly to Prettier.
Anthropic provides this exact pattern in its official hooks guidance: configure a PostToolUse event with an Edit|Write matcher and run Prettier against the modified file. This ensures formatting occurs automatically after every relevant edit instead of depending on Claude remembering to execute a formatter. ( https://code.
claude.com/docs/en/hooks-guide )
Option A still relies on instruction-following and unnecessarily loads procedural material. Option B asks another probabilistic model evaluation to determine whether formatting is correct, even though Prettier can enforce the result directly. A Stop hook also runs later than necessary. Option C improves contextual relevance but does not guarantee compliance; path-scoped rules remain instructions rather than enforcement controls.
The hook should be stored in project settings so the workflow is shared by the team. The formatter's exit status should also be monitored so configuration or syntax failures are visible instead of silently ignored.
Official references/topics: Claude Code Hooks; PostToolUse; Edit|Write Matchers; Deterministic Formatting Enforcement.
Anthropic provides this exact pattern in its official hooks guidance: configure a PostToolUse event with an Edit|Write matcher and run Prettier against the modified file. This ensures formatting occurs automatically after every relevant edit instead of depending on Claude remembering to execute a formatter. ( https://code.
claude.com/docs/en/hooks-guide )
Option A still relies on instruction-following and unnecessarily loads procedural material. Option B asks another probabilistic model evaluation to determine whether formatting is correct, even though Prettier can enforce the result directly. A Stop hook also runs later than necessary. Option C improves contextual relevance but does not guarantee compliance; path-scoped rules remain instructions rather than enforcement controls.
The hook should be stored in project settings so the workflow is shared by the team. The formatter's exit status should also be monitored so configuration or syntax failures are visible instead of silently ignored.
Official references/topics: Claude Code Hooks; PostToolUse; Edit|Write Matchers; Deterministic Formatting Enforcement.
坂井** 2026-08-30 01:11:16
コメント
他人の解答コメントを賛成するのも、その解答に一票を入れることになります。したがって、すでに同じ意見の投票コメントが存在する場合、新規コメントをする代わりに賛成することもできます。
コメントを通報する
コメント中
今すぐ 新規登録 / ログイン (無料です)。