~/blog/guide/ai-quality
AI and code quality
Generation got cheap. Judgement did not. On tests, churn and the bar that stays where it was.
What this guide covers
Generating code now takes seconds. Judging whether it is correct, whether it fits the system, and whether it will hold up costs exactly what it always did. That gap is the subject of this cluster, because nearly every quality problem with AI code turns out to be a variant of it.
I write this from practice. I use agents daily and they produce real work. Which is exactly why the friction stands out: output grows, review capacity does not, and everything you skip judging comes back later with interest. Speed got cheap, judgement didn't works that through on what large-scale orchestration does to your review.
It starts before the code exists
Most bad AI code traces back to a bad brief. The prompt is not the spec is the whole argument: a vague intention is not requirements, and the model will happily fill the gaps with something plausible. The sequel is the spec you didn't read, where letting an agent write the spec is fine and forwarding it unread to a second agent is where it goes wrong.
The same holds for how things look: leave the design brief open and the model picks the median. The AI tells on my site holds this site against Anthropic's own list of AI design defaults, and shows how a test can pin a default until it passes for a decision. Afterwards I measured the same thing in code: 23 models got the same open brief, and most of them added fields nobody asked for. Names go the same way: 19 models naming ten projects keep handing out the same few, and the ones they agree on are often taken already.
There is also a signal in how hard the agent is finding it. Your agent's suffering is your technical debt speaking: when a model keeps stumbling in one corner of your codebase, that corner was already confusing before it arrived.
Tests that prove something
The obvious reflex is to have the AI write the tests too, and let quality take care of itself. Almost. Coverage only proves a line was executed, never that anyone would notice it being wrong. And a model that makes a reasoning error in the code will cheerfully repeat that error in the test. In AI writes the tests, mutation testing checks if they work I use mutation testing to make that false confidence measurable: sabotage the code and see whether a single test goes red. The score is a measurement too, and the tool taking it can break: Stryker and Vitest 5 is how to tell from the report whether a collapsed score means weak tests or a runner that never ran them. For the setup itself, mutation testing with Vitest and Stryker covers the config, which files to mutate and which score the threshold checks, with this site's own numbers.
A suite can also stop proving anything one catch block at a time. Empty catch blocks in AI code is about the // ignore that gets an agent past ESLint's recommended config, the test step that can no longer fail because of it, and the lint rule that sees through the comment.
Review is the other gate, and it changes when the author is a model. How to review a pull request an AI wrote is what I look for, in what order, and which of your old review instincts stop firing.
What happens to your codebase
Quality reaches past the individual PR. At codebase level three patterns keep showing up.
The first you can measure: code churn, lines rewritten within two weeks because the first version was never really finished. The second is quieter: the lava layer, code nobody understands anymore and therefore nobody dares touch. The third is the one people laugh at until they grep for it: twenty ways to format money in one repo, because an agent with no memory of your helpers writes a fresh one every time.
Measuring AI code quality is how you put numbers on all three, and why three of the obvious instruments hand you a headline figure that flatters AI code instead of catching it. When the diagnosis is in, the consolidation pass is the treatment, and a cleanup only holds if the next session cannot re-add what you just removed. Quality ratchets are how you enforce a standard your repository already breaks everywhere: freeze what exists, fail on what gets added.
Every one of those instruments measures code that runs. What a dependency graph finds that your coding agent misses covers the other half: the exported function nothing imports, the safety net that was tested and never wired in, and why a defect living between files stays invisible to anything reading one file at a time. Dead code with passing tests counts the worst variant in my own repositories: functions nothing in production calls, made to look alive by their own tests, and those tests are what get an agent to reuse them.
An instrument only protects you when something runs it and it is able to go red. Code quality guards for AI code puts all of the above into one project, from the hook that stops an agent lowering the bar to the weekly mutation run, and catalogues the ways a guard ends up green while checking nothing.
The measuring instruments get asked a neighbouring question they cannot answer on the spot, which is whether the model you just swapped in is the reason things feel worse. Comparing coding models without a benchmark is the harness for that one, and the reason your instinct to re-run the prompt and diff it proves nothing.
The bar that stays where it was
Which is why this cluster keeps landing on the same standard. Never ship code you don't understand: if you cannot explain a piece of code to a colleague without pointing at the AI, it does not belong in your repo. And keep your reading muscles trained, because you can't spot the bug if you didn't write the code. Debugging instinct is built from thousands of rounds of writing and reading your own work, and it evaporates faster than you expect.
None of these rules are new. They held when code was typed by hand. AI made them more urgent, because the volume at which you can break them has exploded. Typing speed used to be a natural cap on how much poorly understood code could land in your repo per week. That brake is gone and nothing automatic took its place. The replacement has to come from your process, which is what the posts in this cluster try to supply.
A bar is only as steady as the person holding it, and that is the half of the story you cannot see in yourself. Eight reports, one bar puts a number on it: one public rubric, eight submissions read back to back, and a script afterwards showing that my own bar for clarity had slipped three quarters of a level along the way.
Where this touches the workflow
Quality starts upstream, in how you drive an agent. A proper spec, small steps and review as a fixed gate prevent more misery than any linter. That gate assumes you know what to review, and in auto mode the final diff is a poor guide: what git diff can't show you about a Claude Code session covers the changes a subagent made out of sight and the fixes that were overwritten before you looked. The full working method lives in the agentic coding guide, under related topics below.
Below are three starting points, then every post in this cluster, newest first.
best entry points
- Why you should never ship code you don't understand
The core rule of this whole cluster. If you read one piece, read this.
- How to review a pull request an AI wrote
Judgement in practice. What to look for in a pull request an agent wrote, and why green CI says nothing about it.
- You can't spot the bug if you didn't write the code
What happens to your reading skill when AI takes over the writing.
all articles in this topic
- 67.98total mutation score, where covered says 78.15
Mutation testing with Vitest: a Stryker setup that stays useful
A StrykerJS config for Vitest, and the three choices that decide whether the score means anything: which files you mutate, what you do with static mutants, and which score your threshold checks. With the numbers from the code behind this site.
- 138dead symbols only tests still call
Dead code with passing tests: what coverage won't tell you
I rescanned 29 of my own repositories for dead code. Of 296 dead symbols, 138 are only ever called by tests. Coverage counts them as covered, and an agent reading the repo sees a tested function that looks safe to reuse.
- 803Ledgerly repos created in 2026, up from 10
Why AI gives everyone the same name: 505 runs across 19 models
Ask a model to name your project and you get the name it gives everyone with a similar brief. I gave 19 models ten naming briefs, from a game to a SaaS to a fantasy heroine, 505 runs in all, and counted how often they agree and how many of their favourites are already taken.
- 0.00%mutation score on vitest 5
Stryker and Vitest 5: why every mutant suddenly survives
After upgrading to Vitest 5, StrykerJS reported every covered mutant as survived, with a green dry run and no error. How to tell a broken runner from a weak test suite in the report itself, what 10.1 fixed, and why the version to install is 10.1.1.
Claude Code changed files without asking: what git diff can't show you
Since auto mode became the default, an agent that asks before it edits is the exception by design. The final diff shows where the session ended up. It cannot show which changes were put to you, which ran in a subagent, or which work was done and undone before you looked.
Code quality guards for AI code: the whole setup, from hook to CI
The full quality setup for a project where an agent writes code: what belongs in Claude Code hooks, pre-commit, pre-push, CI and the weekly mutation run. And the one property every guard needs, which is that it can fail, with the evidence from three of my own repositories.
- 69unasked timestamps, of 83
Nobody asked for it: what coding agents add when you don't decide
Three days after taking the AI tells off this site, I wanted to know what they look like in code. So I gave 23 models the same three TypeScript tasks, 266 runs in five agent harnesses. Most of them add fields nobody asked for, every model line has a handwriting you can recognise, and two of the newest GPT models leave the data model as the prompt described it.
The AI tells on my site, and which ones I chose
A list of ten tells of AI-generated UI went round over the weekend, and item seven describes this site down to the fonts. Anthropic lists the rest of its look as a default in its own design skill. Asking which parts had a written reason separated my own choices from what an agent had added, and those additions went.
Eight reports, one bar: judging an AI safety sprint
I judged eight submissions at the Apart Research AI Incident Response Sprint. Keeping my own bar in the same place from the first report to the eighth took an apparatus, and the apparatus caught me dropping it three quarters of a level.
- 92%empty catches with a comment
Empty catch blocks in AI code: the comment that silences your linter
AI-generated code swallows errors in catch blocks that hold nothing but a comment, and ESLint's recommended config waves them through because of that comment. What I found in my own repositories, why a model writes it, and the rule that sees through the comment.