Question 220
A maintainer wants to replace an entire generated artifact with new known content. Which tool is suitable after verifying the destination?
Explanation
Correct Answer
When the maintainer has verified the exact destination and is authorized to replace the entire generated artifact, Write is the relevant operation. It should target that one file with the approved new content and an explicit overwrite policy, rather than searching for a vaguely similar name. The host still checks scope and permissions before dispatch, and the result should be read back or otherwise verified against the intended bytes. A full replacement is different from a narrow patch, so the tool choice should reflect the authorized change.
Incorrect Answers
Editing an arbitrary unrelated line cannot produce a known full replacement of the requested artifact. It also risks modifying a file outside the approved scope while leaving the target unchanged. A line editor is appropriate for precise localized changes after confirming context, not for replacing a complete generated output whose intended bytes are already known. Verify the exact target and use an authorized whole-file write.
Grep can locate text and support inspection but it does not replace a file's contents. Stopping after the first matching line also says little about the destination's identity, content hash or whether the whole artifact must be rewritten. Use discovery and read operations to verify the path first, then perform the designated Write with the known content. Reporting success after search alone would be a false mutation claim.
Glob can suggest matching paths but a similar basename is not proof of the intended target. Blindly overwriting the first match might destroy a backup, template or neighboring customer's artifact. The user specified one known generated deliverable, so resolve the exact path and confirm authorization before writing. Broad discovery can help the maintainer identify candidates, but it cannot authorize the destructive choice on its own.



Claude Certified Architect - Foundations (CCA-F) Practice Tests