How do you keep up quality when you vibe-code?
39 pointsI'm having a really hard time working with claude. In the past when I wrote all the code manually, it was always carefully reviewed and architected, with all possible flows carefully mapped out. Now, my code is mostly AI written which has led to things going out of control. Since it's easy to add new features and support many user flows, we went ahead and implemented flows that support a lot of cases our users run into. But now, I feel like things are getting too complex with no central notion of behaviour definitions, which causes every bug-fixing session to feel like a game of whack-a-mole, and results in missing edge cases and UI bugs that are becoming impossible to review and keep track of.
Every time I build anything new, it adds more complexity and the agent only seems to focus on the surrounding code within that session without keeping track of how it fits into the rest of the code base/product.
How do you all deal with this? Any suggestions for improving?
Comments (39) 68 threads
0. Use Opus 5.5 on high.
1. Have in your CLAUDE.md the rule that code changes go together with updates to the docs. For me, that's HTML files in docs/. (Could be .md as well, but for human consumption, HTML is nicer.)
2. Have the rule that only that should go into the docs that an experienced engineer would need to rebuild the system from scratch, ignoring how it would look.
3. Larger work gets a plan doc in docs/plan, i.e. multi-PR work. There is a template how plans look, and an important part of the template is that the last step of the plan is always to delete the plan and fold anything from it that makes sense as long-term documentation into the docs.
4. Have a rule that before creating a PR, a sub agent needs to review the code, and have Codex Sol 6.1 high review it as well. Then let the main agent iterate on their findings until they are happy.
5. Every now and then, ask for an audit of the code. I ask for DRY, YAGNI, and KISS. Let it produce a report. Then let it fix all findings. If a lot, use a plan.
6. If you're adding something straight forward, just ask for it directly. If it's not, ask for a brief first. Review it. Then decide whether to implement in one go or through a plan.
7. Get an ultra plan, so you (mostly) don't have to worry about token usage but can use agents to their full ability.
8. Bonus and plug: Ask your agent to hand over with a demo video. It often finds and fixes issues while recording it, and you're not degraded to the agent's QA team, but it has to put in the work to convince you. I built a UI for directing agents as described: obeya.si. Free, open-source, local.
A stronger version of this would be to make a separate gate. Fail the commit if the new code duplicates something already in a utility function, renames something that already had a name, uses for-loops instead of list comprehensions, whatever is bothering you.
I am currently testing a "too simple" gate. Claude loves to turn everything into helper functions, and if the helper function isn't actually helping (too short, doesn't perform enough actions, etc) the commit gets bounced and Claude gets told why it's wrong and what to do about it.
This has generally kept the worst of things out of the codebase.
1. Experiment and solidify architecture before adding features. I think this is the hardest step for top-down thinkers.
2. Heavy testing and benchmarking. Prefer to TDD as much as possible. The actual lines for my agent-written codebases are generally ~70+% tests, benchmarks, and experiments.
3. Full mutation test coverage after the code is written. Doing this as a human is miserable IMO, but robots make it reasonable. This step resolves SO MANY subtle bugs.
At that point my main role is ensuring alignment with the actual specs.
The trouble comes later when the "experimental features" actually start getting traction and we discover all the holes in our implementation.
By the time we need to "productionize" our experiment, it has already been patched all over the place to account for bugs.
I get a feeling that this is made worse by the fact that since a lot of what we're doing is rapid prototyping, our repo is cluttered with examples of bad code that the agent picks up on and then goes ahead to copy in its own implementation.
I get that we need to clean this up, but it's crazy trying to figure out where to start and what to tackle
> I get that we need to clean this up, but it's crazy trying to figure out where to start and what to tackle
Enumerate, then fix-or-nix all known examples of bad code first. If you clear the path first, you will advance more quickly. It can feel frustrating having to do that, but my experience is that paying off tech debt earlier will prevent hitting the wall at an inopportune time.
Pump out features and iterations as fast as you can until customers are buying your product.
Startups fail because they can’t find customers, not because their code quality is low.
0. Use Fable 5.2 on max (or whatever the most powerful model + effort you have access to) for all strategy, design, and planning (since good reasoning at higher levels of abstraction always pays off when it comes to implementation)
1. Use Opus 5.5 sub-agents for implementation, and have the Fable "drivers" break work into lanes.
2. Only build when there's an explicit "go" on a written plan.
3. About 1x/week do a broad, high-dimensional analysis of the codebase (tech debt, test coverage, security, performance, etc. etc.) and have judge agents vote on priority --> fix the P0s and P1s and a random small subset of P2s.
4. Test coverage > 85% and set up CI to reject changes which drop the test coverage %.
5. Have every agent create a numbered guide for verification which you walk on staging (or locally, if early in your development process).
6. Antagonistic & hyper-critical agents -- whenever you make a change spin up a small number of Opus 5.5 agents to review everything from an antagonistic/hyper-critical lens -- this catches a lot.
7. Make a list of principles and make every agent read the principles before every change. Principles only get added + refined. Whenever an agent doesn't know what to do, ask if it can figure it out from the principles -- if not, walk the agent through it + then have it add the appropriate principle. This leads to convergent implementations at an abstract level, over time.
---
Using these tips I've developed large + complex code bases with minimal bugs.
All comments shown.
Couldn't load more comments. Check your connection and try again.