I Stopped Letting AI Copy My Code. Here's What I Built Instead.
Every time I asked an LLM to refactor a large file, the same thing happened. It would rewrite the code, hallucinate imports, rename variables it shouldn't have touched, and silently drop utility fu...

Source: DEV Community
Every time I asked an LLM to refactor a large file, the same thing happened. It would rewrite the code, hallucinate imports, rename variables it shouldn't have touched, and silently drop utility functions from the bottom of the file. The output always looked right at first glance. But then you'd run it and get runtime errors in places you never asked it to change. That's the worst kind of bug — the kind that passes code review because the AI's version reads better than the original. So I stopped letting AI copy my code. I built Refactory instead. The idea is simple: let the AI do what it's actually good at, and keep it away from what it's bad at. AI is great at reading a 5,000-line monolith and telling you where the module boundaries should be. It can see the dependency graph, identify cohesive clusters of functions, and suggest a clean decomposition. That's genuine understanding. But ask it to actually move the code into those modules? That's where it falls apart. It hallucinates impo