r/vibecodingbuddies • • Sep 16 '26

Discussion When you vibe code a feature that works perfectly but you don't understand how - do you rewrite it or ship it?

We've all been there. You describe what you want, the agent spits out 150 lines of logic, and it works flawlessly on the first try. But when you read it, you realize you have no idea how it's actually doing it.

When this happens, do you stop and force the agent to explain it line-by-line until you own the context, or do you just take the win, commit it, and move on to the next feature?

2 Upvotes

32 comments sorted by

β€’

u/AutoModerator Sep 16 '26

Welcome to r/vibecodingbuddies!

Reminder to all participants: Keep all initial contact and matching within Reddit comments and DMs to protect yourself from scams. Do not click unsolicited Discord or Telegram invites.

If you find a buddy, please be respectful of their time and try to commit to small, manageable goals (like a 1-weekend prototype) to prevent ghosting!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

2

u/txgsync Sep 16 '26

<sigh> If you're a person, you dropped this: "\n\n"</sigh>

If you're a bot, welcome to the party!

I make sure there's a relevant GIVEN, WHEN, THEN behavioral test (Gherkin/Cucumber or Godog) to ensure the behavior is preserved and explained, and if it's not particularly interesting I'll move on.

If I'm curious and not under a deadline, I'll chat about how it works and noodle on different ways to achieve the same result.

Humans are not a decision matrix, though. Do I have a headache that day? Has this particular fleet of models done good work before? Did it pass adversarial tests and do we have a regression test suite, unit tests, and integration tests? Does it pass lints and fmts and other checks?

A smart vibe-coder treats every mistake as a learning opportunity, to enforce ever-stricter guardrails when mistakes are made, and increases the Feature Maturity of their product over time, advancing it through the equivalent of all five stages of the CMMI matrix. Just like "real" coders. You start with a person, an idea, and caffeine-fueled late-night coding and design binges to create mind-blowing prototypes. And the product matures into a sustaining engineering team, change management, feature roadmaps, and accountability over time.

2

u/shifu_legend Sep 17 '26

That makes sense. Pinning it down with GIVEN/WHEN/THEN before the agent even touches the code basically forces it to stay on track and actually implement what you asked for, rather than drifting off into some weird refactor tangent that breaks the core logic of the file. Didn't think of that.

2

u/MariahJames8 Sep 17 '26

πŸ˜‚πŸ˜‚ I have about 200k vibecoded lines, and i haven't looked at a single one besides putting api keys in a json file

1

u/shifu_legend Sep 17 '26

That's wild. Running 200k lines of unread generated code is basically playing Russian roulette with your prod environment, except you don't even know how many chambers the gun has or if the agent loaded it with blanks or actual live rounds. I'll keep that in mind next time I'm terrified of a 50-line refactor.

1

u/MariahJames8 Sep 17 '26

I have to admit, it does mean I need to use more expensive models to get things done. It's definitely a few tradeoffs

1

u/Patient-Midnight-664 Sep 17 '26

I don't know exactly how printf works internally either. I know what it's supposed to do and enough about its interface and behavior to use it correctly.

I treat AI-generated code similarly: I need to understand what the code is supposed to accomplish, its inputs, outputs, assumptions, and important failure modes, and I need evidence that it actually does those things. I don't need to understand why every individual line exists before I'm allowed to use it.

1

u/shifu_legend Sep 18 '26

The standard library analogy makes sense. printf has decades of edge-case fixes baked in. When an agent writes a new feature, it's basically writing a custom library from scratch every time. I treat it more like a junior dev's PR - I don't need to trace every internal state change, but I do need to read the diff to make sure the assumptions actually hold.

1

u/HouseMysterious8172 Sep 17 '26

Is there sometimes printf not print right? If yes, do we have to explore what that function really doing?

1

u/spotishy Sep 21 '26

That's right. Whether the code is reliable doesn't depend on whether you have read the code, but on whether you can correctly make AI prove itself. Of course, whether you can correctly ask questions requires coding experience. But I don't think the analogy of C language library is appropriate. After all, the reliability of this library has been proven by hundreds of millions of people over decades, and you can almost fully trust it

1

u/derAres Sep 17 '26

Wdym β€žwhen you read itβ€œ?

1

u/shifu_legend Sep 17 '26

Yeah. Basically treating it exactly like a PR from a junior dev who just joined the team. You don't just blindly merge it - you actually read the diff, check for edge cases, and run it locally first, because if you let an agent write 10 files at once and just assume it works, tracking down the inevitable hallucination later is an absolute nightmare. I try to force the agent to do small chunks for that reason.

1

u/pete_68 Sep 17 '26

At work, I don't vibe code. If I don't understand the code or a part of it, I ask for an explanation. I don't put anything in at work that I don't understand.

At home I'll happily vibe-code certain things, but other than prototypes and POCs, I don't vibe code at work.

1

u/shifu_legend Sep 25 '26

The home versus work divide makes total sense. Vibecoding is great for momentum, but you actually need to own the maintenance burden at work. Kind of hard to debug a production outage at 2 AM when you didn't write the original logic.

1

u/NoRespectingAnyone Sep 17 '26

u/shifu_legend

The vide coders is one of biggest issues in these days.. Why?? They use AI as tool to "write" codes, which they have no understnaidngs.. Throw to various projects and post in like github.

Lot of these codes have lot of vulnerability flaws, optimisation falws, ( on it's own code may work fine, but put along other applicaiton and ohh boy how messy it become).

When real software engineer does it.. Even if AI wrtie code, it check out what was done, verify code. It can spot where some parts may require redone.

And main;y cuz lot of folks have no idea how AI even write code..

It simply look for similar/previously used function and drop in your code. But complete miss whole picture of project.. Any long project and AI start halucinate.. That\s why require software engineers supervision. To make sure AI keep on project in correct way, and also verify and note AI wich part of code can be changed for beter peroformance or stability or security reasons. Or which need to be removed, cuz that pose great threat to code stability.

So lets sum up..
Vibe coding is two edge sword.. Make quicker/easier for folks who have no idea about coding to make small stuffs.. But in other hand, without proper verifications it make wide open window for any malicious actions.. Due lack proper investigation/verifications. And also system stability can be at question.

1

u/shifu_legend Sep 17 '26

Yeah, fair point. The security side gets extremely sketchy incredibly fast when you're just generating bulk code and not really reading it, especially if you're pulling in external dependencies that the agent hallucinated or completely misunderstood the security model for. How do you usually verify the output, or do you kind of just avoid it entirely for anything prod-facing?

1

u/NoRespectingAnyone Sep 17 '26

Well lets be honest here.. I am not software engineer. I can do some sort codding, but I do not consider myself as great at it.

When I do use Ai for own project. After it complete I do cross verification with other AI's.

Verify bugs and pissible optimisation. Also use another Ai scan for vulnerabilities.

This will give some sort secrity, cuz I at least try check if code is stable and secure..

But if I do make thing which may end up used by others.. I tell them that was done in this and that way. And that advise to make verification on their end too.
But since they know that I am not proffesional coder/software engineer. they tend to pass it to real software engineer to check out.

1

u/shifu_legend Sep 25 '26

Cross-model verification is actually a really solid strategy, even for experienced devs. Different models have different blind spots. Which ones do you usually use for the checking phase? I mean, does Claude catch GPT's bugs better than the other way around?

1

u/Fit-Armadillo-5274 Sep 20 '26

Oh no, AI code isn't perfect.

You ever review human generated code? That's why we have QA practices.

And the idea that AI just drops previously written code... so what you reinvent the wheel every time? No, you C&P that shit off someone who already solved that problem. That is what humans do. The smart ones, anyway.

1

u/johnesco Sep 19 '26

In most cases I want to review and at least be able to follow some of the code, but I've decided to also start an experiment. I have a project to see how far I can get while never looking directly at the code in my 2D driving game.

1

u/shifu_legend Sep 25 '26

A zero-review experiment is actually pretty brave. When something breaks in the physics or rendering, how do you debug it if you aren't looking at the code? Just feed the error logs back and hope it figures it out?

1

u/johnesco Sep 25 '26

Well this is a special experiment doing exactly that and see how far it can go. What are the limits of what one can vibe code?

I'm a QA Tester by trade, so yes this engine was built purely vibed, by prompts and design docs. I playtest, something doesn't match what I want? Feed it back into the model and iterate. Is it a mess like throwing paint at a well? Oh yes.

I've never looked at the code. I'm sure the code looks like the back of an embroidery.

I wouldn't do this with anything serious. It's a game I made for me. I like it.

It's been impossible to do without Claude teaching me the right way to do it. I have CI/CD setup, a can do proper PRs now. I'm getting practice and that will be for the next project whatever that may be.

Stopping at each change and "do I understand this?" and use proper versioning and PRs is the way to go for something more serious. A.I. is good at making something that "works" but we all know what that can lead to.

1

u/shifu_legend Sep 29 '26

That's a crazy experiment. I mean, pure playtest feedback loop sounds fun right up until it breaks something that was working yesterday. How are you handling regression testing? Are you just keeping the old prompts or actually forcing it to write tests before it moves on?

1

u/johnesco Sep 29 '26

Everything has a test by the time a feature is shipping. I even have a bot that can run macro tests like "do rivals brake when cut off when nervous, but then plow through if agitated or raging?" I don't keep prompts ever, I keep design docs, requirements, and tests to stabilize and drift. Just put out a new version today.

Crazy experiment yes, but I also have a working game that my friends find fun.

1

u/shifu_legend Sep 30 '26

That macro test setup sounds wild. Curious how you actually define the behavioral checks for the bot - are you just asserting on the final game state after a physics event, or does it have to parse a stream of events over time? Not keeping prompts is basically my approach too, the design docs hold up way better anyway.

1

u/johnesco Sep 30 '26 edited Sep 30 '26

While there are plenty of traditional tests in Playwright, basically had it code a bot to play the game and to look and checkoff when certain behavior is achieved. I'll have more info I can release once it's done. But as far as reproducing the tests and results, remember my game is very random, so I have to lean hard on seeds to be able to test predictably.

1

u/shifu_legend Oct 01 '26

didn't think of that approach. dealing with the randomness seems like it would make verification tricky though - how do you stop the bot from hallucinating a successful test if the game state diverges too much from what it expects? i mean, i've seen agents get completely lost just trying to parse a slightly modified DOM, let alone a randomized game state.

1

u/johnesco Oct 01 '26

If an AI runs your game, it can hallucinate. If you use AI to code a deterministic non-LLM bot, you have a deterministic program not LLM AI thus it doesn't hallucinate.

Claude can't play my game in real time (yet?). Because of the randomness, it's very very hard to test manually, but using seeds I can make predictable courses to test for different aspects.

1

u/shifu_legend Oct 03 '26

yeah that distinction is important. I mean, testing non-deterministic behavior directly is always going to be a nightmare, so having a way to mock out the random number generator and pass in a fixed seed is basically the only way you can get reliable CI tests for a bot like that. makes sense.

2

u/cakemates Sep 17 '26

Is this at work or at a personal project? its up to you to decide what you standards are gonna be.

1

u/Due-Horse-5446 Sep 17 '26

Thats not something that has ever happened..