<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/can-ai-code-and-audit-its-own-code--vxtr1arsk" -->

---
title: Can AI code and audit its own code? | daily.dev
description: A developer argues that while AI can genuinely catch mistakes in its own generated code, it shouldn't be the sole gatekeeper deciding when a web app is ready...
canonical: https://daily.dev/posts/can-ai-code-and-audit-its-own-code--vxtr1arsk
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Can AI code and audit its own code? | daily.dev
og:description: A developer argues that while AI can genuinely catch mistakes in its own generated code, it shouldn't be the sole gatekeeper deciding when a web app is ready...
og:url: https://daily.dev/posts/can-ai-code-and-audit-its-own-code--vxtr1arsk
og:image: https://api.daily.dev/og/posts/VXTR1aRSK.png
og:image:alt: Can AI code and audit its own code?
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Can AI code and audit its own code?

**[WebDev](https://daily.dev/sources/webdev)** · [@adamha](https://daily.dev/adamha) · 1 min read · 8 upvotes · 8 comments

## Summary

A developer argues that while AI can genuinely catch mistakes in its own generated code, it shouldn't be the sole gatekeeper deciding when a web app is ready to ship. Using an example of an AI-built Next.js route with a Prisma query, the piece warns that self-review can share the same blind spots that caused issues like unbounded queries or missing authorization checks. The recommended workflow: let AI build and review, then independently verify with tests, static analysis, and human judgment, especially for higher-risk changes. The post ends by asking readers what checks they trust outside the coding agent.

## Content

Yes. AI can catch real mistakes in code it wrote. I use it to question assumptions, inspect edge cases, and suggest fixes.

But I’m less comfortable when that same review is the _only_ reason we decide a web app is ready to ship.

Imagine an AI builds a Next.js feature. It writes the route handler, adds a Prisma query, generates tests, and then reviews its own work. The review may be useful. It may also share the assumptions that led to an unbounded query or a missing authorization check in the first place.

My preferred workflow is: let AI build and review, then check the result independently with tests, static analysis, and human judgment where the risk calls for it. After a fix, run those checks again.

AI review is valuable. I just don’t think it should be the sole authority verifying its own output.

How do you handle this in your web development workflow? What checks do you trust outside the coding agent?

## Community discussion

Top comments from developers on daily.dev.

**@sandhyak** · 1 upvotes

> Same model, same blind spots. I let AI review, but the gate is outside it: types, lint, integration tests on a real DB, and a human on anything touching auth or data access. Negative tests catch the most, like 'can user A read user B's data?

**@aviacoder89** · 1 upvotes

> I can trust my thinking. The AI is just a helping tool. It doesn't think in anyway...
>
> It can compare, search and analyse the information. Not take the responsibility.

**@elmarchavez** · 1 upvotes

> Generally, I don't trust AI-generated code so I always refer to myself to do the review. I still use AI but not to the point that I let it takeover my workflow. Speed is never a good parameter for quality code.

**@sinarezaei** · 0 upvotes

> The real test is whether the audit can prove access is denied, not just confirm the happy path works. Take a multi-tenant SaaS using PostgreSQL RLS: an AI-generated policy might correctly filter `SELECT` queries but still allow a user to reassign a record to another tenant through an `UPDATE`, or expose data through a `SECURITY DEFINER` function. I'd test cross-tenant reads and writes under the actual application roles, including connection-pool reuse and transaction boundaries. An AI reviewer can flag suspicious code, but the strongest gate is an executable set of deny-by-default security...

## Similar posts on daily.dev

- [Stop Pretending You Trust the Code Your AI Just Wrote](https://daily.dev/posts/stop-pretending-you-trust-the-code-your-ai-just-wrote-z5gqyktus) · Medium · 0 upvotes · 0 comments
- [AI Code Review Best Practices](https://daily.dev/posts/ai-code-review-best-practices-ii7hbaa3j) · Aviator Blog · 15 upvotes · 1 comments
- [How long before we stop reading the code?](https://daily.dev/posts/how-long-before-we-stop-reading-the-code--omchyubsd) · The New Stack · 1 upvotes · 0 comments

---

Tags: [#testing](https://daily.dev/tags/testing), [#nextjs](https://daily.dev/tags/nextjs), [#ai-coding](https://daily.dev/tags/ai-coding), [#vibe-coding](https://daily.dev/tags/vibe-coding)

[View this post on daily.dev](https://daily.dev/posts/can-ai-code-and-audit-its-own-code--vxtr1arsk)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"DiscussionForumPosting","mainEntityOfPage":"https://daily.dev/posts/can-ai-code-and-audit-its-own-code--vxtr1arsk","headline":"Can AI code and audit its own code?","text":"A developer argues that while AI can genuinely catch mistakes in its own generated code, it shouldn't be the sole gatekeeper deciding when a web app is ready to ship. Using an example of an AI-built Next.js route with a Prisma query, the piece warns that self-review can share the same blind spots that caused issues like unbounded queries or missing authorization checks. The recommended workflow: let AI build and review, then independently verify with tests, static analysis, and human judgment, especially for higher-risk changes. The post ends by asking readers what checks they trust outside the coding agent.","url":"https://daily.dev/posts/can-ai-code-and-audit-its-own-code--vxtr1arsk","datePublished":"2026-09-25T14:30:45.878Z","dateModified":"2026-09-25T14:31:01.326Z","author":{"@type":"Person","name":"Adam","url":"https://daily.dev/adamha","image":"https://media.daily.dev/image/upload/s--e2PCwc9o--/f_auto/v1790333479/avatars/avatar_30UbrLUr3QLAeRx1QOTio?_a=BAMAMicg0","description":"Developer building CODYGIENE for developers.","interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"EndorseAction"},"userInteractionCount":70}},"interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":8},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":8}],"comment":[{"@type":"Comment","text":"Same model, same blind spots. I let AI review, but the gate is outside it: types, lint, integration tests on a real DB, and a human on anything touching auth or data access. Negative tests catch the most, like 'can user A read user B’s data?","datePublished":"2026-09-28T09:34:24.438Z","url":"https://daily.dev/posts/VXTR1aRSK#c-gmdtSJjTI","author":{"@type":"Person","name":"Sandhya K","url":"https://daily.dev/sandhyak","image":"https://media.daily.dev/image/upload/s--SE6L2St6--/f_auto/v1788238316/avatars/avatar_F8a71aOthmGqz4gVFZpTi?_a=BAMAMicg0"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1}},{"@type":"Comment","text":"I can trust my thinking. The AI is just a helping tool. It doesn’t think in anyway…\nIt can compare, search and analyse the information. Not take the responsibility.","datePublished":"2026-09-25T17:58:57.378Z","dateModified":"2026-09-25T17:59:53.262Z","url":"https://daily.dev/posts/VXTR1aRSK#c-KDSqzPify","author":{"@type":"Person","name":"Artur Shakirov","url":"https://daily.dev/aviacoder89","image":"https://media.daily.dev/image/upload/s--vhTz0CoY--/f_auto/v1774638099/avatars/avatar_fQxvcg7uJrdZKBjQqyYMf?_a=BAMAMiWQ0"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1}},{"@type":"Comment","text":"Generally, I don’t trust AI-generated code so I always refer to myself to do the review. I still use AI but not to the point that I let it takeover my workflow. Speed is never a good parameter for quality code.","datePublished":"2026-09-26T11:18:03.059Z","url":"https://daily.dev/posts/VXTR1aRSK#c-vYMsEUYQL","author":{"@type":"Person","name":"Elmar Chavez","url":"https://daily.dev/elmarchavez","image":"https://media.daily.dev/image/upload/s--7PjH979T--/f_auto/v1780994221/avatars/avatar_bK85rJb2OXXID2LX2wi5y?_a=BAMAMiWQ0"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1}},{"@type":"Comment","text":"The real test is whether the audit can prove access is denied, not just confirm the happy path works. Take a multi-tenant SaaS using PostgreSQL RLS: an AI-generated policy might correctly filter SELECT queries but still allow a user to reassign a record to another tenant through an UPDATE, or expose data through a SECURITY DEFINER function. I’d test cross-tenant reads and writes under the actual application roles, including connection-pool reuse and transaction boundaries. An AI reviewer can flag suspicious code, but the strongest gate is an executable set of deny-by-default security tests that fails the build when tenant isolation breaks.","datePublished":"2026-10-23T10:12:22.081Z","url":"https://daily.dev/posts/VXTR1aRSK#c-CUTcOw3S5","author":{"@type":"Person","name":"Sina Rezaei","url":"https://daily.dev/sinarezaei","image":"https://lh3.googleusercontent.com/a/ACg8ocLXjJ5mCeyMCQK6CSjPfPxZisLuVwj3KOgnAtXoJoPAAsuvSrxh=s96-c"}}],"isPartOf":{"@type":"WebPage","url":"https://daily.dev/squads/webdev","name":"WebDev"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"WebDev","item":"https://daily.dev/squads/webdev"},{"@type":"ListItem","position":3,"name":"Can AI code and audit its own code?"}]}
```

