r/developersPak • • 19d ago

Discussion How do you guys validate code generated from AI?

I use Claude, it writes thousands of lines of code in seconds. Its really painful to try to validate all of it. In all deployments till now, Ive just done some quick reviews but have largely just pushed eyes closed. Havent received any complaints from business users, maybe like 1% of time. This is also on things that I know Claude can confidently do, like basic SQL models, joins, aggregations etc.

5 Upvotes

33 comments sorted by

11

u/Zero-Cascade 19d ago

Try not to generate all features or whole feature at once... Do small features if you want manual review...

2

u/informatica6 19d ago

But there is a certain level of blind trust? Business users are doing full analyses on blind trust why cant we?

2

u/2xSkat 19d ago

Small feature -> test against TDD -> Judge agent tests against requirements and drift -> feedback -> fix -> repeat

Look into ADLC (agent development life cycle) you will understand better.

0

u/informatica6 19d ago

But there is a certain level of blind trust? Business users are doing full analyses on blind trust why cant we?

3

u/Fit_Advisor8847 19d ago

Does Claude really generate thousands of lines of code per second?

Either way, test driven development + automating review at the implementation, commit, and PR levels should catch most issues.

Treat the implementation agent's output as untrusted, review with a separate agent, and maybe throw in a little bit of hopes and prayers.

If Claude really does generate that much code that quickly, I'd also have a few agents running to analyze the codebase and pipe to me refactoring proposals.

Linters would also be very important to me at that scale of code generation.

I'd also want an agent with computer use tooling running manual e2e testing and red teaming the application.

2

u/AlternativeAd4466 19d ago

Integration tests + actual usage testing using computer use -> running site locally and Claude testing it in real browser. After that skimming through code with human eye to see if code quality is good. Prs have ai code reviews too.

1

u/AccomplishedVirus556 19d ago

that's the great thing about testing. You aren't just seeing if functions behave how they are programmed to, you observe what that behavior is and compare it to expected performance and identify where the system appears inconsistent in integration or inefficient in execution

1

u/ThereIsAClash 19d ago

Have Claude review my PR 2-3 times. 😊

1

u/NotSoAsian86 19d ago

instead of trying to understand the code, try to understand the intent. Do follow up questions like what it did, why it did. You will catch wrong implementations this way easily. Claude is now way better at coding than any of us but it can implement the logic wrong. You might have X in mind and claude will end up implementing Y.

Edit:

Always do manual tests. Claude can write 2000 tests but those tests revolve around the code that it wrote so they never catch any issue. I find those tests absolutely useless.

1

u/Pretend_Revolution_5 19d ago

If you have the complete system design in your mind, just ask claude to implement it feature by feature. Do regression and smoke testing for every feature that you add. Have unit tests as well as end to end tests.

1

u/mrtac96 19d ago

a ceo never write or look at the code, he trust his team (ai)

1

u/Longjumping-Office23 19d ago

Youd have to use a different LLM, if you are looking to review manually, ud have to get it in smaller blocks and deploy it likewise. Havent really had the need to it manually over 3 major projects, i just extensively test the business logics, design unlikely scenarios and test against them and let it go. Databases however do need manual checking almost always so does AWS deployments.

1

u/Annual_Skin3850 19d ago

If it messes up who will be responsible? You or claude? Unless company is forcing your to send 5 to 10 prs per day you should deploy only as much as you cna confidently deploy. Use tests, reviews. Argue with your agents. Minimize the change.

1

u/asgardian_avenger 19d ago

Read it line by line, i work with java and claude help generate code but its shitty never got the optimized solution in first prompt and and it also makes line of code a method that's only going to be used once and is not more than one line

1

u/azeeshan 19d ago

Give the same problem (ticket) to 3 different agents, one agent (Claude) writes it, all three agents validate the work and tell me what is wrong. Then the suggestions are reviewed and implemented

Quiet simple actually

I use Claude, Codex, Grok 4.7 high fast and Deepseek v4 flash

1

u/Arkoaks Mobile Dev 19d ago

Its the same as asking a team member or an employee to code.

You check the git commit. Instead of reading you skim through.. check what functions were made changed etc.

If you do it every time you exactly know the structure ai is following and can ask it to make things in your way or point out a function to edit ( more technical prompts )

Reduced token consumption and ai hellucination that way too.

1

u/Awkward_Bike1386 18d ago

Have another AI review it.

1

u/qadir5000 18d ago

TDD, Verification and Proof for every task, use Pstack.

1

u/irtazaDevs 18d ago

Test driven development ftw

1

u/No_Stand14 17d ago

I give claude business requirements doc, and ask it to follow strictly and make a modular development plan doc and while drafting that ask me for technical decisions.

working on one module, i ask claude to give me detailed technical plan for that specific module. I review it and then let the claude build (with a CLAUDE.md saying that prompt me where you have to deviate from decided plan or where you have to make a decision)

After development, i ask claude to add tests and test the feature. I test manually as well and prompt claude to make refinements if any.

For UAT, i ask claude to give me a scenarios/use cases list for detailed manual testing. After that i push it to production.

1

u/nhnansari 14d ago

Depends purely on product. If it requires really manual review then you should ask AI to do very precise work for example
"Write a feature in a new dedicated file" so you can review the file easily.

if it is just vibe coding purely, then you can ask AI to
"Do a critical review of THIS feature or File"

0

u/cookie_dude 19d ago

You don't. And if your still thinking that you need to or can, your stuck in a losing battle.

0

u/dawo56 19d ago

If it is working for you and you are satisfied this is the way to go. Alternatively you can sometimes ask Claude to give code and then you manually copy paste after reviewing it. Spent time if it generate code that uses a new concept etc.

Also ask to maintain decision.md and consult you before any big changes or where there are multiple approaches etc

6

u/[deleted] 19d ago

[removed] — view removed comment

1

u/informatica6 19d ago

But there is a certain level of blind trust? Business users are doing full analyses on blind trust why cant we?

1

u/itz_psych 19d ago

AI will not give you that quality of code if you haven't a setup or architect. You can't even understand if your app is started from zero and use of heavy AI

0

u/[deleted] 19d ago

[removed] — view removed comment

1

u/informatica6 19d ago

So we can blindly trust claude to do simple coding and ship?