I was handed a pile of vibe code. And you might be surprised to learn that it has a ton of bugs.
And tips on how to dissect it and break it up into something manageable?
- Ask what was the purpose of the code
- Delete all the slop crap
- Make the code from scratch
can confirm. this is the way
For work, or for hobby?
Hobby: have AI document what it’s supposed to do, then work through it like the ship of theseus one function at a time replacing it with not bad code.
Work: use it, document the bugs, ninja in and clear them out one at a time until it works. Keep blinders on and ignore anything not directly related to each bug. Same strategy as legacy code.
For work. The code goes like 8 levels of abstraction. I’m trying to figure out how to unravel it.
Even a code flow/branching diagram would help I think
The problem with this approach is twofold.
- The AI doesn’t know what anything is either. It can annotate faster than you, but if it is all wrong, that doesn’t help.
- The primary reason the code is bad, and something the AI is particularly weak at without a human doing much of the thinking for it is architecture. Working your way through ship-of-theseus-style isn’t going to address the fundamental reason the code is difficult to work with. The architecture.
Vibe code it a bit further, then pass it back. If they can hand you slop without second thought, why shouldn’t you?
Cry in the bathroom
I just cry at my desk and tell them it’s because AI is so beautiful
Depends on the size of the pile. If it’s huge, then you have to use LLM too, with some decent tooling like Claude Code. Let it analyse the code first, and put a summary for you. Then design the proper solution yourself, and either fix it manually, or if it’s too tedious, guide LLM to apply the changes for you. Ofc iteratively and don’t let it apply changesets without your approval. I had a similar task recently, did it like that
Fighting fire with fire. I like it.
“Working Effectively with Legacy Code” by Michael C. Feathers
In my opinion, we treat it the same as any spaghetti code
An absolute must have for any software engineer. Whether they think they work wirh “Legacy Code” or not.
Document the features and requirements, then rewrite it with proper architecture and without LLMs.
Of course! Vibe coding is a popular activity nowadays and *** thinking ***
Start by separating the files by namespace and class. Then, by method. Delete the first method, then the next, and so on. Then rewrite the code by hand as God intended.
Nature of the code? Library, CLI tool, cloud service, API, UI?
My first thought is test suite.
deleted by creator
I guess despite how intimidating it seems, un-fucking vibe code can be approached just like every other complex programming problem: by breaking it down into smaller problems and solving them incrementally.
deleted by creator
Yeah. I want to do something like this. I was hoping to run a proper dead code analysis first.
But this is a good idea. For how to reduce the code volume. I need to reduce the abstraction layers because there are a bunch of unneeded ones
deleted by creator
Ask AI to do this for you.




