A tablet showing charts and graphs next to a coffee cup, banner image on the How AI writes production code page

HiringsAI blog

How AI writes production code

A plain-English tour of the whole pipeline - training, tokens, context, agentic loops, tests, review and the evidence on productivity - with every factual claim traced to a primary source.

01

The short answer

AI writes production code the same way a careful junior developer does, only faster and with less guilt about throwing work away: it reads the codebase, plans a change, writes the code, runs the tests, reads the failures, and tries again until the checks pass. The part that feels like magic, the model that writes the code, is only one station in that loop. The rest is ordinary engineering: files, shells, test runners, and a human who decides what "done" means and reads the diff before it merges.

The model itself is doing something conceptually simple
It predicts the next token, a few characters at a timeBased on everything in its context window: your request, the files it has read, the test output it has seen, and its own work so far.
What makes the result production-grade rather than demo-grade is almost never the prediction
It is the scaffolding around the predictionIt is the scaffolding around the prediction, the context it was given, the checks it must pass, and the review it cannot skip.
This article walks the whole pipeline in order

The short answer

AI writes production code the same way a careful junior developer does, only faster and with less guilt about throwing work away: it reads the codebase, plans a change, writes the code, runs the tests, reads the failures, and tries again until the checks pass. The part that feels like magic, the model that writes the code, is only one station in that loop. The rest is ordinary engineering: files, shells, test runners, and a human who decides what "done" means and reads the diff before it merges.

The model itself is doing something conceptually simple. It predicts the next token, a few characters at a time, based on everything in its context window: your request, the files it has read, the test output it has seen, and its own work so far. What makes the result production-grade rather than demo-grade is almost never the prediction. It is the scaffolding around the prediction: the context it was given, the checks it must pass, and the review it cannot skip.

This article walks the whole pipeline in order. How the model learned to write code at all. What actually happens between your prompt and the code that comes back. Why context matters more than clever prompting. How the tools evolved from autocomplete to agents that run their own tests. Where the failures hide. And what the best available evidence says about whether any of this makes developers faster, because the honest answer is more interesting than either the hype or the dismissal.

Your request becomes tokensModel predicts code one token at a timeHarness runs the checksFailures feed back into contextHuman reviews the diff and merges

In this article - 24 sections
02

What production code actually means

Before asking whether AI can write production code, it is worth being precise about what production code is, because most arguments about AI coding are really arguments between two different definitions.

Demo code has one job, work once, in front of an audienceDemo code has one job, work once, in front of an audience, On the happy path.
It can assume the input is well-formed, the network is upThe database is migrated, and nobody malicious is watching.
A stunning amount of AI-generated code you see online is demo code, and it is genuinely impressive as demo code
It has to handle the malformed input, the timed-out requestThe duplicate webhook, the timezone on the last day of the month.
It has to fail in ways that wake up the right person with a useful error

What production code actually means

Before asking whether AI can write production code, it is worth being precise about what production code is, because most arguments about AI coding are really arguments between two different definitions.

Demo code has one job: work once, in front of an audience, on the happy path. It can assume the input is well-formed, the network is up, the database is migrated, and nobody malicious is watching. A stunning amount of AI-generated code you see online is demo code, and it is genuinely impressive as demo code. Production code has a longer job description. It has to handle the malformed input, the timed-out request, the duplicate webhook, the timezone on the last day of the month. It has to fail in ways that wake up the right person with a useful error. It has to be readable six months later by someone who was not in the room. It has to respect the security rules, the license rules, the style guide, and the migration path. And it has to keep doing all of that while other people change everything around it.

This is why "the AI wrote a working app in ten minutes" and "the AI cannot be trusted with production" are both true stories. The first story is about generation, and generation is largely solved for well-scoped tasks. The second story is about everything after generation: verification, integration, review, and maintenance. When this article says production code, it means code that survives the second story. The interesting question is not whether a model can produce a plausible function. It plainly can. The question is what machinery turns that plausible function into code you would page someone about at 3 AM, and how much of that machinery the AI can operate itself.

Keep that bar in mind through every section that follows, because it sorts the real capability claims from the demo reels.

DEMO CODEPRODUCTION CODEWorks once on the happy pathHandles the malformed and maliciousAssumes good input and uptimeFails loudly to the right personRead by no one againRead and changed for years

03

How a code model learns to write code

A code model is a language model that has read an enormous amount of code. During training, the model is shown fragments of text and source code and asked, billions of times, to predict what comes next. When its guess is wrong, its internal weights are adjusted slightly toward a better guess. Repeat that across much of the public code on the internet, a large amount of natural language, and whatever licensed and synthetic data the lab has assembled, and the resulting model has absorbed a statistical model of how code tends to look: syntax, idioms, library usage, naming habits, common algorithms, and the shapes of typical fixes.

Two consequences fall out of that recipeTwo consequences fall out of that recipe, and understanding them explains most of the model's behavior in practice.
First, the model is very good at the common case
It has seen a million login forms, pagination loopsIt has seen a million login forms, pagination loops, And React components, so it reproduces those patterns fluently.
Second, the model does not know your codebase
It knows what code in general looks likeIt knows what code in general looks like, not what your code does, why it does it, or which of your conventions are load-bearing.

How a code model learns to write code

A code model is a language model that has read an enormous amount of code. During training, the model is shown fragments of text and source code and asked, billions of times, to predict what comes next. When its guess is wrong, its internal weights are adjusted slightly toward a better guess. Repeat that across much of the public code on the internet, a large amount of natural language, and whatever licensed and synthetic data the lab has assembled, and the resulting model has absorbed a statistical model of how code tends to look: syntax, idioms, library usage, naming habits, common algorithms, and the shapes of typical fixes.

Two consequences fall out of that recipe, and understanding them explains most of the model's behavior in practice. First, the model is very good at the common case. It has seen a million login forms, pagination loops, and React components, so it reproduces those patterns fluently. Second, the model does not know your codebase. It knows what code in general looks like, not what your code does, why it does it, or which of your conventions are load-bearing. Everything specific about your project has to be supplied at run time, through context, or the model will fill the gap with the most statistically average answer, which is how you get code that looks right and calls functions that do not exist.

Training also explains the knowledge cutoff. A library version released after training ended is invisible to the model unless you paste its docs into the context. And it explains why models are better in Python and TypeScript than in a niche internal DSL: the amount of training data follows public popularity. None of this makes the model useless for niche work. It means the burden shifts from what the model memorized to what you put in front of it, which is the subject of the section on context.

After base training, labs run further stages: instruction tuning so the model follows directions, preference tuning so its answers match what reviewers rate as good, and increasingly, training on tool-use traces so the model learns to operate inside an agentic loop rather than just chat. When a modern coding model pauses to run a test and then reads the output, that behavior was trained, not improvised.

Public and licensed codeNext-token prediction, billions of timesA model of how code tends to look

04

Does the language and framework matter?

It does, more than the marketing pages admit, and the reason is training data volume rather than any property of the language itself.

The model's fluency in a language tracks how much public code exists in it
Python and TypeScript sit at the top of that distributionPython and TypeScript sit at the top of that distribution, So the model writes them idiomatically, knows their ecosystems deeply, and recovers well when interrupted mid-task.
Mainstream languages like Go, JavaRust and C# are nearly as well served.
As you move down the popularity curveAs you move down the popularity curve, into older enterprise stacks, niche functional languages, or an internal DSL your company invented, fluency degrades in a specific way: the model stops knowing the idioms and starts transliterating patterns from languages it knows better, which produces code that compiles and feels wrong to anyone fluent in the stack.
The framework matters as much as the language

Does the language and framework matter?

It does, more than the marketing pages admit, and the reason is training data volume rather than any property of the language itself.

The model's fluency in a language tracks how much public code exists in it. Python and TypeScript sit at the top of that distribution, so the model writes them idiomatically, knows their ecosystems deeply, and recovers well when interrupted mid-task. Mainstream languages like Go, Java, Rust and C# are nearly as well served. As you move down the popularity curve, into older enterprise stacks, niche functional languages, or an internal DSL your company invented, fluency degrades in a specific way: the model stops knowing the idioms and starts transliterating patterns from languages it knows better, which produces code that compiles and feels wrong to anyone fluent in the stack.

The framework matters as much as the language. A rapidly evolving framework punishes the knowledge cutoff: the model cheerfully mixes two major versions' APIs in one file, because both were well represented in training and it has no way to know which one your project pinned. The countermeasure is the same one from the context section. Put the version and the conventions in the context file. Paste the relevant doc page when the API is new or rare. And weight your trust by the feedback loop: a compiled, typed language catches whole classes of model error at build time, which makes the model effectively more reliable there than in a dynamic language where the same mistake ships silently until a user finds it. If you are choosing a stack partly on AI ergonomics, choose boring, popular, typed, and well-tested. That is not a coincidence: boring, popular, typed, and well-tested is what the training data looks like at its best.

05

What happens when you hit enter

You type "add pagination to the orders endpoint" and press enter. Here is the journey that request takes, minus the marketing.

Your text is first broken into tokensYour text is first broken into tokens, small chunks of a few characters each.
"Pagination" might be two or three tokens"Pagination" might be two or three tokens, a common keyword like "function" is one.
The model does not read words, it reads token sequencesThe model does not read words, it reads token sequences, And everything it will ever say is produced one token at a time.
Each token it emitsEach token it emits is chosen by computing a probability distribution over every token it knows and sampling from that distribution, with the distribution shaped by everything already in the context: your request, any files the system has included, the conversation so far, and the tokens the model has already produced for this answer.
There is no database of answers being looked up in that process

What happens when you hit enter

You type "add pagination to the orders endpoint" and press enter. Here is the journey that request takes, minus the marketing.

Your text is first broken into tokens, small chunks of a few characters each. "Pagination" might be two or three tokens; a common keyword like "function" is one. The model does not read words, it reads token sequences, and everything it will ever say is produced one token at a time. Each token it emits is chosen by computing a probability distribution over every token it knows and sampling from that distribution, with the distribution shaped by everything already in the context: your request, any files the system has included, the conversation so far, and the tokens the model has already produced for this answer.

There is no database of answers being looked up in that process. The model is not retrieving the pagination code it saw during training and pasting it. It is generating fresh text that is statistically consistent with millions of pagination implementations, which is a subtle distinction with practical consequences. It means the output can be perfectly adapted to your naming conventions and your surrounding code, because those are part of the context shaping every prediction. It also means the output can be confidently, fluently wrong in a way no pasted snippet would be: a hallucinated method name reads exactly as smoothly as a real one, because smoothness is the one thing the model is actually optimizing.

One more mechanical fact matters for how you work with these systems: generation is a forward-only process. Once a token is emitted it becomes part of the context, and the model builds on it. An early wrong assumption does not get reconsidered unless something in the loop surfaces the mistake. This is why the agentic tools that run the code and feed errors back into the context outperform one-shot generation so decisively: they give the forward-only process the corrections it cannot give itself.

Your instructions and rulesFiles the model chose to readTool results and its own edits

06

Context is the real input

Ask experienced users of coding assistants what separates a useless session from a productive one and you will rarely hear "a better prompt." You will hear some version of: it had the right files, the right rules, and the right feedback. The model is fixed; the context is the part you control.

The context window is the model's entire working memory for a session
Everything it knows aboutEverything it knows about your task at any moment is whatever is currently inside that window: your instructions, the project conventions file, the files it chose to read, the terminal output from its last command, its own previous edits, and the conversation history.
Windows have grown large, but they are finiteWindows have grown large, but they are finite, And attention across a huge window is not uniform.
Material in the middleMaterial in the middle of a very long context is used less reliably than material at the start or end, which is why stuffing an entire repository into the window is usually worse than giving the model a way to read the specific files it needs.
A good project-instructions file works becauseA good project-instructions file works because it puts your conventions at the front of every session, not because of any phrasing magic.

Context is the real input

Ask experienced users of coding assistants what separates a useless session from a productive one and you will rarely hear "a better prompt." You will hear some version of: it had the right files, the right rules, and the right feedback. The model is fixed; the context is the part you control.

The context window is the model's entire working memory for a session. Everything it knows about your task at any moment is whatever is currently inside that window: your instructions, the project conventions file, the files it chose to read, the terminal output from its last command, its own previous edits, and the conversation history. Windows have grown large, but they are finite, and attention across a huge window is not uniform. Material in the middle of a very long context is used less reliably than material at the start or end, which is why stuffing an entire repository into the window is usually worse than giving the model a way to read the specific files it needs.

This reframes a lot of folk wisdom. A good project-instructions file works because it puts your conventions at the front of every session, not because of any phrasing magic. Letting the model search the codebase beats pasting the codebase, because relevance beats volume. And compaction, the automatic summarization long sessions use to survive finite windows, is a real risk point: a constraint that gets summarized away is a constraint the model will silently violate three steps later. Anthropic's own guidance for its coding tool makes a version of this point by separating the two kinds of instructions you can give. Non-deterministic instructions, like prompts and memory files, are read by the model and followed nearly every time, but "nearly" is the operative word. Deterministic instructions, like hooks, deny rules, and required checks, are enforced by the harness no matter what the model decides. Anything that must never happen belongs in the second category, because no context, however carefully placed, is a guarantee.

The practical summary: spend your effort curating what the model sees and what checks it must pass, not on finding the perfect wording. Wording is a suggestion. Context is the input. Checks are the only part that cannot be talked around.

07

Three generations of AI coding tools

AI coding tooling has come in three distinct generations, and confusing them is the source of most bad expectations.

Tools like the original the AI assistant watched your cursor and suggested the next few lines
The unit of work was the line, the human wrote the structureThe unit of work was the line, the human wrote the structure, And the value was typing speed.
This generation taught an entire industry one habit that still matters: accept quickly, verify always
Because it appeared as a suggestion typed into your own fileThe default habit was to read it before accepting it.
You described a function, pasted an errorYou described a function, pasted an error, Or asked for an explanation, and the model answered in a side panel.

Three generations of AI coding tools

AI coding tooling has come in three distinct generations, and confusing them is the source of most bad expectations.

The first generation was autocomplete. Tools like the original the AI assistant watched your cursor and suggested the next few lines. The unit of work was the line, the human wrote the structure, and the value was typing speed. This generation taught an entire industry one habit that still matters: accept quickly, verify always. Because it appeared as a suggestion typed into your own file, the default habit was to read it before accepting it.

The second generation was chat. You described a function, pasted an error, or asked for an explanation, and the model answered in a side panel. The unit of work became the snippet or the file. Chat moved the model from finishing your thoughts to having thoughts of its own, but the loop was still manual: you carried context back and forth, you ran the tests, you read the errors and pasted them back. In that generation the model had no direct access to your machine; every action went through your copy and paste.

The third generation, the current one, is the agent. The model is placed in a loop with tools: it can search and read your codebase, edit files, run commands, execute the test suite, and read what comes back. The unit of work is now the task. You say "make the export respect the date filter" and the system finds the export code, changes it, runs the relevant tests, and reports what it did. The human's job shifts from carrying context to setting the task, supplying the conventions, and reviewing the result. Each generation widened what the model could see and what it could touch, and each widened the failure blast radius by exactly the same amount, which is why the guardrail sections matter more with every generation.

Autocomplete: the lineChat: the snippetAgent: the task

08

Inside the agentic coding loop

Open the hood of a modern coding agent mid-task and you will not find a model continuously streaming code. You will find a loop, and the loop is the product.

It starts by orientingIt starts by orienting, searching for the files that matter and reading them, the way a new hire would.
Then it plans, sometimes explicitly in a running noteSometimes implicitly in its responses.
Then it acts, it emits a structured tool callThe harness executes that call in the real world, and the result, whether file contents, a test failure, or a command exit code, is appended to the context as plain text.
Edit, run tests read failure, edit again
The loop repeats until the model judges the goal complete or hits a limit on steps, time, or budget

Inside the agentic coding loop

Open the hood of a modern coding agent mid-task and you will not find a model continuously streaming code. You will find a loop, and the loop is the product.

A typical pass looks like this. The model is given your goal plus a set of tools described in its system prompt: read file, search code, edit file, run command. It starts by orienting: searching for the files that matter and reading them, the way a new hire would. Then it plans, sometimes explicitly in a running note, sometimes implicitly in its responses. Then it acts: it emits a structured tool call, the harness executes that call in the real world, and the result, whether file contents, a test failure, or a command exit code, is appended to the context as plain text. The model reads that result and decides the next step. Edit, run tests, read failure, edit again. The loop repeats until the model judges the goal complete or hits a limit on steps, time, or budget.

Two design decisions in that loop do most of the work. The first is that tool results come back as text the model must read, not as state it can assume. A test that failed is only fixed because the failure text entered the context and steered the next prediction. The second is that the harness, not the model, executes everything. The model proposes; the harness disposes. That separation is what makes the system inspectable and interruptible: every action is a logged, bounded tool call, not a free-form instruction stream.

The loop is also where the cost lives. A single user request can mean dozens of model calls, each carrying a large context, plus real compute for the commands themselves. And the loop is where the compounding-error risk lives: three good steps built on one wrong orientation step produce a confidently wrong conclusion. Which is why the next two sections, tools and tests, are really one subject: the loop is only as good as the feedback it can obtain.

TASKOrient: search and read the codePlan the changeEdit and run the checksRead results and repeat

09

The tools: files, shell, tests, browser

A coding agent is only as capable as the tools the harness hands it. The standard toolkit is small and worth knowing by name.

Reading is cheap and safeReading is cheap and safe, writing is where review becomes essential.
Search tools, grep and semantic search over the codebaseAre how the model orients without being spoon-fed the right files; the quality of the search tool often matters more than an increment of model intelligence.
This is why permission systems around shell commands are the sharpest guardrail in any of these products
Finally, newer agents get a browserFinally, newer agents get a browser, mostly for reading documentation and checking rendered output, and a way to call external APIs.
Notice what is not on the listNotice what is not on the list, there is no "understand the codebase" tool.

The tools: files, shell, tests, browser

A coding agent is only as capable as the tools the harness hands it. The standard toolkit is small and worth knowing by name.

File tools let the model read, write, and patch. Reading is cheap and safe; writing is where review becomes essential. Good harnesses make edits as structured patches rather than full-file rewrites, both because patches fail loudly when the file has drifted and because a patch is exactly what a human reviewer wants to see. Search tools, grep and semantic search over the codebase, are how the model orients without being spoon-fed the right files; the quality of the search tool often matters more than an increment of model intelligence. The shell is the most powerful and most dangerous tool: running the test suite, the build, the linter, and the type checker is how the agent obtains ground truth, and the same shell can delete a directory. This is why permission systems around shell commands are the sharpest guardrail in any of these products. Finally, newer agents get a browser, mostly for reading documentation and checking rendered output, and a way to call external APIs.

Notice what is not on the list: there is no "understand the codebase" tool. Understanding is an emergent property of reading plus search plus running the code. When an agent looks lost, the fix is usually a better tool or better feedback, not a longer prompt. When a harness restricts a tool, like blocking network access or limiting the shell to an allowlist, that is not the product being timid. That is the production bar from earlier being enforced mechanically, because an agent that can run any command can also exfiltrate any secret the environment contains.

Read and patch filesSearch the codebaseRun the shell: tests, builds, lintersBrowse docs and rendered output

10

Tests are the contract that makes it shippable

If there is one practice that separates teams getting real production value from AI coding from teams drowning in plausible-looking breakage, it is this: they give the model a check to run, and they treat that check as the definition of done.

The model cannot know whether its code works
It predicts plausible textIt predicts plausible text, and plausible is not the same as correct.
The only way the loop finds out is feedbackThe only way the loop finds out is feedback, and the strongest feedback available in software is an executable check: a test suite, a type checker, a linter, a build.
When the harnessWhen the harness, When the harness runs the tests after every edit and feeds the failures back into the context, the model's weakness, confident wrongness, is caught by the one thing that does not care how confident it sounds.
Anthropic's guidance for its own coding toolAnthropic's guidance for its own coding tool is blunt about the failure this prevents: an agent that says it is done when it is not is usually an agent that had no way to check its own work.

Tests are the contract that makes it shippable

If there is one practice that separates teams getting real production value from AI coding from teams drowning in plausible-looking breakage, it is this: they give the model a check to run, and they treat that check as the definition of done.

The reason is structural. The model cannot know whether its code works. It predicts plausible text, and plausible is not the same as correct. The only way the loop finds out is feedback, and the strongest feedback available in software is an executable check: a test suite, a type checker, a linter, a build. When the harness runs the tests after every edit and feeds the failures back into the context, the model's weakness, confident wrongness, is caught by the one thing that does not care how confident it sounds. Anthropic's guidance for its own coding tool is blunt about the failure this prevents: an agent that says it is done when it is not is usually an agent that had no way to check its own work.

This inverts a common intuition. People assume AI coding helps most on legacy codebases with no tests, because that is where writing code is slowest. In practice it helps least there, because there is no contract to generate against, and the model will cheerfully report success on code that breaks three callers away. On a well-tested codebase the model is dramatically more useful: the tests tell it exactly what to preserve, and every regression is visible within seconds of the edit that caused it. The practical advice follows directly. Before you hand a task to an agent, make sure the behavior you want is pinned by a test, even a crude one. A failing test you write first is worth a page of prose instructions, because the test cannot be talked around and the model can iterate against it until it passes.

NO CHECKSEXECUTABLE CONTRACTModel reports done on faithTests and types give instant verdictsWrongness ships silentlyFailures re-enter the loopReview carries everythingThe model iterates to green

11

A worked example: one ticket from report to merge

Abstract advice survives contact with nothing, so here is one concrete task run the way this article recommends, compressed but real in shape.

The ticket: the CSV export on the billing page ignores the date-range filter
A human writes the failing test first, ten linesSeed two invoices in January and one in March, call the export with the January range, assert the March invoice is absent.
The agent gets a short task, the export endpoint pathThe failing test file, the convention note that this repo uses parameterized queries, and the instruction to make the test pass without touching the query builder's public API.
The agent searches for the export handlerThe agent searches for the export handler, reads it and the repository layer, and finds the bug: the handler parses the date parameters but never passes them to the query.
It edits two functions, runs the test fileIt edits two functions, runs the test file, And the new test passes.

A worked example: one ticket from report to merge

Abstract advice survives contact with nothing, so here is one concrete task run the way this article recommends, compressed but real in shape.

The ticket: the CSV export on the billing page ignores the date-range filter. A human writes the failing test first, ten lines: seed two invoices in January and one in March, call the export with the January range, assert the March invoice is absent. That test is the contract. The agent gets a short task: the export endpoint path, the failing test file, the convention note that this repo uses parameterized queries, and the instruction to make the test pass without touching the query builder's public API.

The loop runs. The agent searches for the export handler, reads it and the repository layer, and finds the bug: the handler parses the date parameters but never passes them to the query. It edits two functions, runs the test file, and the new test passes. Then the valuable part: it runs the full module's suite and discovers its change broke an older test that asserted unfiltered exports when no dates are supplied, because its first version defaulted missing dates to "everything this month" instead of "no filtering." It corrects the default, reruns, and everything is green. Total machine time, a few minutes. Total tokens, more than you would guess. The human reviewer then does the part that is actually their job: reads a forty-line diff against the ticket, checks the new default matches what support promised customers, confirms the test asserts the behavior the business wanted rather than the behavior the code happened to have, and merges.

Notice where the value came from. Not from the model being brilliant; the fix was ordinary. It came from the test existing before the work started, the conventions being written down, the suite catching the regression the model introduced, and the reviewer checking meaning rather than syntax. Remove any one of those four and the same task becomes the kind of story people tell when they say AI code cannot be trusted.

12

Where AI-written code fails

AI-written code fails in characteristic ways, and knowing the taxonomy turns "I do not trust it" into a checklist you can actually review against.

The most famous failure is the hallucinated APIThe model calls a method that sounds right and does not exist, or uses a library version from its training data that your project does not have.
It reads fluently because fluency is what the model optimizes
The subtler failure is the plausible-but-wrong logicAn off-by-one in pagination, a comparison that treats midnight in the wrong timezone, a retry loop without a cap.
This code passes a casual read and often passes the happy path
Only adversarial tests or a careful reviewer find it

Where AI-written code fails

AI-written code fails in characteristic ways, and knowing the taxonomy turns "I do not trust it" into a checklist you can actually review against.

The most famous failure is the hallucinated API: the model calls a method that sounds right and does not exist, or uses a library version from its training data that your project does not have. It reads fluently because fluency is what the model optimizes. Hallucinated APIs are the easiest failure to catch mechanically, because the compiler, the type checker, or the first test run kills them; they are dangerous mainly in languages and workflows with no fast feedback. The subtler failure is the plausible-but-wrong logic: an off-by-one in pagination, a comparison that treats midnight in the wrong timezone, a retry loop without a cap. This code passes a casual read and often passes the happy path. Only adversarial tests or a careful reviewer find it. A third class is the misunderstood requirement: the model builds something different from what you had in mind, usually because a constraint it could not see, a deploy step, a forbidden file, a naming rule, lived only in someone's head. Anthropic's best-practices documentation names this exact pattern as the first thing to fix when sessions go wrong, and its fix is context and checks, not sterner prompts.

Then there are the failures of scale. Context rot: in a long session, early constraints get compacted away and the model quietly violates them. Compounding orientation errors: a wrong assumption in step one, built on for ten steps, yields a large, coherent, wrong change that is expensive to unwind. And scope creep: the model helpfully refactors adjacent code nobody asked it to touch, inflating the review surface. Finally there is the security class, serious enough to get its own section later: injection-prone string concatenation, secrets written into code, and dependencies invented by name that a squatter could register.

Two habits make this taxonomy actionable. First, when reviewing generated code, read it against the failure classes rather than top to bottom: check every external call exists, check every boundary condition the happy path skips, check every assumption the model could not have verified from the context it had. Second, keep a short list in the project conventions of the mistakes the model has already made in your codebase. Models repeat the errors their context does not correct, and a written "in this repo, never" list, backed by deterministic rules where it matters, is how last month's incident becomes this month's non-event.

None of these are arguments against using the tools. They are arguments for budgeting verification in proportion to how expensive a wrong line would be, which was always the rule for code, whoever or whatever wrote it.

Hallucinated API callsPlausible but wrong logicMisread requirements from missing contextCompounding orientation errorsScope creep into unrequested edits

13

The review problem: reading code you did not write

Every line of production code gets read by a human before it merges, at least in every team you would want to work with. AI changes the economics of that sentence in an uncomfortable direction: generation got cheap, so review became the bottleneck.

A five-hundred-line generated diffA five-hundred-line generated diff can represent ten minutes of machine time and two hours of careful human review, if the review is honest.
Teams that skip this step learn why it exists
The failure is rarely a dramatic incidentThe failure is rarely a dramatic incident, it is a slow accumulation of code nobody on the team actually understands, which surfaces later as fear of touching anything.
The codebase becomes somethingThe codebase becomes something the team maintains by asking the AI, which works until the day the AI confidently explains code incorrectly to the person who needed the truth.
Healthy teams adapt the review process rather than abandoning it

The review problem: reading code you did not write

Every line of production code gets read by a human before it merges, at least in every team you would want to work with. AI changes the economics of that sentence in an uncomfortable direction: generation got cheap, so review became the bottleneck.

Reading code is slower than writing it, and reading code you did not write and did not watch being written is the slowest kind. A five-hundred-line generated diff can represent ten minutes of machine time and two hours of careful human review, if the review is honest. Teams that skip this step learn why it exists. The failure is rarely a dramatic incident; it is a slow accumulation of code nobody on the team actually understands, which surfaces later as fear of touching anything. The codebase becomes something the team maintains by asking the AI, which works until the day the AI confidently explains code incorrectly to the person who needed the truth.

Healthy teams adapt the review process rather than abandoning it. They keep generated changes small, because a hundred-line diff gets read and a thousand-line diff gets skimmed. They require the agent to state what it did and how it verified, so the reviewer starts from a claim that can be checked rather than a wall of code. They lean on the mechanical checks harder, because a green CI run is evidence, even if it is not proof. And they match review depth to irreversibility: a generated migration touching customer data gets the same scrutiny as a junior's first migration, while a generated internal script gets a lighter pass. The rule underneath all of this did not change with AI: the person who merges the code owns the code. If your name goes on the merge, the model's confidence is not a defense, and "the AI wrote it" has never once fixed a production incident.

Minutes of machine generationA diff sized for a human to readMechanical checks as evidenceHuman judgment on intent and riskMerge: the reviewer owns the code

14

What the productivity studies actually found

Does any of this actually make developers faster? The evidence is genuinely mixed, and the two best-known sources measure very different things, so it is worth being precise about what each one says.

GitHub's research programGitHub's research program on the AI assistant combined telemetry with a survey of more than two thousand developers and found benefits that were mostly not about raw speed.
Between sixty and seventy-fiveBetween sixty and seventy-five percent of users reported feeling more fulfilled in their job and less frustrated while coding.
Seventy-three percent said the tool helped them stay in flowSeventy-three percent said the tool helped them stay in flow, And eighty-seven percent said it preserved their mental effort during repetitive tasks.
That is real value, but notice what it measuresHow the work feels, not how long it takes.
METR, an independent research organizationMETR, an independent research organization, ran a randomized controlled trial with sixteen experienced open-source developers working on real issues from large repositories they knew well, two hundred forty-six tasks averaging about two hours each.

What the productivity studies actually found

Does any of this actually make developers faster? The evidence is genuinely mixed, and the two best-known sources measure very different things, so it is worth being precise about what each one says.

GitHub's research program on the AI assistant combined telemetry with a survey of more than two thousand developers and found benefits that were mostly not about raw speed. Between sixty and seventy-five percent of users reported feeling more fulfilled in their job and less frustrated while coding. Seventy-three percent said the tool helped them stay in flow, and eighty-seven percent said it preserved their mental effort during repetitive tasks. That is real value, but notice what it measures: how the work feels, not how long it takes. Then there is the experiment that punctured a lot of confident intuition. METR, an independent research organization, ran a randomized controlled trial with sixteen experienced open-source developers working on real issues from large repositories they knew well, two hundred forty-six tasks averaging about two hours each. When the developers were allowed to use AI tools, they took nineteen percent longer to finish. The striking part is the perception gap: those same developers expected AI to speed them up by twenty-four percent, and even after experiencing the slowdown, they still believed it had sped them up by twenty percent. METR is careful about scope: the study covers experienced developers on mature codebases they knew deeply, which is exactly the setting where a knowledgeable human's context advantage over the model is largest, METR notes on that page that it has released a continuation of the study with results current as of early 2026, and states its belief that these historical results no longer reflect the current impact of AI models on open-source developer productivity. It does not show AI never helps. It shows that "I feel faster" is not evidence that you are.

The honest synthesis goes like this. AI assistance clearly reduces the felt effort of coding, especially the repetitive parts, and feeling better at work is not nothing. On well-specified tasks with fast feedback loops, generation plus automated checking is genuinely quick. On complex tasks in large familiar codebases, the time cost of orienting the model, correcting its assumptions, and reviewing its output can eat the gain or worse. The tools amplify a working process; they do not replace the need for one.

DEVELOPERS EXPECTEDMEASURED (METR RCT)24% faster with AI19% slower on real issuesFelt 20% faster afterwardIn repositories they knew well

15

What benchmarks say, and what they cannot say

If the field studies are sobering, the benchmark charts are triumphant, and the distance between those two is itself one of the most instructive things to understand.

The benchmark that mattersThe benchmark that matters most for production-style coding is SWE-bench, which is built from real GitHub issues drawn from real open-source repositories: the model receives the issue text and the repository, and must produce a patch that makes the project's own hidden tests pass.
The human-filtered Verified subsetThe human-filtered Verified subset, five hundred tasks that people checked were solvable and well-specified, is the standard scoreboard, and frontier systems have gone from solving a small single-digit share of it at launch to solving the large majority within a few years.
That is real progress on real engineering tasksThat is real progress on real engineering tasks, And dismissing it would be as sloppy as hyping it.
The benchmark task arrives perfectly packaged, the issue is realThe repository is clean, and success is defined by tests someone else already wrote.
The requirement is ambiguousThe requirement is ambiguous, the relevant code is scattered across services, the tests do not exist, and "done" includes style, documentation, deployment, and a teammate's approval.

What benchmarks say, and what they cannot say

If the field studies are sobering, the benchmark charts are triumphant, and the distance between those two is itself one of the most instructive things to understand.

The benchmark that matters most for production-style coding is SWE-bench, which is built from real GitHub issues drawn from real open-source repositories: the model receives the issue text and the repository, and must produce a patch that makes the project's own hidden tests pass. The human-filtered Verified subset, five hundred tasks that people checked were solvable and well-specified, is the standard scoreboard, and frontier systems have gone from solving a small single-digit share of it at launch to solving the large majority within a few years. That is real progress on real engineering tasks, and dismissing it would be as sloppy as hyping it.

But a benchmark score is not a productivity promise, for reasons the benchmark authors and METR both spell out. The benchmark task arrives perfectly packaged: the issue is real, the repository is clean, and success is defined by tests someone else already wrote. Production work rarely arrives packaged. The requirement is ambiguous, the relevant code is scattered across services, the tests do not exist, and "done" includes style, documentation, deployment, and a teammate's approval. Benchmark agents also burn compute freely, sometimes sampling enormous numbers of tokens per task in a way no team's budget would tolerate interactively. And the scoreboard says nothing about the distribution of failures: a system that solves eighty percent of tasks can still fail the twentieth in a way that takes a human longer to unwind than doing the task from scratch. The right way to read a benchmark is as a capability floor with generous conditions: what the model can do when the task is clear, the checks exist, and cost is no object. Your codebase supplies or denies those conditions, which is why your tests and your task framing decide how much of the benchmark number ever shows up in your week.

BENCHMARK CONDITIONSPRODUCTION CONDITIONSTask arrives packaged and clearAmbiguous requirementsTests already existScattered code, missing testsCompute is no objectBudgets and review queues

16

The repository you hand the model

There is a variable that predicts AI coding success better than model choice, and it is entirely within your control: the health of the repository you hand over.

Models thrive in codebases with fast, reliable test suitesModels thrive in codebases with fast, reliable test suites, Because every edit gets an immediate verdict.
They thrive with static typesThey thrive with static types, because the type checker is a tireless reviewer that works at machine speed.
They thrive in small modules with clear namesThey thrive in small modules with clear names, because orientation costs context and the model's context is the scarcest resource in the system.
They thrive where conventionsThey thrive where conventions are written down in a place the tool actually reads, and where the build is one command that either passes or says why not.
Every one of those properties was good practice before AI

The repository you hand the model

There is a variable that predicts AI coding success better than model choice, and it is entirely within your control: the health of the repository you hand over.

Models thrive in codebases with fast, reliable test suites, because every edit gets an immediate verdict. They thrive with static types, because the type checker is a tireless reviewer that works at machine speed. They thrive in small modules with clear names, because orientation costs context and the model's context is the scarcest resource in the system. They thrive where conventions are written down in a place the tool actually reads, and where the build is one command that either passes or says why not. Every one of those properties was good practice before AI. What changed is the return on investment: a human teammate can compensate for a messy repo with patience and hallway questions; a model compensates with confident guessing, and confident guessing is the failure mode this whole article is organized against.

This gives platform and tooling teams a useful reframe. The best "AI enablement" project is often not an AI project at all. It is deleting the flaky test that taught everyone to ignore red builds, because the agent will trust that build literally. It is writing down the deploy rule that lived in one senior engineer's head, because the model cannot ask them. It is splitting the four-thousand-line file nobody wanted to touch, because orientation is now a per-task cost paid in the model's attention. The codebase is now being read by a literal-minded, infinitely patient, amnesiac reader on every task. Repositories that are kind to that reader get the benchmark numbers. The rest get the complaints.

17

Deterministic rules versus model judgment

Buried in Anthropic's documentation for its coding tool is a distinction that deserves to be in every team's vocabulary, because it explains which safeguards actually safeguard.

Every instruction you give an AI coding system is one of two kinds
A non-deterministic instruction is read by the modelYour prompt, the project memory file, a style note.
No matter how firmly a sentence is wordedNo matter how firmly a sentence is worded, whether the model follows it on any given turn remains the model's call.
A deterministic instructionA deterministic instruction is executed by the harness around the model: a deny rule that blocks a file path, a hook that must run after every edit, a test gate that decides whether the task counts as done, a branch protection rule that requires human approval to merge.
The harness applies these every single timeThe harness applies these every single time, no matter what the model decided, because the model never gets a vote.

Deterministic rules versus model judgment

Buried in Anthropic's documentation for its coding tool is a distinction that deserves to be in every team's vocabulary, because it explains which safeguards actually safeguard.

Every instruction you give an AI coding system is one of two kinds. A non-deterministic instruction is read by the model: your prompt, the project memory file, a style note. The model nearly always follows it, and current models are good at judging when a guideline fits and when an exception applies, but nearly always is the operative phrase. No matter how firmly a sentence is worded, whether the model follows it on any given turn remains the model's call. A deterministic instruction is executed by the harness around the model: a deny rule that blocks a file path, a hook that must run after every edit, a test gate that decides whether the task counts as done, a branch protection rule that requires human approval to merge. The harness applies these every single time, no matter what the model decided, because the model never gets a vote.

The practical rule writes itself: anything that would be nice belongs in prose for the model; anything that must always or never happen belongs in the harness. "Please do not edit the generated client" is a hope. A deny rule on the generated directory is a fact. "Make sure the tests pass" is a hope. A stop condition that runs the test suite and reports failure as unfinished is a fact. Teams that get burned by AI tools usually discover, in the postmortem, that a rule they thought they had was only ever a sentence the model was reading. The model is the judgment layer and judgment is why you want it; the harness is the guarantee layer and guarantees are why you can trust the judgment with production. A well-run setup has both, and never confuses one for the other.

NON-DETERMINISTICDETERMINISTICPrompts and memory filesDeny rules, hooks, required checksThe model reads and nearly always followsThe harness enforces every timeNearly always is the operative phraseThe model gets no vote

18

Security, licenses and provenance

Three questions come up in every serious adoption conversation, and hand-waving them is how projects get surprised later.

Models learned from public codeModels learned from public code, and public code is full of the classics: SQL built by string concatenation, unvalidated redirects, commented-out auth checks.
A model reproduces the distribution it trained onA model reproduces the distribution it trained on, Which means insecure patterns appear at roughly the rate they appear in public code unless your context and checks push back.
Models are trained partly on copyleft codeModels are trained partly on copyleft code, and while vendors have added filters and some offer indemnification on paid tiers, the conservative reading is that generated code can occasionally resemble licensed source closely enough to matter.
Duplication-detection settings exist in the major toolsDuplication-detection settings exist in the major tools; turn them on, and treat any large verbatim-looking block with suspicion.
Keep the audit trail realKeep the audit trail real, generated commits attributed in the message, prompts or task descriptions linked where your tooling allows, and a named human accountable for every merge.

Security, licenses and provenance

Three questions come up in every serious adoption conversation, and hand-waving them is how projects get surprised later.

Security first. Models learned from public code, and public code is full of the classics: SQL built by string concatenation, unvalidated redirects, commented-out auth checks. A model reproduces the distribution it trained on, which means insecure patterns appear at roughly the rate they appear in public code unless your context and checks push back. The defenses are the same ones you would want anyway, now non-negotiable: dependency and vulnerability scanning in CI, static analysis on every generated change, and a hard rule that secrets never appear in prompts, files, or logs the model can read, because anything in the context is something the context can leak. Second, licenses. Models are trained partly on copyleft code, and while vendors have added filters and some offer indemnification on paid tiers, the conservative reading is that generated code can occasionally resemble licensed source closely enough to matter. Duplication-detection settings exist in the major tools; turn them on, and treat any large verbatim-looking block with suspicion. Third, provenance: when a generated change causes an incident, "the AI did it" is not an answer your incident review can use. Keep the audit trail real: generated commits attributed in the message, prompts or task descriptions linked where your tooling allows, and a named human accountable for every merge. These are not reasons to avoid AI coding. They are the difference between adopting it like an engineering organization and adopting it like a demo.

One more provenance point deserves emphasis because it is easy to get backwards: the goal of the audit trail is not surveillance of the tool, it is answerability for the change. When a generated migration misbehaves at scale, the questions are always the same. What was it asked to do, what did it actually change, what verified the change, and who accepted it. Teams that can answer those four questions in minutes treat AI incidents like any other incident. Teams that cannot are the ones that end up banning the tools after the fact, which protects no one, because the code is already merged and the habit just moves underground. Decide the trail before you need it: task description attached to the change, checks recorded, reviewer named. That is enough, and it is not optional at the production bar.

19

What it costs

The bill for AI coding has two halves, and teams consistently budget for the wrong one.

An agentic coding sessionAn agentic coding session is expensive in a way autocomplete never was: each loop iteration resends a large context, a single task can mean dozens of iterations, and frontier models price by the million tokens in and out.
A heavy agentic sessionA heavy agentic session on a real task can cost a few dollars in usage terms, which is why the tools sell subscriptions and credit pools rather than per-call pricing.
The invisible half is human time and it cuts both ways
On the cost side, orienting the model, writing the task wellBabysitting a long session, and most of all reviewing the output.
The METR study's slowdown, rememberWas measured on total implementation time including exactly this overhead.

What it costs

The bill for AI coding has two halves, and teams consistently budget for the wrong one.

The visible half is tokens and seats. An agentic coding session is expensive in a way autocomplete never was: each loop iteration resends a large context, a single task can mean dozens of iterations, and frontier models price by the million tokens in and out. A heavy agentic session on a real task can cost a few dollars in usage terms, which is why the tools sell subscriptions and credit pools rather than per-call pricing. This half is easy to measure and almost never the half that matters.

The invisible half is human time, and it cuts both ways. On the cost side: orienting the model, writing the task well, babysitting a long session, and most of all reviewing the output. The METR study's slowdown, remember, was measured on total implementation time including exactly this overhead. On the savings side: the hours not spent on boilerplate, on writing the first draft of tests, on exploring an unfamiliar API, on the tenth variation of a form. The net depends almost entirely on task selection. Tasks that are well-specified, well-tested, and boring are where the economics shine, because generation is fast and verification is mechanical. Tasks that are ambiguous, novel, or deep in a codebase the model cannot see are where the economics invert, because you pay full price for the human thinking and then pay again for the machine's confident detour. Budget by tracking outcome per task type for a month, not by the seat price, and let the measured mix, not the demo, decide how widely you roll the tools out.

There is also a capacity cost that rarely appears in the budget: review does not scale with generation. If the tools double the rate at which diffs arrive and the review team is the same size, you have not doubled throughput, you have doubled the queue, and queues have their own costs in stale branches and merge conflicts. The teams that absorb generation volume well either narrow what gets generated to the task types that review cheaply, or invest the time savings back into review capacity and the mechanical checks that make review faster. The worst outcome is the quiet one: review standards erode to match the arrival rate, and nobody notices until the codebase's comprehension debt comes due all at once.

20

How to get production-grade output

Everything so far compresses into a working method. This is the section to copy into your team's wiki.

Start with task selection, pick work that is well-specifiedHas fast feedback, and tolerates iteration.
Bug reports with a failing testBug reports with a failing test, features in a well-covered module, mechanical migrations, boilerplate scaffolds.
Write the task the way you wouldWrite the task the way you would write a good ticket for a contractor: the goal, the constraints, where to look, and what done means, with pointers to the files and conventions that matter.
Give the model a check to run before you give it freedom to editThe failing test, the type check, the lint rule.
Keep the scopeKeep the scope of one session tight enough that the final diff stays humanly reviewable, and run two small sessions rather than one sprawling one.

How to get production-grade output

Everything so far compresses into a working method. This is the section to copy into your team's wiki.

Start with task selection: pick work that is well-specified, has fast feedback, and tolerates iteration. Bug reports with a failing test, features in a well-covered module, mechanical migrations, boilerplate scaffolds. Write the task the way you would write a good ticket for a contractor: the goal, the constraints, where to look, and what done means, with pointers to the files and conventions that matter. Give the model a check to run before you give it freedom to edit: the failing test, the type check, the lint rule. If no check exists, write the crudest possible one first; it is the single highest-leverage investment. Keep the scope of one session tight enough that the final diff stays humanly reviewable, and run two small sessions rather than one sprawling one. Interrupt early when the approach drifts: redirecting at step three is cheap, reviewing a thousand-line wrong diff is not. And end every session the same way: read the diff, run the checks yourself, and make the merge decision like you own it, because you do.

Two anti-patterns to refuse. The vague mega-prompt, "build me the reporting feature," which guarantees the model fills every ambiguity with its average guess and you pay for the unwinding. And the unattended long run on anything irreversible, which converts every failure mode in this article from a review finding into an incident. The teams reporting real gains are not doing anything mystical. They are running a tight loop: clear task, visible context, executable contract, honest review. The model does the typing. The engineering still does the engineering.

Goal: what done meansConstraints: what not to touchPointers: the files and conventions that matterContract: the check that must passScope: a diff a human can review

21

Team practices that make it stick

Individual habit is not enough; the teams that sustain gains treat AI coding as a process change with owners, not a tool rollout with licenses.

They write the conventionsThey write the conventions file as a team artifact and review changes to it like code, because it is code: it is the program the model runs on every task.
They decide explicitly which checks are deterministic gatesTests, types, lint, deny rules, and who can change them, because an agent that can weaken its own gate has no gate.
They set expectations on diff size and session scopeThey set expectations on diff size and session scope, And they normalize abandoning a bad session early, because sunk cost applies to machine work too and restarting with a better task description is usually cheaper than rescuing a sprawling one.
They track outcomes honestly, cycle time by task typeRework rate on generated changes, incidents traced to generated code, and they compare against the pre-AI baseline rather than against the demo.
The METR perception gapThe METR perception gap, developers convinced they were faster while measuring slower, means adoption pressure selects for the feeling of speed rather than the fact of it.

Team practices that make it stick

Individual habit is not enough; the teams that sustain gains treat AI coding as a process change with owners, not a tool rollout with licenses.

They write the conventions file as a team artifact and review changes to it like code, because it is code: it is the program the model runs on every task. They decide explicitly which checks are deterministic gates, tests, types, lint, deny rules, and who can change them, because an agent that can weaken its own gate has no gate. They set expectations on diff size and session scope, and they normalize abandoning a bad session early, because sunk cost applies to machine work too and restarting with a better task description is usually cheaper than rescuing a sprawling one. They track outcomes honestly: cycle time by task type, rework rate on generated changes, incidents traced to generated code, and they compare against the pre-AI baseline rather than against the demo. And they train reviewers, because reviewing generated code is a distinct skill: you are checking intent, contract coverage, and the characteristic failure patterns, not admiring syntax.

What they do not do is mandate usage. The METR perception gap, developers convinced they were faster while measuring slower, means adoption pressure selects for the feeling of speed rather than the fact of it. Let the engineers who get measured value use the tools heavily, let the skeptics opt out without stigma, and revisit quarterly, because the tools are improving on a timescale that makes any permanent policy a guess. The goal was never "use AI." The goal is software you can trust, shipped at a pace the business can use, by a team that still understands its own codebase next year.

22

What still needs a human

After all the automation, a specific set of decisions remains stubbornly human, and pretending otherwise is where the expensive stories come from.

How the system is shaped, the architecture, is mostly human tooHow the system is shaped, the architecture, is mostly human too, Because architecture is the art of decisions that are expensive to change later, and the model's training distribution optimizes for the average of how things are usually done, not for your constraints ten months from now.
Whether the code is acceptable is human in the endThe model can pass every check you gave it, and you are still the one who knows whether the checks were the right ones.
The clean way to think about the divisionThe clean way to think about the division, the model is an extremely fast, extremely well-read contributor with no memory across sessions, no stake in the outcome, and no ability to be responsible for anything.
You would never let such a contributor set the roadmapApprove their own merge, or push to production unobserved, no matter how good their code looked.
Keep the human where judgment and accountability liveGive the model everything else, and the arrangement works remarkably well.

What still needs a human

After all the automation, a specific set of decisions remains stubbornly human, and pretending otherwise is where the expensive stories come from.

What to build is a human call. The model can implement a feature brilliantly that should never have existed, and no test suite checks product judgment. How the system is shaped, the architecture, is mostly human too, because architecture is the art of decisions that are expensive to change later, and the model's training distribution optimizes for the average of how things are usually done, not for your constraints ten months from now. Whether the code is acceptable is human in the end: the model can pass every check you gave it, and you are still the one who knows whether the checks were the right ones. And the irreversible steps, the deploy, the migration, the email to customers, the spend, belong to a human not because the model is incapable of executing them but because accountability cannot be delegated to a system that cannot be accountable.

The clean way to think about the division: the model is an extremely fast, extremely well-read contributor with no memory across sessions, no stake in the outcome, and no ability to be responsible for anything. You would never let such a contributor set the roadmap, approve their own merge, or push to production unobserved, no matter how good their code looked. Keep the human where judgment and accountability live, give the model everything else, and the arrangement works remarkably well.

THE MODEL DECIDESTHE HUMAN DECIDESHow to implement the taskWhat gets built and whyWhich files to read and editWhether the checks were the right onesWhen the checks passEvery irreversible step

There is one more human responsibility that is easy to lose in the excitement: maintaining the team's own competence. Skills that are never exercised atrophy, and the engineer who has spent two years accepting generated diffs without ever building the thing by hand is a quieter, less capable reviewer of generated diffs, which is precisely the skill the whole arrangement depends on. Strong teams notice this and defend against it deliberately. They keep some work unassisted the way pilots keep hand-flying hours, they rotate people through the parts of the system the agent cannot see, and they treat "no one here understands this module anymore" as a risk on the register, not a punchline. The model's output is only as safe as the humans who can still tell, quickly and from understanding, when it is wrong.

23

The bottom line

AI writes production code by prediction, and prediction became dependable only when the industry wrapped it in the oldest ideas in software: context, contracts, feedback loops, and review. The model proposes, the tests decide, the harness guarantees, and the human remains responsible for what merges. That stack, not any single model, is the real product.

Benchmarks like SWE-bench VerifiedBenchmarks like SWE-bench Verified show frontier systems solving the large majority of packaged, well-tested engineering tasks, and that progress is genuine.
Field evidence like the METR trialField evidence like the METR trial shows the same tools slowing experienced developers down by a fifth on familiar code, while those developers felt twenty percent faster, and that caution is genuine too.
Both are true because they measure different conditionsBoth are true because they measure different conditions, And the conditions, clarity of task, existence of checks, cost of review, are exactly the variables you control.
The model supplies speed breadth and tirelessness
The repository supplies the truth, testsTypes and conventions the model can be checked against.

The bottom line

AI writes production code by prediction, and prediction became dependable only when the industry wrapped it in the oldest ideas in software: context, contracts, feedback loops, and review. The model proposes, the tests decide, the harness guarantees, and the human remains responsible for what merges. That stack, not any single model, is the real product.

The capability is real and so are the caveats. Benchmarks like SWE-bench Verified show frontier systems solving the large majority of packaged, well-tested engineering tasks, and that progress is genuine. Field evidence like the METR trial shows the same tools slowing experienced developers down by a fifth on familiar code, while those developers felt twenty percent faster, and that caution is genuine too. Both are true because they measure different conditions, and the conditions, clarity of task, existence of checks, cost of review, are exactly the variables you control.

If you take one mental model away, make it the division of labor. The model supplies speed, breadth and tirelessness. The repository supplies the truth: tests, types and conventions the model can be checked against. The harness supplies the guarantees the model cannot be trusted to keep. And the humans supply the judgment, the taste, and the accountability that no part of the stack can generate. Production code is what happens when all four do their jobs, and the disappointing demos and the horror stories both come from the same place, asking one of the four to cover for another.

So the practical answer to "can AI write production code" is: yes, when you build the production around it. Give it the right context. Define done with executable checks. Keep the changes reviewable. Review them. Reserve the irreversible steps and the judgment calls for people. Do that and the model is the fastest junior you have ever worked with. Skip it and it is the most confident incident you have ever merged. The code was never the hard part. The production was, and it still is.

A wooden desk with glasses, a coffee cup, a plant and the edge of a laptop, banner image on the How AI writes production code page

Keep reading, or try a tool.

Long-form guides on building, automating and AI computing.