Yea, when I read about people using AI with prompts like that, my first thought is, "Wow, that's like copy/paste, but instead of Ctrl-C/Ctrl-V, it's round-tripping to a server and using GPUs to do it." What's next? "Claude, rename the function doFoo() to performBar()"?
Here's the loop for a successful small refactor (anything beyond a rename that could be handled entirely by an IDE):
1. Find the code you want to change
2. Run the tests to confirm that test coverage is good for the starting point
3. Track down everywhere else that might call or interact with that code
4. Update the tests (red/green TDD)
5. Alter the code
6. Update the things that call the code
7. Run the tests again
8. Apply linters/formatters
9. Address any feedback from linters
10. Check to see if any documentation needs updating and do that
11. Land a commit with a descriptive commit message
I can get all of that done with a coding agent with a single sentence prompt - especially if it's already in a session where it knows that I do "red/green TDD".
... and then I can work on something else while the agent is churning through those steps.