Justin McKelvey
Ran snowboard shops. Taught myself to code. Now I build AI that does real work.
How to Tell If Code Is AI-Generated: A CTO's Field Guide (2026)
Quick Answer
How do you tell if code is AI-generated? Not with a detector — none of them work reliably on code as of 2026. You read for the tells: comments that narrate the obvious, calls to APIs that don't exist, naming conventions that shift file to file, the same logic pasted in three places, defensive error handling around code that can't fail, and green test suites that assert nothing. One tell is a hint. Four or more is a pattern — and if it's your production codebase, a problem worth taking seriously.
Verified August 2026 · Author: Justin McKelvey, fractional CTO & AI consultant, 15 years in software, 50+ products shipped
TL;DR: The Detector You Want Doesn't Exist. The Skill Does.
Everyone searching this wants a scanner: paste the repo in, get a percentage out. I audit AI-built codebases for a living, and I'll save you the search — that tool doesn't reliably exist, and the ones that claim to are selling confidence, not accuracy. AI-text detectors work (badly) on prose because prose carries statistical fingerprints in rhythm and word choice. Code goes through formatters, linters, and compilers that erase exactly those fingerprints. What survives is structure — and structure is readable by a human in about ten minutes. This guide is that ten-minute read, from someone who does it weekly on rescue engagements.
Why "Check If Code Is AI-Generated" Tools Come Up Empty
Three reasons, all structural. First, training data: detectors learn on human-vs-AI prose pairs; code's vocabulary is constrained by syntax, so the signal is thinner from the start. Second, normalization: run any developer's code through Prettier or Black and it converges on the same shape AI output already has — the formatter destroys the evidence. Third, the mixed reality of 2026: most professional code is now human-directed AI output with human edits, so the binary question "AI or not?" is the wrong question. The useful question is the one the tells answer: was this code reviewed by someone who understood it?
The 9 Tells of Unreviewed AI Code
From real audits — every one of these has shown up in a codebase someone paid real money for.
-
1. Narrated comments.
// Loop through the users and check each oneabove a loop through users, checking each one. Humans comment why; AI comments what. Density of obvious comments is the single fastest tell. - 2. Hallucinated APIs. Calls to methods that don't exist in the installed version of the library — or at all. If the repo has ever needed a "fix undefined method" commit spree, you're looking at unverified generation.
-
3. Convention drift.
camelCasehere,snake_casethere, three different date-formatting approaches in one project. Each file reflects a different chat session's mood. - 4. Copy-paste logic. The same validation or transformation written out longhand in three controllers instead of extracted once. AI doesn't remember it already solved this two prompts ago.
- 5. Ceremonial error handling. try/catch wrapped around code that cannot throw, while the network call two lines down goes naked. Defensiveness distributed by vibes, not by risk.
-
6. Tests that assert nothing. A green suite full of
expect(true).toBe(true)-grade checks, mocks that mock the thing being tested, and zero edge cases. Coverage without protection — the most expensive tell on this list. - 7. Uniform freshness. Whole files that arrive fully formed in single commits, with none of the scar tissue real code accumulates — no TODO, no commented-out attempt, no incremental history.
- 8. Boilerplate maximalism. Every file carries the full ceremony — interfaces, factories, config objects — for a feature that needed twelve lines. AI scaffolds like it's billing by the abstraction.
- 9. The knowledge test fails. The decisive one: ask whoever shipped it to walk you through a nontrivial file. If they can't explain their own code, it doesn't matter who wrote it — nobody reviewed it, and that's the actual risk.
What This Means If It's Your Codebase
If you're an owner or founder reading this because a contractor's deliverable feels off, or your vibe-coded app is starting to wobble — here's the honest framing. AI-written code isn't inherently bad; unreviewed code is, whoever wrote it, and AI just made unreviewed code cheap to produce at volume. The pattern I see on every rescue call is identical: the demo was great, the first two months were great, and then edge cases the prompts never mentioned started arriving as production bugs. That arc, and whether it's fixable, is covered in the honest case for and against vibe coding — the short version is that it's usually fixable, and rarely by a full rewrite.
How AI Code Detection Actually Works: What the 99% Accuracy Claims Do Not Cover
Every detector sells a percentage. Read the vendor's own page and the percentage turns out to be about something else. GPTZero advertises "99.9% accuracy rates across diverse datasets" (it said 99% when this section went up; re-read October 26, 2026), and the same page says accuracy "improves with longer inputs" and "is strongest on English prose." Its supported-language list is English, German, Portuguese, French and Spanish. No programming language is on it. Turnitin quotes a false positive rate under 1%, measured on documents that meet a 300-word requirement. Also prose. (Both pages read September 23, 2026.)
Now do the math the accuracy claim skips. Take the best published number at face value and apply it per file: a 1% false positive rate across a 300-file repository flags about three files a human wrote, before it has caught a single AI one. And the signal it measures, word rhythm, is the first thing a formatter rewrites. That is why the tells above check structure and review instead of style. Structure survives Prettier. A detector's signal does not.
The 20-Minute Owner's Audit (Do This Today)
You don't need to read code to run this. First, the knowledge test: ask your developer to walk you through the most important file on a screen share — tell #9 settles most cases in five minutes. Second, security surface: run my free 20-point vibe coding security checklist against the app; exposed API keys and missing auth checks are where unreviewed AI code gets expensive fastest. Third, count the tells above in any two files — a developer friend can do this over coffee. Zero to two tells: relax, review going forward. Four or more, on an app your revenue depends on: get a structural audit before you build anything else on top. That's the front door of Vibe Code Rescue — triage what's salvageable, stabilize what's load-bearing, rebuild only what's actually broken.
What is the best AI code detector?
The best AI code detector is a person who reads the structure, plus your repository's commit history. I haven't found a detector that publishes an accuracy number measured on code. GPTZero is the name most people mean, and its own page (read October 26, 2026) claims 99.9% accuracy while saying accuracy "is strongest on English prose" and listing five supported languages: English, German, Portuguese, French and Spanish. None of them is a programming language. So if a tool hands you a percentage for a repository, ask what it was measured on before you act on it.
What works instead costs nothing. Open the commit history and look for tell #7: whole files that land fully formed in one commit with no edits after. Then count the other tells in two files and run the knowledge test. Those three checks take about 20 minutes and tell you what a detector score can't: whether anyone reviewed the code.
Next step Get the free repo audit →
What your AI stack actually costs
Prices changed 3x this year. The always-current cost sheet: sticker price vs what heavy use actually costs for Cursor, Claude, Replit, Lovable, Bolt & more.
Frequently Asked Questions
- How can you tell if code is AI-generated?
- Read for the tells, because no tool does it reliably. As of 2026 the strongest signals are: comments that narrate the obvious ("// Loop through the users"), API calls to methods that don't exist in the library version being used, naming conventions that change file to file, the same logic duplicated in three places instead of extracted once, defensive try/catch blocks wrapped around code that can't throw, and test suites that run green while asserting almost nothing. One tell is a hint; four or more is a pattern.
- Is there a tool that detects AI-generated code?
- No reliable one exists as of 2026, and be skeptical of anything that claims otherwise. AI-text detectors are trained on prose rhythm and vocabulary — signals that formatting, linting, and compilation strip out of code entirely. A human developer's code passed through Prettier looks statistically identical to Claude's. The dependable method is a structural read by someone who has seen a lot of both, which takes about ten minutes per repo and is the first step of every audit I run.
- Does it matter if my developer used AI to write code?
- Using AI isn't the problem — most good developers do as of 2026, and it makes them faster. The problem is unreviewed AI code: generated, pasted, and shipped without anyone understanding it. Reviewed AI code looks like the rest of the codebase and has tests that mean something. Unreviewed AI code accumulates what I call vibe debt — it works in the demo, then falls over on the edge cases nobody read closely enough to anticipate.
- Why did my AI-built app work at first and then start breaking?
- Because AI-generated code optimizes for the happy path it was prompted with. The demo flow works; the edge cases — concurrent users, malformed input, expired sessions, the database growing past toy size — were never in the prompt, so they were never handled. This is the standard arc of every rescue call I take: months one and two feel great, month three the bug reports outpace the fixes. The fix is a structured audit, not more prompting.
- What should I do if my codebase is mostly unreviewed AI code?
- First, don't panic-rewrite — some of it is probably fine. Run a security pass first (exposed keys, missing auth checks, and injectable queries are the expensive surprises; my free 20-point security checklist covers the scan order). Then get a structural audit that separates the salvageable from the load-bearing slop. If the app matters to your revenue, that's exactly what a rescue engagement is for — triage, stabilize, then rebuild only what's actually broken.
- What is the best AI code detector?
- A structural review plus the repository's commit history. As of October 2026 no detector we have read publishes an accuracy number measured on code: GPTZero's page claims 99.9% accuracy but says it is strongest on English prose and supports five human languages, none of them programming languages. Check the commit history for whole files landing in one commit, count the tells in two files, and ask the developer to walk you through one; that takes about 20 minutes.
- How accurate are AI code detectors?
- Their published accuracy numbers are measured on prose, not code. GPTZero's own page says its accuracy is strongest on English prose and lists five supported human languages, none of them programming languages; Turnitin's under-1% false positive rate is for documents over 300 words. Applied per file, even a 1% false positive rate flags about three human-written files in a 300-file repository. A structural read is still the reliable method as of September 2026.
More on Vibe Code Rescue
Claude Code Tutorial (2026): What to Learn, in What Order, and the Free Courses Worth Your Time
Anthropic's own free courses teach Claude Code in about 5 hours and 15 minutes across five of them. The courses are free, the tool isn't: you need Claude Pro or higher. Here's the order to take them in, the week of real work that goes in the middle, and the tutorial advice Anthropic now says to stop following.
What Is Prompt Injection? How It Hits the AI Feature You Added to Your Lovable or Cursor App
Prompt injection is when text your AI feature reads carries instructions the model follows instead of yours. OWASP ranks it the #1 risk for AI apps, and there's no full fix. Here's what it looks like in a founder's app, three real cases, and the fixes that limit the damage.
Is Supabase Secure? Yes, If RLS Is On: How to Check Yours in 5 Minutes (2026)
Supabase the platform is secure: SOC 2 Type 2, encrypted data, regular pen tests. Your app on Supabase is only as secure as its Row Level Security rules, and those are yours to set. Here's what Supabase covers, what you own, how RLS works in plain English, and a 5-minute check for a Lovable or Bolt app.
Supabase Anon Key vs Service Role Key (Now Publishable vs Secret): Which One Is Safe in Your Frontend?
The anon key (now called the publishable key) is meant to sit in your frontend. The service role key (now the secret key) bypasses every security rule in your database and must never leave your server. Here's the old-name to new-name map, where to find each one, and what to do if the wrong one leaked.
Written by
Justin McKelvey
I spent 12 years running snowboard and mountain-bike shops in Colorado, then taught myself to code. Since then: 50+ products shipped, Head of Product at a national sports platform, CTO at an AI startup. Now I put AI to work in real businesses in Austin, TX and remote, and write down what actually works.
Work with meWant more help? Get a free 20-min repo audit · Grab the real AI stack cost sheet