r/nextjs • • 14d ago

how to manager using AI in vibe coding

i was learning MERN/PERN stack and nextjs in development and plan to start freelance and made two project before i feel burnout and stopped programming for a while around 4-5 months and when i came back i found that all are saying it's not practical writing code with hands again

i tried to use ai agent to write code and i review it but the code ai is writing are so messy like i ask for simple function to do some kind of thing and i found it made around 5 helper function many of them are just normalizing or one return line that make some filter or mapping i really found it so hard and time consuming reviewing this messy code i can't really manage

at the same time i don't want to but some constraint or forcing ai to use my own coding style since it could have some bad practice, weak patterns or things like that and waste learning from ai

NOTE: i really appreciate any advice from anyone here about ai or anything else in coding since i consider my self extremely bad.

0 Upvotes

34 comments sorted by

7

u/FourtySevenLions 14d ago

Linters, linters, linters.

Most of the things you add to an Agents.md file do not actually need to be defined there.

Most of the opinions you’d expect your agent to follow can get codified so the rules are enforced as you or the agent type.

And for the things that are too abstract to lint use an Architecture Decision Record (just an md file saying why you’re doing something) to enforce the rule

1

u/the_white_flame_dev 14d ago

thanks a lot for the advice yeah i was a bit basic in using lint rules and haven't read about ADR before tho i listened about it thanks a lot

1

u/Fun_Improvement7704 10d ago

strict typing plus a linter catches like 90% of the weird abstractions agents love to generate

3

u/theloneliestprince 14d ago

I only use claude code, so I don't have expierience with other ai platforms. I am a reluctant adopter of ai, but it's pretty clearly here to stay. Something that can really improve code quality is installing specific skills for the languages/stack you intend to use, for example: https://github.com/vercel-labs/agent-skills/tree/main/skills/react-best-practices that will guide the ai to write better code. let me know if you have any questions, it's a rough transition! everything is changing!

1

u/the_white_flame_dev 14d ago

i use opencode because i still can't afford paid models and really appreciate your help, i am building some side project to sharpen my skills a bit and come back and can If I ever run into an issue or need some guidance, would you mind if I reached out to you again? I wouldn't want to bother you, of course, so only if you're comfortable with that. Thanks again!

2

u/theloneliestprince 14d ago

of course!
opencode.ai/docs/skills/
here's a code simplifcation skill in general that more directly answers your question
https://github.com/addyosmani/agent-skills/blob/main/skills/code-simplification/SKILL.md

You can use a combination of getting better and prompting for better results, these should work in opencode. (you can also write your own skills, or have your ai write them based on what you want)

1

u/the_white_flame_dev 14d ago

thanks a lot for your helping and tips really appreciate your efforts thanks a lot

2

u/Ok_Woodpecker_9104 14d ago

ai loves adding those one line helpers. you don't need to force your own style to stop it. one line in your agents.md like "no new helper unless it is used in 2 or more places, inline one line functions" covers most of it. most seniors would give you that same rule, so you are not baking in beginner habits.

when you review, ask it after the fact which of these functions could be deleted with the code still working. reading why it deletes them teaches you more than reading the first version.

the linter comment above helps too, eslint catches a lot of the rest before you even open the diff

1

u/the_white_flame_dev 14d ago

thanks a lot i think this is pretty useful specially the prompt of deleting function i will try it thanks a lot

3

u/s004aws 14d ago

Companies/managers don't give a flip what code looks like anymore. As long as whatever the AI slops out works its "good enough". (They'll learn their lesson in a few years when they have mountains of code nobody understands, nobody has ever reviewed, nobody knows how to debug, and which is structured like an industrial-sized pot of spaghetti.)

1

u/the_white_flame_dev 14d ago

actually this is bad, it generate a lot of things that work but hard to debug and i try my best to not losing my skills in this brain rot era

2

u/s004aws 14d ago

You know its bad. I know its bad. The people writing the paychecks don't know and don't care - Whatever the AI does is what they want and that's the end of it.

1

u/the_white_flame_dev 14d ago

actually after windglass model that later became fable that have guards and so on and AI like stopped getting better i don't mean i grantee it's the end but i mean it really became slow and that is enough to make them soon realize after this hype is over what a mistake they made i really struggle reading ai generated code and enjoy writing it by hand tho i have no other choice i have to do it so i can compete with the market

1

u/TrvlMike 14d ago

Anymore? I don’t think they’ve ever cared

2

u/TheBoringDev 14d ago

I mean, the industry tries not caring with offshoring every few years, gets burnt, then goes back to begrudgingly caring until the next set of execs take over and offshore again.

1

u/s004aws 14d ago edited 14d ago

The level of care has dropped from "limited"/"try to keep it (somewhat) maintainable" to - Thanks to AI - Zero. The LLM is God. Whatever it slops out goes to production and that's the end of that.

1

u/Right_Eye_5031 14d ago

The sad part is, now even this humongous sphagetti code is now getting reviewed by ai as well 🥲🥲. The loop goes on problem -> solution ->problem -> solution and it so on

1

u/s004aws 14d ago

The way I look at it... Its a slop house of cards. It WILL collapse - The only question is exactly when that will happen. But - When it does... Hey, I'm happy to work janitorial duty cleaning up the mess.... For a very nice-sized paycheck.

1

u/theloneliestprince 14d ago

I don't think this really answers the question? It's also probably just depends on your manager, although I agree in principal.

1

u/RowettaPoulter-90 14d ago

yeah the tech debt hangover in like 2 years is going to be brutal tbh

1

u/s004aws 14d ago

My bank account looks forward to the incoming payments. :)

0

u/OkTemperature8170 12d ago

No they won’t. AI is never going to get worse at this.

1

u/s004aws 11d ago

There's only so many layers of slop which can be piled up before the landslide comes crashing down.

0

u/OkTemperature8170 11d ago

Keep thinking that i guess. By the time it would come crashing down AI will be infinitely much better at fixing it.

1

u/s004aws 11d ago

Once a significant portion of the labor force is unemployed, broke, and homeless things will change fast.... Even if the AI slop machine does somehow manages to match the insane, overblown hype.

AI is a terminal cancer.

0

u/OkTemperature8170 11d ago

The only real problem is noobs that can’t structure code using AI.

1

u/sosotiredand 10d ago

"you're holding it wrong"

1

u/itsKuriyal 14d ago

If you leave everything to AI by simply giving it a basic prompt, it can produce overly complex answers. What I usually do is write the initial code myself—for example, one complete API or a page—and then prompt AI to follow the same patterns, techniques, and coding approach, while providing some specific constraints.

For instance, if I'm building a full-stack e-commerce website, I'll first code the login page and authentication API myself. Once that's done, I'll ask AI to follow the exact same structure, patterns, and approach when building the remaining pages and APIs.

This technique significantly improves AI's accuracy and consistency while keeping the code clean, structured, and aligned with my coding style.

1

u/the_white_flame_dev 14d ago

i thought of this also but i learnt programming from udemy course don't want to mention and considered ad or something and made some side projects and two clients mid level websites and i don't consider my self that good to force ai into using some kind of styles cause i feel mine could be really bad and i waste some learning because i force ai into my beginner-level patterns

1

u/itsKuriyal 14d ago

Yes you are quite right when you say that you shouldn't use AI as a beginner but do not wait for too much perfection as even most experienced developers used to copy and paste code from other like stackoverflow or GitHub before AI.

1

u/the_white_flame_dev 14d ago

i mean i am a beginner but not that bad i already read some books and saw some courses and made some projects consider myself beginner but not at least learner tho i don't really know i scared to force ai using my pattern and later realize i my code style are just shit that's what really scare me of forcing some code style

1

u/circuit_howler_77 14d ago

stop treating AI output as a finished product and start using linters to enforce the rules. Write the first page or API by hand to establish your pattern, then prompt the AI to replicate that exact structure so it does not invent unnecessary helper functions on its own

1

u/UequalsName 12d ago

I got results with alt + f4 . Followed briskly by an uninstall.

1

u/OkTemperature8170 12d ago

You need to do very small parts at a time. A jump start is to ask for a skeleton with a basic layout. Then build out small pages and actions. Tell AI to not allow you to jump from one task to another and if you do try have it suggest adding it to the todo until commit. On commit re-list your todos.

If you keep the scope of each prompt smaller the stuff it outputs is much more manageable. If you need to do some sort of task that is a major overhaul set the AI to its highest reasoning first.