Skip to Sidebar Skip to Content
Guide 16 of 24 · use it for · checked 5 December 2026

How to check code an AI wrote

AI now solves most real issues in a standard test, but studies of real work are mixed, and some find slower developers and messier code. Whether you code or not, here is how to check what it gives you.
The short answer
  • Strong on tests, mixed at work.AI solves most issues in a standard test, but studies of real work are mixed: some find slowdowns and messier code.
  • Read before you run.Understand every line, check every package it names, and look for anything that deletes or sends.
  • Make tests that can fail.Break the code on purpose. If no test fails, the tests prove nothing.
  • Run it somewhere safe.Try it on a copy, with empty and wrong inputs, before it touches anything real.

How good AI is at code

Chart 2.5.1 · The best SWE-bench Verified score rose from 31% in 2024 to 83.5% in 2026Open the chart page →

What studies of real work found

Benchmarks are clean, and real projects are not. In a 2025 trial, 16 experienced developers took 19% longer on tasks in their own projects when they could use AI tools, though afterwards they estimated AI had cut their time by 20%.

A study of 806 open-source projects that adopted an AI coding editor found lines of code added rose about 29%, while static-analysis warnings rose 30% and code complexity 42%. More code arrived, and in the authors' main estimates it was harder to maintain.

Other studies on our evidence page found tasks done faster or more work finished, so our rating of AI coding assistants finds no good evidence either way so far. The lesson for you: speed you feel isn't speed you measured, and the checking is part of the job.

Read it before you run it

  • Can you explain every line? If not, ask the assistant to explain it, then check the explanation makes sense.
  • Do the packages exist? Check every library it names is real, current and the one you meant, on the package's official page.
  • Any secrets? No passwords or keys in the code, and none pasted into the chat.
  • What does it touch? Look for anything that deletes, overwrites, sends data or spends money.
  • What about bad input? Empty, wrong type, very large, or from someone malicious. Ask how the code handles each.
  • Does it match the request? AI sometimes solves a nearby, easier problem. Compare it with what you asked for.

Make the tests prove something

  1. 1
    Write the cases first.List what should happen, including the awkward cases, before you look at the code.
  2. 2
    Ask for tests, then read them.Tests that only check the easy case, or that copy the code's own logic, prove little.
  3. 3
    Break the code on purpose.Change one line so it's wrong. At least one test should now fail. If none does, the tests need work.
  4. 4
    Run it on a copy.Use test data or a copy of the folder, never the only copy of something that matters.
  5. 5
    Review the change, not just the result.Look at what changed line by line. A passing run can hide a deleted check.

If you don't write code

A spreadsheet formula
How to check it
Try it on rows where you already know the right answer.
A small page or tool
How to check it
Use it with empty, wrong and very long inputs, and see what breaks.
A script that changes files
How to check it
Run it on a copy of the folder first, then compare.
Anything with money or personal data
How to check it
Have someone who codes review it before it's used.

Handing a coding agent a bigger job? The hand-over and stop rules in How to hand a task to an AI agent apply.

Try it

This works even if you don't code: the assistant writes the code and tests, and you check whether the tests can catch a mistake. Any assistant will do.

Any assistant
You
Write a small Python function that checks whether a date written as DD/MM/YYYY is a real date.
Then write tests for it, including an empty input, a wrong format, 29/02/2024 and 29/02/2023.
Then change one line of the function so it has a bug. Show me the changed line and how to run the tests, and tell me which test should now fail and why.
Finally, list anything in the function you're not sure is right.
A good answer

Tick what your answer did.

Then check
  • If you can, run the tests yourself, before and after the bug.
  • If no test fails with the bug, the tests aren't good enough.
  • Ask it to explain any line you don't understand.

Check yourself

Five questions on this guide. Your answers stay on this device.

5 questions. Get 4 right to pass. Nothing you choose leaves your browser, and this is a self-check, not a certification.

1In the 2025 trial, how did AI tools affect experienced developers on their own projects?
2You plant a bug and every test still passes. What does that mean?
3The code uses a library you've never heard of. What do you do?
4You don't code, and AI wrote a script that renames your files. First step?
5What did the study of 806 projects find after they adopted an AI editor?

Teach this guide

A 15-minute session plan for a team meeting or a class. Free to use and adapt under CC BY 4.0.

  1. 0–2 min
    HookAsk the room: “Ask: how would you know if a piece of code was wrong, if you couldn't read code?” Take three answers. Don't correct anyone yet.
  2. 2–5 min
    ExplainGo through the short answer: Strong on tests, mixed at work; Read before you run; Make tests that can fail; Run it somewhere safe.
  3. 5–8 min
    DemoRun the “Try it” task live in any assistant on a shared screen. Read the answer aloud, then talk back once to improve it.
  4. 8–13 min
    PracticeIn pairs, people run the task on their own material, then tick what a good answer did and work through the checks.
  5. 13–15 min
    CheckDo the self-check together. Spend the time on the questions people missed.

Watch for. Learners trust green ticks. Have every pair plant a bug and show a failing test before anyone moves on.

Bring. A shared screen, one AI assistant, and the one-page PDF for each person.

Trainer plan with answers (PDF)

Keep going

All guides →

Words in this guide

Full glossary →

Sources and changes

Sources

Charts quoted: 2.5.1, 10.5.4, 4.3.3.

Show all 2 sources
  1. Becker and others (METR), Measuring the Impact of Early-2025 AI on Experienced Open-Source Developer Productivity, 2025. https://arxiv.org/pdf/2507.09089
  2. He and others, Speed at the Cost of Quality: How Cursor AI Increases Short-Term Velocity and Long-Term Complexity in Open-Source Projects, 2026. https://arxiv.org/pdf/2511.04427

Changes to this guide

  • 5 December 2026First published.
Reuse this guide. The text and the one-page PDF are free to copy, adapt and teach from under CC BY 4.0. Credit "AI Adoption, How to check code an AI wrote, aiadoption.org/how-to-check-code-ai-wrote/, checked 5 December 2026". Facts quoted from companies and studies keep their own terms.
Download the one-page PDF

How this guide was made

  1. Works with any assistant. No company is the only example, and none paid to be here.
  2. Numbers from the source. Every figure links to one of our checked charts, a study or the company's own page.
  3. Exercise checked. We ran the task in assistants from two companies (Anthropic, and Google's Gemini on 5 December 2026) to check that it works, and changed the wording where either one misread it. That is a check of the exercise, not a test of the tools.
  4. Kept current. The date at the top is the last full check. Changes are listed above.
Disclosure: AI Adoption uses AI tools in its research and editorial work, including Claude from Anthropic. Editorial standards · Report an error · All guides
Copied with its source. Want the next number like this in your inbox?Get the evidence