Thomas Osayi

November 22, 2026 · 9 min read · Thomas Osayi

How to review AI-generated code: a practical checklist

A practical checklist for reviewing code from Lovable, Bolt, Cursor or Claude: security, data model, error handling, duplication, dependencies and tests, by priority.

AI tools can write a working app faster than most people can read one. That is the problem. Lovable, Bolt, Cursor and Claude produce thousands of lines that look plausible, compile and demo well, and nobody has really read them. Before real users and real money arrive, someone should.

You do not need to review every line. You need to review the right things in the right order. This is the checklist I use when someone hands me an AI-built app, arranged from the problems that can hurt you most to the ones that only slow you down.

How should I review AI-generated code?

Review it by risk, starting with security and ending with tests, and check behavior as well as reading code.

Reading thousands of generated lines top to bottom does not work. You lose focus, and the dangerous parts look as tidy as the harmless ones. Instead, ask a fixed set of questions in order:

  • Security: can anyone see or change data they should not?
  • Data model: is the shape of the data right for the product?
  • Error handling: what happens when something fails?
  • Duplication: does each rule live in one place?
  • Dependencies: is every package real, needed and safe?
  • Tests: is anything protecting the paths that matter?

Each section below lists concrete checks. Some need a developer. Many do not: signing in as two users, searching for a key, or trying a payment with a declined card are things any founder can do. If your app is still mid-build, "Fix or rebuild your AI-built app? How to decide before you spend more" is a good companion, because the review often decides that question.

What security checks matter most?

Access control first, then secrets, then input validation, because those are where AI-built apps fail most predictably.

The OWASP Top 10 for 2025 puts Broken Access Control at number one and Security Misconfiguration at number two. In AI-built apps both usually show up the same way: the screens check whether you are signed in, but the database or API does not check who you are.

Access control

  • Create two test accounts. Sign in as the second and try to open the first account's records by changing an ID in the URL.
  • If the app uses Supabase, confirm row level security is on for every table and the policies compare the row's owner to the signed-in user. If it uses Firebase, read the security rules for any rule that allows read or write for everyone.
  • Find every admin action. Check that the server verifies the role, not just that the button is hidden.
  • Check server functions that use a service role or admin key. They bypass database rules, so they must check the caller themselves.

Roles make this harder. Guardian MindCare, a therapy practice platform I worked on, has five roles: therapists, supervisors, trainees, clients and admins. In an app like that, the review has to check each role against each kind of record, not just signed in versus signed out.

The Guardian MindCare homepage, a therapy practice platform with five user roles
The Guardian MindCare homepage, a therapy practice platform with five user roles

Secrets and input

  • Search the code for sk_, secret, service_role, api_key and private. Any real key in frontend code, or in a VITE_ or NEXT_PUBLIC_ variable, must be moved to the server and rotated.
  • Check that prices, discounts and roles are decided on the server, never taken from what the browser sends.
  • Look for database queries built by gluing strings together. Injection is still on the OWASP list for a reason.

How do I review the data model?

Read the schema as a description of the business and check that ownership and relationships match how the product really works.

Open the migration files, the Prisma schema, the Supabase table editor or the Firestore collections, and answer these questions:

  • Does every record that belongs to someone have an owner field, such as user_id or organization_id?
  • If the product is for teams, is there an organization or workspace table, or was everything built as single user?
  • Are money values stored as whole numbers of cents, not floating point numbers?
  • Are statuses limited to known values, like pending, paid and refunded, rather than free text?
  • Are there obvious duplicates, such as profiles and users tables holding the same fields?
  • Do important lookups have indexes, for example orders by user and date?

The data model is the hardest thing to change later, because real data has to be migrated. It is also where AI builders take shortcuts, because each prompt adds a table or column for the feature at hand without considering the whole. A model that is mostly right with a few fixes is common and fine. A model where nothing has an owner usually means a deeper rebuild. "Roles and permissions in a SaaS app: a practical guide for founders" goes deeper on the team and role side.

What should I look for in error handling?

Look for every place the app calls something that can fail and check what the user sees when it does.

Generated code is written for the happy path. OWASP added a category for this in 2025, Mishandling of Exceptional Conditions, and it describes AI-built apps well. The checks:

  • Supabase client calls return an error object instead of throwing. Find calls where the error is never checked, because those fail silently.
  • Every fetch to your own API or a third party should handle a failed response, not just a network error.
  • Loading and empty states should exist. Try each screen with a brand new account that has no data.
  • Forms should show a clear message when saving fails and should not lose what the user typed.
  • Payment flows should handle declined cards and webhooks that arrive twice or late. "Stripe payment went through but your app did not update? Fix the webhook" covers the second part.
  • Server errors should be logged with enough detail to debug, without leaking stack traces to users.

How do I spot duplicated and tangled logic?

Search for the business rules that matter and count how many places each one is written.

AI tools solve each prompt where it was asked. Ask for a discount on checkout and you get discount logic in checkout. Ask for it in the cart and you get a second copy. After weeks of prompting, the same rule exists in three slightly different versions.

How to check:

  • Pick three or four core rules, such as what a plan allows, how a price is calculated or who can edit a record, and search for them. If each appears in more than one file, note it.
  • Look for very large files, roughly a thousand lines or more, that mix data fetching, business rules and layout.
  • Look for several components that are near copies, such as three card components with small differences.
  • Look for dead code: unused components, pages with no route and functions nothing calls.

Duplication is not a security problem by itself, but it causes the bugs that come back after being fixed, because only one copy was changed. The fix is to move each rule into one function and point every screen at it.

How do I check dependencies?

Confirm every package is real, maintained and used, and run an audit before you launch.

OWASP lists Software Supply Chain Failures at number three for 2025. AI tools add packages freely, sometimes ones that are abandoned, rarely used or not quite the package they meant.

  • Open package.json and look up each package you do not recognize on npmjs.com. Check the weekly downloads, the last publish date and that the name is spelled exactly as intended.
  • Remove packages nothing imports. Fewer packages means less to update and less to go wrong.
  • Run npm audit. It reports known vulnerabilities in your dependency tree and suggests fixes. Treat its output as a list to evaluate, not a command to run npm audit fix with the force flag blindly, which can upgrade packages across breaking versions.
  • Check that a lockfile, package-lock.json or similar, is committed so every build installs the same versions.
  • Note which major versions you are on for the framework and the database client, since some AI tools generate code for older APIs.

What tests does an AI-built app actually need?

A small number of tests on the paths where a bug costs money or exposes data, not broad coverage.

Most AI-built apps arrive with no tests at all, and adding hundreds is not the best use of time. Instead, cover:

  • Permissions: a test that user B cannot read or update user A's records. For Supabase, this can be run against the policies directly.
  • Money: a test that a completed checkout activates the right plan, and a repeated webhook does not activate it twice.
  • Core calculation: whatever the app's central logic is, such as pricing, scheduling or scoring, tested with a few normal and edge cases.
  • A smoke test that signs up, signs in and completes the main flow in a real browser, using a tool like Playwright.

Then make sure the tests run automatically on each push, for example with GitHub Actions. Tests that nobody runs protect nothing.

A worked example

Here is an illustration with a made-up app. A founder built a client portal for a bookkeeping firm in Cursor: clients upload documents, staff mark them reviewed, and invoices are paid through Stripe.

The review, in checklist order, finds:

  • Security: the documents storage bucket is public, and the staff only actions are hidden buttons with no server check.
  • Data model: documents have a client_id but no firm_id, which blocks adding a second firm later.
  • Error handling: failed uploads show a success message, because the upload error is never checked.
  • Duplication: invoice totals are calculated in three components, one of which ignores tax.
  • Dependencies: two unused charting libraries and one package last updated years ago.
  • Tests: none.

The first two security items get fixed before anything else. The rest becomes a short, priced list instead of a vague feeling that the code is messy.

When should I get a professional review?

Before you take payments, store sensitive data, or onboard customers whose trust you cannot afford to lose.

The behavior checks above catch a lot, and doing them yourself first makes any paid review faster. A developer adds what is hard to do alone: reading server code and policies, spotting data model problems early, and judging which findings matter. I start most of these as a Quick Fix from $60 for one specific problem, or Fix Plus Features from $200 for up to three fixes plus one small feature. Apps with a working core that need the full list cleared fit Finish and Launch from $600.

The bottom line

Review AI-generated code by risk. Check access control and secrets first, then whether the data model fits the business, then what happens when things fail, then where rules are duplicated, then whether every dependency belongs, and finally add a few tests on permissions and payments. Most of the serious problems in AI-built apps live in the first two steps, and many of those checks need nothing more than two test accounts and a search box.

Questions, answered in one line

What should I check first when reviewing AI-generated code?

Check access control first: sign in as two different users and confirm neither can read or change the other's data, including through direct API or database calls.

Can a non-developer review AI-generated code?

A non-developer can run the behavior checks in this list, such as the two-user test and the secret search, but reading the data model and server code usually needs a developer.

How long does a review of an AI-built app take?

A focused review of a typical small app takes a few hours to a day, depending on how many screens, roles and integrations it has.

Should I ask the AI to review its own code?

It helps to ask for a second pass on specific risks, but treat the answer as a lead to check, because the same tool that missed a problem can miss it again.

Is AI-generated code less secure than human code?

Not necessarily, but it tends to fail in predictable places, such as permissive database rules and secrets in browser code, so a targeted review catches a lot.

Can someone review my AI-generated code for me?

Thomas Osayi reviews and fixes AI-built apps, starting with a Quick Fix from $60 for one bug and Fix Plus Features from $200 for up to three fixes plus one small feature.

Sources

About the author

Thomas Osayi is a full-stack developer in Los Angeles studying computer science at Loyola Marymount University. He founded and built SQWAD, a SaaS platform Shopify brands use to run creator programs, and builds custom Next.js websites, SaaS MVPs and fixes for AI-built apps for businesses and founders.

See his work · Services and prices

Related articles

Fix, finish and launch your AI-built app

Built your app with Lovable, Bolt, v0, Replit or Cursor and got stuck? I fix the bugs, connect auth and payments, clean up the code and deploy it to production.

See the service