Hassan Iqbal

Writing

AI code audit: how I audited 69,000 lines of AI-generated code

By Hassan Iqbal,

A founder came to me with a product he had built on Replit. It was ambitious and it kept breaking: every fix caused two new problems. Before changing anything, I read the whole thing, about 69,000 lines. This is how that audit ran and what the founder got at the end of it.

Start with flows, not files

Reading files in order tells you little. I started from what a user does: sign up, request a quote, approve an order, pay. For each one I traced the path through the code from the button to the database and back. A broken product is usually a handful of broken paths.

Sort everything into three piles

  • Solid. Works, and can be left alone.
  • Fragile. Works today, will break when something near it changes.
  • Needs rebuilding. Wrong at the foundation, and patching would cost more than replacing.

Rank by urgency, not by size

Security findings came first: keys that were exposed, routes with no permission checks, queries that returned every customer's data, and testing happening on the live database. These are quick to describe and dangerous to leave.

Then the things blocking launch, then everything else. A small security hole outranks a large missing feature.

Write it for the founder

The report was a PDF with findings grouped under plain headings like security and functionality. Each finding said what was wrong, why it mattered, and showed a screenshot. A founder who does not read code should be able to follow every page.

What happened next

The audit became the plan. Security fixes first, then the broken flows, then a QA tester working through the product screen by screen. A one-off review turned into an ongoing engagement, and the product is now launching.

If you are about to commission one

  • Ask for findings ranked by urgency, with the reason for each ranking.
  • Ask for a verdict on each major part: keep, repair or replace.
  • Ask for it in language you can read without a developer beside you.

Tell me what you are building.

Twenty minutes on a call, or an email with your link. Either way, the reply comes from me.