{"slug": "how-to-verify-ai-generated-code-5-rules-from-a-spacex-engineer", "title": "How to Verify AI-Generated Code: 5 Rules From a SpaceX Engineer", "summary": "Engineers building heavily with coding agents report spending around 70% of their daily token usage on verifying AI-written code rather than generating it, according to a set of five verification rules attributed to a SpaceX engineer. The rules hold that a coding agent's task should count as done only with proof such as a passing test, screenshot or working demo; that agents should exercise what they build as a real user would; and that a second, fresh agent or model should review the code because models skew positive when judging their own work. The piece cites NPM co-founder Laurie Voss's observation that developers using AI coding agents write roughly eight times as much code but ship only about 30% faster, and reports that one team using the approach ships thousands of changes a month with a low rate of rolled-back changes.", "body_md": "# How to Verify AI-Generated Code: 5 Rules From a SpaceX Engineer\n\nFive rules for verifying AI-generated code at scale, drawn from engineers shipping thousands of pull requests a month with coding agents.\n\n## What is AI code verification and why does it matter now?\n\nAI code verification is the set of practices teams use to confirm that code written by an AI agent actually works before it ships, rather than trusting that it looks finished. It matters now because coding agents have made writing code nearly free, but confirming that code is correct still takes real effort. As more engineering teams hand large chunks of implementation to agents like Claude Code, Codex, or Devin, the bottleneck has shifted from “can the AI build this” to “can we trust what it built without reading every line.”\n\n## TL;DR\n\n- **Verification now eats most of the token budget** : engineers building heavily with AI agents report spending around 70% of their daily usage on checking work rather than generating it.\n- **“Done” should require proof** , not a claim. Coding agents should show evidence, like a passing test, a screenshot, or a working demo, before a task counts as finished.\n- **Agents should use what they build the way a real person would** , clicking through an app or running a real example, not just passing type checks or unit tests.\n- **The agent that writes the code shouldn’t be the one grading it** , because models skew positive when judging their own work, so a second, fresh agent or model should review it.\n- **Not every change deserves the same scrutiny.** Irreversible actions like sending emails, deleting data, or issuing payments need a human in the loop; reversible changes can be checked automatically.\n- **Every correction should become a permanent, automated check** instead of a note in a prompt file, so mistakes can’t quietly resurface later.\n- **At scale, this approach lets teams ship thousands of changes a month** while keeping the rate of rolled-back changes low, according to one team’s reported numbers.\n\n### **›** Build a credit limit review app for 800 relationship managers\n\nLive URL today. Role-based access, audit trail and SSO come built in.\n\n## Why did code review become the bottleneck?\n\nFor most of software history, writing code was the slow part and review was quick. Coding agents inverted that. Developers who turn on AI coding agents reportedly write roughly eight times as much code, but ship only about 30% faster, a gap described by NPM co-founder Laurie Voss as the cost of producing plausible code collapsing while the cost of knowing whether to trust that code stays the same.\n\nThat gap shows up hardest in code review. A single large AI-generated change can take a human reviewer the better part of a week to check properly, especially if that human didn’t write the code and has to reconstruct the reasoning behind it. For non-engineers using AI for writing, analysis, or other work, the same problem shows up differently: the same tool produces very different quality depending on how rigorously the person driving it checks the output.\n\nThe practical fix isn’t to slow down generation. It’s to build systems, mostly other AI agents, that do most of the checking so a human doesn’t have to read every line.\n\n## Rule one: how do you make “done” mean “proven”?\n\nThe first rule is that an agent shouldn’t get to call a task finished just because the output looks plausible. It needs to demonstrate that the work actually functions. Anthropic’s own documentation on Claude Code notes that the model tends to stop once a task looks complete, and if there’s nothing concrete to run that confirms success, the human ends up acting as the test suite by default.\n\nIn practice, this means every task given to a coding agent should end with an explicit proof requirement, and that proof has to be defined up front. “All tests pass” isn’t enough on its own. For a web app, proof might mean a screenshot of the working page and confirmation that every button and link was clicked and tested. For a written report, proof might mean every number traces back to its source data. Engineers who build this kind of explicit verification into their prompts report meaningfully better output quality compared to just asking for the task and trusting the result.\n\n## Rule two: why isn’t passing tests enough?\n\nTests and type checks catch a narrow slice of problems. They confirm the code runs without crashing, not that it does what a user actually needed. Anthropic has made this distinction directly: passing automated checks doesn’t prove a change does what was intended. What proves it is checking the way a person would, by actually using the thing.\n\n### Build a claims\n\ntriage app for\n\n4,000 insurance\n\nadjusters\n\nOne prompt. Role-based access, audit trail and SSO come built in.\n\nThis is why some teams have agents literally operate their own output: opening the app, clicking through the feature that changed, and saving that sequence of steps as a reusable check for next time. Some teams go further and maintain a running map of every feature in the app from a user’s perspective, so an agent doesn’t have to guess what a vague instruction refers to. At companies building autonomous coding agents, this has evolved into agents returning video evidence of a fix working, not just a code diff, treating proof as the deliverable rather than the code itself.\n\nThe same principle generalizes beyond code. A slide deck should be opened and screenshotted slide by slide. An automation should be run against one real example from start to finish, with the actual output shown, not assumed.\n\n## Rule three: why shouldn’t the builder grade its own work?\n\nEven when an agent checks its own output, it’s still grading itself, and that’s a known failure mode. Agents reliably skew positive when evaluating their own work. The fix is separating the agent that builds something from the agent that judges it.\n\nThis can be tested directly: having one agent repeatedly build and self-report on a feature across many runs will produce a high self-reported success rate, while a second, independent review pass catches real bugs the first agent missed and never flagged. Tools built for this reflect the same idea, offering a separate review step that runs a fresh instance with no memory of the original reasoning, so it can’t be swayed by the logic that produced the bug in the first place. Running output through a second, different model entirely adds another layer, since different models tend to catch different categories of mistakes. The same logic applies outside code: a report or proposal should get a second, independent pass from a reviewer (human or AI) who never saw the first draft, specifically checking that every claim is backed up.\n\n## Rule four: how do you decide what deserves human attention?\n\nNot every change carries the same risk, and treating all changes identically wastes scrutiny where it isn’t needed and under-scrutinizes where it is. A useful frame is whether a change is a “one-way door” or a “two-way door.” A bad paragraph can be rewritten. A sent email, a deleted file, or an issued payment generally cannot be undone.\n\nThe practical move is to explicitly list the one-way doors in a given system, actions like sending, deleting, paying, or publishing, and route those through mandatory human review or a hard technical block. One real-world example: an agent once sent a discount code to roughly 150,000 people without anyone approving it, the kind of irreversible mistake this rule is meant to prevent. Reversible changes, by contrast, can be left to automated checks, and early-stage prototypes meant only to test an idea can often skip heavy verification entirely. The right level of scrutiny depends on matching the stakes of the action to how much checking it gets.\n\n## Rule five: what should happen every time you correct an agent?\n\nThe last rule is about making corrections durable. When an agent makes a mistake and gets corrected, that correction should become an automated, deterministic check rather than a line added to an instructions file. A written rule in a prompt or config file is something a model can read and still fail to apply consistently. A real check, a small test that runs every time and returns pass or fail, is enforced automatically regardless of whether the model “remembers” the rule.\n\n**Adjuster**✕ Export PHI\n\n**#4471**\n\n**12,480** users online\n\nThis has an important side effect: it compounds. Every corrected mistake becomes a permanent guardrail, so the same class of bug can’t quietly resurface in a future change. Teams practicing this report that, over time, the number of things that need manual review during a code review session shrinks, because more and more of the checking has been automated away by accumulated tests.\n\n## Is this approach actually working at scale?\n\nBy report, teams running this verification-heavy workflow are shipping thousands of pull requests a month, with the rate of changes that had to be rolled back held to roughly half a percent, a figure described as improving even as volume increased. One team reported that app performance metrics improved over the same period that shipping volume scaled up, suggesting the extra verification wasn’t just a brake on speed but also kept quality from degrading.\n\nThe caveat offered by practitioners is blunt: automating a workflow that already produces low-quality output just produces low-quality output faster and at greater token cost. The verification layer isn’t optional overhead bolted onto AI-assisted development. It’s the part that makes scaling AI-assisted development viable at all.\n\n## Frequently Asked Questions\n\n### What percentage of AI coding work should go toward verification?\n\nEngineers building heavily with coding agents have reported that around 70% of their daily token usage goes toward verifying work rather than generating new code, a figure echoed by multiple practitioners independently.\n\n### Do these verification rules only apply to programmers?\n\nNo. The underlying principles, requiring proof of completion, testing output the way a real user would, using a second independent reviewer, and matching scrutiny to risk, apply to any AI-generated output, including written reports, slide decks, and automations.\n\n### What is a “one-way door” in AI-assisted work?\n\nIt’s an action that can’t be easily undone, such as sending an email, deleting a file, publishing content, or issuing a payment. These actions generally warrant mandatory human review or a hard block, while reversible changes can be left to automated checks.\n\n### Why shouldn’t an AI agent review its own code?\n\nAgents tend to rate their own work favorably even when it contains bugs. Having a separate agent, model, or human review the work independently, without seeing the original reasoning, catches problems that self-review misses.\n\n### How do you stop the same AI coding mistake from happening twice?\n\nConvert the correction into an automated, deterministic test rather than just adding a note to a prompt or instructions file. A test enforces the rule every time a check runs; a written instruction can be skipped or forgotten by the model.", "url": "https://wpnews.pro/news/how-to-verify-ai-generated-code-5-rules-from-a-spacex-engineer", "canonical_source": "https://www.mindstudio.ai/blog/ai-coding-verification-rules-2027/", "published_at": "2026-12-06 00:00:00+00:00", "updated_at": "2026-12-06 09:43:41.153892+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "ai-safety"], "entities": ["SpaceX", "Claude Code", "Codex", "Devin", "Anthropic", "Laurie Voss", "NPM"], "also_reported_by": [], "takeaway": "Require a coding agent to prove completion with a runnable artifact — a passing test, screenshot or working demo — and have a second, fresh model review the work, since self-grading models skew positive and verification already consumes about 70% of daily token usage.", "recommendation": {"advice": "Define proof of completion up front for every agent task — a passing test, screenshot or working demo — and route the diff to a fresh reviewer model instead of letting the writing agent grade its own work.", "playbook": "coding-agents", "playbook_url": "https://wpnews.pro/playbooks/coding-agents"}, "alternates": {"html": "https://wpnews.pro/news/how-to-verify-ai-generated-code-5-rules-from-a-spacex-engineer", "markdown": "https://wpnews.pro/news/how-to-verify-ai-generated-code-5-rules-from-a-spacex-engineer.md", "text": "https://wpnews.pro/news/how-to-verify-ai-generated-code-5-rules-from-a-spacex-engineer.txt", "jsonld": "https://wpnews.pro/news/how-to-verify-ai-generated-code-5-rules-from-a-spacex-engineer.jsonld"}}