Best AI Utility logo
Best AI Utility
Voltar aos guias
Coding
Intermediário
7 min de leitura
Atualizado 2026-11-07

I Asked Claude to Tidy a Codebase I Was Afraid to Touch. It Deleted Nothing.

Inherited code is a minefield. I did not want a rewrite, I wanted the scary parts explained and the obvious rot removed. Claude did the second only after it did the first, which is the order that kept me calm.

Everyone's first instinct with a messy codebase is to rewrite it, and that is how you break something that was merely ugly. I had a repo I was afraid to touch, so I set a hard rule before I started: explain first, change second, and never delete without showing me the diff.

I started by pasting the worst file and asking Claude to walk me through it like I had never seen it. Not to fix anything, just to map the landmines, the duplicated logic, the dead functions, the one function everyone is afraid to call. That map was worth more than any refactor, because I finally knew what not to touch.

Then I asked for the smallest safe improvement, a function extracted, a repeated block collapsed, a name that stopped lying about what it did. I accepted changes one at a time and re-ran the tests after each, because a cleanup that breaks the build is just a different kind of mess. The model is happy to do too much if you let it, so I kept the scope to one smell per turn.

The part that saved me was refusing the big-bang rewrite. Claude will offer one, and for a codebase that works, that is a trap. I treated it as a janitor, not an architect, and the repo got calmer without ever going dark. Three sessions in, the scary file was boring, which is the highest praise a legacy file can earn.

If you do this, watch for the model inventing a function it thinks should exist. It will suggest a call to something that was never written, and the tests will fail in a way that looks like your fault. Read the diff like it was written by a very confident intern, because that is exactly what it is.

Frequently asked questions:

Q: Will Claude rewrite the whole thing if I let it?

A: It will offer to, and for working code that is usually a mistake; keep the scope to one safe change per turn.

Q: How do I stop it deleting things?

A: Ask for diffs and review each before accepting; tell it explicitly not to delete without showing you the change.

Q: Does this replace understanding the code myself?

A: No, the explanation step exists so you learn the landmines; the cleanup only works once you know what not to touch.

Claude (https://claude.ai)

Best for: Researchers, Writers, Professionals, Students.

Key features: Strong at long-form writing; Useful for analysis and reasoning; Clean and simple experience.

Free plan: a free tier covers light use.

Pricing: Freemium.

Pros: Strong at long-form writing; Useful for analysis and reasoning; Clean and simple experience.

Cons: Some advanced usage may require paid access; May still need manual fact-checking.

Put one of these tools on the leaderboard

Every rank on Best AI Utility is paid and time-stamped — outbid the current holder with one crypto payment and the rank is yours until someone outbids you.

Mais guias

Explorar mais