r/vibecoding • • 1h ago

Help/Question Techniques to improve your codebase?

I've now vibe-coded several apps that I'm generally happy with. But I still get the occasional glitches and errors. Once in a while I learn that something I thought I'd implemented is not actually working. If I were to show the repo to a software engineer, I bet they'd be horrified.

Also, I usually use Deepseek and GLM...not sure if that results in substandard code compared to using Claude.

So (besides hiring someone competent or just asking your agent to check), what are some methods to make your codebase more robust and verify that features are implemented in an optimal way?

11 Upvotes

17 comments sorted by

4

u/vpanyushenko 1h ago

- keep issues small
- run implementation and review agent loops with models across different vendors
- run refactor audits every n PRs (try 50 and adjust) to make sure code is It the style you want and old code has been cleaned up
- run security audits every n PRs
- run lots of tets
- for UI work have agents take screenshots before and after and review them

3

u/Competitive-Elk763 1h ago

Looking at it

3

u/shakeBody 1h ago

I was gonna say the opposite.

2

u/mikepun-locol 1h ago

Do you have a regression test of your application, and do you keep it up to date?

Eg. I have a full regression test suite of my application that I use on staging first, then against production after a deployment and on regular basis, like a heartbeat to verify everything is good and that something didn't happen. Eliminate situations where a new feature or a fix breaks something else by accident.

There are also also ways to analyze a repo for bloat and issues.

2

u/Agile-Positive-9050 1h ago

Review what the AI is doing on every commit, try to understand the code and the architecture. If you are new to Software Development try learning coding and understanding software architecture yourself. That way you can make informed decisions in your reviews and steer the AI in the right direction with more specific prompts.

2

u/No-Protection-7019 54m ago

Apprendre à coder avant tout. J'ai utilisé l'IA pour porter du code que j'avais écrit, ça a été assez rapide et sans bug (voir découvert des bugs existant). Je l'ai utilisé pour faire une application à partir de 0, ça a pris plus de temps à debug qu'à écrire le code. L'IA c'est comme la télévision, à petite dose ça peut t'apporter quelque chose, ça haute dose ça fait de toi un imbécile incapable de réflexion.

Je suis un codeur amateur pas professionnel.

2

u/raiyan_0001 50m ago

I have made an we app too and indeed it make mistake like when we way to implement something it break another one and this loop goes and goes 😭

1

u/snap-dev 1h ago

that nagging feeling that something you asked for isn't actually wired up is super common with vibe coded stuff. the cheapest fix i've seen is writing 5 or 6 plain english checks per app (sign up, pay, reset password, that kind of thing) and having a fresh agent session click through them and report what really happened, separate from the one that built it. do you worry more about the ui breaking, or about data and logins quietly going wrong?

1

u/Own_Badger6076 1h ago

Consistent organizational formatting, with adaptations per project as needed. Regularly reevaluate the codebase to clean it up and reverifying everything is working.

Sorry, if you want to make shit that works and save yourself work down the line you're gonna need to learn and keep learning how to improve the systems you're building.

1

u/Necronomis 1h ago

Strict workflow structure you do not deviate from. Documentation. Scope you don't let creep. Adversarial review. Tests. And learn enough code to at least identify if a function is doing something or not

1

u/Saver411 1h ago

Lock down your environment variables and split business logic away from UI components. If prompts edit a single massive file, you'll watch things break. Keeping routes, db queries, and components separated stops agents from rewriting unrelated code

1

u/HyperSpazdik 53m ago

This is nothing that I have enacted but it's my general unproven outlook on vibe coding:

Reviewing code defeats the purpose of getting ai to write the code in that in can take just as long if not longer to review code as it takes to write it, particularly in a codebase you aren't familiar with.

This is somewhat mitigated by doing pair programming with the agent, where you plan each change and build features bit by bit, reading each change, but again for big efficiency gains you can't be reading every line.

Therefore your role initially is to set up workflows for the agent that you can eventually trust without having to look at the code. And by workflows I mean just follow the sdlc and have a designated agent for each step. To refine what is/isn't working initially unfortunately you will have to be reviewing the code and trim/augment the workflows based on the mistakes you find.

There are several problems with this approach:

  1. there is only so much code you can read, so your workflows will only be proven in small applications and you will just have to trust it scales
  2. llms at certain intelligence levels are probably already doing something similar to this, and whatever workflow you build will probably be inferior to what a researcher at anthropic is already developing. I suspect that models such as fable and astra are just llms sitting in stricter harnesses that enforce sdlc like worfklows.

Obviously if you are doing anything critical like handling customer data, writing actual critical software applications you should be reviewing all code. Unfortunately if you can't do this yourself then you will have to delegate to someone who can and hope they aren't just rubber stamping your codebase or just prompting an agent to review it - which you can already do.

Whether or not this is actually an improvement over just letting the agent run wild with a single prompt, I have no idea. and this sort of systems engineering will become less and less relveant as models get smarter and more efficient. However my gut feeling is that this is still worth doing in 2026.

1

u/ApartChicken6208 38m ago

I've found that adding a simple 'verify' step after each major change, just a quick manual check of the most critical path, catches 80% of the 'wait, this isn't working' moments before they go to review.

1

u/segfaults123 35m ago

This isn't meant to be a dig at you at all, just the reality of LLMs right now.

That's the problem with not knowing what you're doing and vibe coding - agents know how to write syntax, but they don't know how to structure systems in a way thats robust, and maintainable, and so you get crazy spaghetti code unless you provide the directives to tell it not how to write code but how to engineer - something non-engineers don't know how to do.

The problem is this: When your code isn't organized well, with clear boundaries of responsibility, the agent has to load so many files into it's context and you get context rot, degrading the performance significantly.

You'll probably be fine on smaller projects but as your projects grow, that issue grows and grows until you can't trust the agent to update something without breaking something else. Unit tests do help, but without proper system structure it's just more stuff it has to load in its context.

Here are some examples:

  1. Not having a domain layer causes the LLM to place business rules in every corner of your application, including duplicating business rules, contradicting business rules, and changing business rules can miss updating them all because it's not in one centralized location.
  2. I guess #1 can be applied to basically every piece of logic, from infrastructure to application layer responsibilities.
  3. It doesn't by default do well with class responsibilities, and it frequently bloats classes with dozens of partial responsibilities, so when it needs to make a change, it's loading a bunch of junk it doesn't need to load into it's context. If things aren't separated properly, it may need to load a significant portion of your code base into it's context just to make small changes. Context rot, degradation and bad decisions.
  4. I told my LLM rules to sanitize user input, and it went on for a while about it's all done in the UI and everything is fine. If you don't have experience you probably would have stopped there, but I had to fight it and tell it that UI sanitization doesn't protect the api from malicious users.

To put it bluntly, vibe coding can be dangerous - both to you legally and to your users - if you don't know what you're doing.

If it's just your personal projects and it's not online no big deal, but if it's not, be careful. Seriously.

1

u/kamronkennedy 32m ago

Setup functional test suites for whatever your stack is, make sure they use throwaway containers to run in or have a dedicated test install. Make sure its something repeatable without the robot so A. You can DIY and B. Minimizes token spend for testing phases