This is the work agents are genuinely, obviously good at. It is also where “it looked fine” bites hardest, because the mistake is usually somewhere you did not look.
Ask for it precisely
Rename
getUsertofetchUsereverywhere insrc/. Update the imports. Do not change any behaviour, and do not touch the tests yet.
Four elements: the old name, the new name, where, and what stays untouched. A request without a boundary tends to grow.
Refactor and behaviour never share a turn
Do the rename. Commit. Then change what the function does, in a separate turn and a separate commit. Two small readable diffs instead of one where a behaviour change hides inside a hundred renamed lines.
Then check it yourself
The agent will tell you it renamed everything. It believes that. Believing it is not the same as it being true — a file that never came up in the conversation is a file that may never have been opened.
Here is the check, and it takes ten seconds: search the project for the old name. If anything comes back, the refactor is not done.
In the terminal below, the rename has already been “finished”. Grep for getUser in each file and find the one that was missed.
Quick check
You grep for the old name and get one hit in a file you did not know existed. What does that tell you?
Feeding the miss back
Now you have something specific to say:
src/admin.jsstill imports and callsgetUser. Rename it there too.
One sentence, one file, no ambiguity. Then grep again. Zero results, and only then is the refactor real.
Read the diff for what you did not ask for
Multi-file changes are where extras sneak in: a reordered import block, a reformatted function, a “while I was there” tweak. Each one is individually harmless and collectively makes the diff unreadable.
Ask for them to be reverted. You are not being difficult — you are keeping the change reviewable, which is the only reason review works at all.
Tests are not proof of a complete rename
A green test suite means the tested paths still work. If src/admin.js has no test, the old name can survive there happily until someone opens the admin page. Search, do not assume.
The pattern to keep
- Ask precisely, with a boundary.
- Let it work.
- Search for the old thing yourself.
- Feed back exactly what is left.
- Commit the refactor on its own.
That loop scales from a three-file rename to a much larger change. What does not scale is trusting the summary.