Question 110
A coding agent must search source files, read the matched function and edit exactly one callsite. How should it proceed?
Explanation
Correct Answer
The matched location is data-dependent; editing before reading risks changing the wrong code. Evaluate diff and targeted tests after the edit. The target callsite must be located and read before editing, because search hits do not prove semantic identity. Apply the smallest authorized change, review the diff and execute tests on the updated revision rather than editing by filename guess. Use narrow context rather than entire-repo rewriting. A guessed path is not observed repository state.
Incorrect Answers
An unrelated linter can check formatting or style but cannot identify a specific function callsite or apply the one authorized edit. The task requires knowing which source file contains the matching invocation and what the surrounding code actually does. Use a scoped search to locate candidates, inspect the exact file and function, perform a targeted edit with a matching precondition and review the diff. Running a separate quality tool as the only step leaves the requested callsite unchanged.
Repository naming conventions can narrow a candidate directory but do not establish that a particular function or callsite is located there. Editing based on a predicted path risks changing the wrong file or an outdated duplicate. The task calls for discovery, inspection of actual source, and a single scoped edit. A search result followed by Read and an exact Edit provides evidence for the target and permits verification after the change.
A broad text match may appear in comments, tests, documentation and multiple callsites unrelated to the intended fix. Editing every matched file could introduce widespread behavior changes and exceed the user's one-callsite scope. The agent should locate candidates, read the actual function context, identify the authorized target and apply a narrowly verified edit. Afterward, a diff and relevant tests establish whether only the intended call was changed; blind substitution provides neither guarantee.



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