I Asked Claude Code to Rename One Variable and It Fixed Three Bugs
I Asked Claude Code to Rename One Variable and It Fixed Three Bugs
It was Tuesday night, maybe 11pm. I was cleaning up a small Node project I run on my Mac mini, the kind of cleanup you do when you are avoiding the real work. I opened Claude Code and typed something boring: “rename userID to userId across the project.”
Five minutes later I was sitting there staring at the diff, a little stunned. The rename was there, sure. But three other things had quietly changed too, and they were not cosmetic.
The rename that was not just a rename
I expected a mechanical find-and-replace. That is what my editor would have done. What Claude Code actually did was read the whole project first, understand how userID flowed through the code, and then touch only the places it actually mattered.
In the diff, I noticed three changes that were not part of my ask. A null check on a session object in auth.js. A guard around a database lookup in users.js. And an import path in routes/admin.js that had been pointing at a file I renamed weeks ago and never fixed.
That last one had been throwing a warning every time I restarted the server. I had been ignoring it the way you ignore a small leak under the sink.
How it noticed things I did not
Claude Code does not look at one file at a time. When you give it a task, it actually walks the project. So when it went looking for every place userID appeared, it ended up reading files I had not touched in a month.
Along the way it saw the broken import, saw that a function was calling .id on something that could be null, and saw that one of my routes was not guarding against a missing user. It did not ask me about these. It just fixed them and noted them in the explanation at the bottom.
The note said something like: “I also noticed these unrelated issues and fixed them. Let me know if you want me to revert.” That sentence is the whole reason I trust this tool more than I thought I would.
Eben’s note: The scary part is not that Claude Code fixed bugs I did not ask about. The scary part is realizing how many bugs I had quietly learned to tolerate.
The moment of doubt
My first reaction was not gratitude. It was suspicion. I closed the diff and sat back for a second.
If an AI can change files I did not ask it to change, what else is it doing? I went back through the diff line by line. I ran git diff in the terminal, not just inside the tool. I wanted to see the raw changes without any summary.
Everything was real. Everything was small. Every change had a defensible reason. But I felt the weight of something important. I have to actually read these diffs. I cannot just accept them because the summary sounds confident.
Trust, but verify, but actually verify
There is a version of this workflow where I get lazy. Claude Code is good enough that I could stop reading diffs and just run the tests. For small projects, that probably works most of the time.
But “most of the time” is exactly how you end up with a silent bug in production at 3am. So my rule now is simple. Every Claude Code change gets a git diff in my own terminal. Not the summary in the tool. The raw diff.
It takes maybe thirty seconds per task. And it forces me to actually understand what changed in my own codebase, which, honestly, is what I should have been doing anyway.
Why project-wide awareness matters more than I thought
I used to think the big deal about AI coding tools was speed. Faster typing, faster boilerplate, faster refactors. That is the shallow version.
The deeper thing is that Claude Code holds more of the project in its head than I do. I have maybe three files loaded in my working memory on a good day. It has the whole repo. When I ask it to rename something, it is thinking about consequences I forgot existed.
That changes what I use it for. Not just writing new code. Cleaning up old code. Hunting down the small rot that every project accumulates. Asking it “does anything in this project look broken” is now a real question with a real answer.
What I am taking from this
Next time you have a boring refactor, try giving it to Claude Code and then read the diff carefully. You might find it does more than you asked. Some of that “more” will be valuable. Some of it you might want to revert. Either way, you will learn something about your own project that you did not know before.
The Mac mini is still sitting on my desk, fans quiet, running the same server it was running yesterday. But the code on it is a little less broken tonight, and I did not quite earn that. Claude Code did. I am still thinking about that.
Tags: #AIagents #ClaudeCode #OpenClaw #MacMini #OpenRouter #buildinginpublic #Eben