Skip to main content
MindStudio
Pricing
BlogAbout
My Workspace
AI coding agent verificationClaude Code habitsagentic coding

Five Habits to Verify AI Coding Agent Output Before You Ship It

A step-by-step guide to five verification habits that catch bugs AI coding agents miss, even when every test shows green.

Edited by Luis Chavez-Mattos, Director of Product RSS
Five Habits to Verify AI Coding Agent Output Before You Ship It

Why a green checkmark from an AI coding agent isn’t proof of anything

A passing test or a confident summary from an AI coding agent tells you that the agent ran something and it didn’t fail. It does not tell you that the agent fixed the right problem, tested the right scenario, or even ran more than a fraction of your test suite. Addy Osmani, who leads work on Claude Code at Anthropic, laid out this problem in an article titled “Critical Thinking: When Agents Do the Work,” published November 3rd. His core line: when a check goes green, ask what it proved, then ask what it didn’t. The gap between those two questions is where bugs survive code review.

TL;DR

  • Writing your own guess about the bug’s cause before prompting the agent keeps you from rubber-stamping a polished but wrong explanation, because once you’ve read a confident answer it’s hard to imagine alternatives.
  • Defining what “done” means upfront, ideally as a deterministic test, stops you from rationalizing a lucky pass as a real fix, especially for timing-dependent bugs like race conditions.
  • Reading the actual command and its output, not just the agent’s summary, can reveal that a test suite ran with a filter that only exercised one of several tests, while still reporting a clean pass.
  • Getting a second opinion from a fresh agent session or sub-agent that only sees the requirements and the diff tends to catch blind spots, because the first agent (and you) share the same initial assumption about the cause.
  • Explaining the fix from memory, without looking at the code, forces you to actually own the change instead of just merging something that looked reasonable.
  • A worked example with a search box race condition shows a “partial fix” passing a filtered test while still failing on an unhandled edge case (clearing the input field) that nobody had written a test for.
  • Osmani also recommends writing code without an agent at least once a week, on the grounds that skills you stop using fade faster than expected, and you need those skills to judge whether the agent’s work is actually correct.
› Build a shift-handoff app for 900 nurses.
already included:✓ HIPAA✓ access control✓ audit log✓ self-hosted
The enterprise platform for building software with AI.

What’s the first habit, and why write a guess before asking the agent?

Before you type a prompt, write down what you think is causing the bug, even if your guess turns out to be wrong. The reasoning here isn’t about being right. It’s about sequencing. Once you’ve read a well-written, plausible explanation from an agent, it becomes very hard to generate competing hypotheses in your head. Your brain anchors to the first coherent story it sees. If that story is confidently wrong, you’re unlikely to notice, because you never built your own independent model of the problem first.

A concrete example: a search box bug where typing “cat” and then quickly “cats” sometimes leaves “cat” displayed, because the slower first request resolves after the faster second one and overwrites the correct result. A reasonable guess here is “last response wins instead of latest query wins,” i.e., a race condition where response order doesn’t match request order. Write that guess down before asking anything. It becomes the yardstick for judging whatever the agent proposes.

How do you define “done” so a fix isn’t just lucky?

“Done” cannot be “I tried it and it looked fine,” especially for race conditions and other timing-dependent bugs. Manual testing on bugs tied to network timing can pass by pure chance, because the slower response might happen to arrive first on your machine, every time you happen to test it. That’s not verification. That’s a coin flip you didn’t realize you were flipping.

The fix is to define “done” as a deterministic test that forces the problematic order every single run, using something like a fake server with manually controlled, hand-resolved promises rather than real timeouts or sleeps. You decide the order the responses come back in, not the network. Then you confirm that test fails against the current, buggy code before any fix is applied. Only after you’ve seen it fail for the right reason does a subsequent pass mean anything.

Why does reading the command matter more than reading the summary?

This is the habit most people skip, and it’s where a lot of false confidence slips through. When an agent says “all tests pass,” read the actual command that ran and its literal output before you read the summary sentence. Summaries smooth over details. Commands don’t.

The enterprise platform for building software with AI

Build an onboarding app for 4,000 new hires.

Build ↵
Self-hosted
SOC 2
Role-based access
Audit log

In the search box example, a “partial fix” was applied that checks a request’s sequence number against the latest search before writing results to the screen. Running the test suite against it returns a clean pass: one test, zero failures, exit code zero. Green across the board. But the command used to run that test included a name filter that selected only one specific test out of the full set. Technically, “all tests pass” was true. It was also true that only one test ran. An agent reporting “all tests pass” without surfacing that filter would leave you believing far more had been verified than actually was. The discipline here is simple: before accepting a “done” summary, ask which specific tests ran, and which were skipped or filtered out.

Why ask for a second opinion, and from whom?

The partial fix above handled the race condition on response order but missed a second requirement entirely: clearing the search box while a request is still in flight should leave the box empty, even if a stale response arrives afterward. The original guess only concerned response ordering, so the test written to confirm that guess also only checked response ordering. It never touched the clear-the-box case. A test can only check what you thought to check, and if your guess has a blind spot, your test inherits it.

This is why a second, independent opinion matters. The second reviewer, whether a fresh chat session or a sub-agent with its own context, should see only the requirements and the code diff, not the original guess or reasoning. Prompted to find one path the existing tests don’t cover and to write a test for it, a reviewer starting from a clean slate is far more likely to notice the clear-box path precisely because it isn’t carrying the same assumption that narrowed the first investigation. In the worked example, writing a new test for “start a search, clear the box, then let the stale response arrive” immediately exposes the gap: the partial fix still writes the stale result into a box the user just emptied, because clearing the input never claimed a new sequence number. The full fix closes that gap by having the clear action also advance the sequence counter, so any response that arrives afterward is recognized as stale and dropped.

Does explaining the fix from memory actually improve code quality?

The last habit is less about catching bugs and more about accountability: after a fix is in place, explain it out loud or in writing, from memory, without looking at the code. If you can walk through exactly why the fix works (in the search box case, “every search and every clear action claims a new number, and a response only writes to the screen if its number still matches the latest action”) then you understand what you’re shipping. If you can’t produce that explanation, you haven’t reviewed the fix. You’ve merged it. That distinction matters for anyone accountable for the code later, whether that’s during an incident, a security review, or just the next person reading the diff.

Frequently Asked Questions

What is Addy Osmani’s “Critical Thinking” framework about?

It’s a set of habits, described in his November 3rd article “Critical Thinking: When Agents Do the Work,” for verifying AI coding agent output rather than trusting a passing test or a confident summary at face value.

Why do AI coding agents produce convincing but incomplete fixes?

Agents tend to solve the specific scenario they’re pointed at. If a prompt or initial hypothesis only describes part of a bug (like response ordering but not an edge case such as clearing input mid-request), the resulting fix and its tests will cover only that part, while still reporting success.

› Build a claims-review app for 400 adjusters.
already included:✓ HIPAA✓ access control✓ audit log✓ self-hosted
The enterprise platform for building software with AI.

How can a test suite show “all tests pass” without actually testing everything?

A test run can be scoped with a filter or name pattern that only executes a subset of tests. The output can honestly report zero failures while skipping most of the suite, which is why checking the literal command used matters as much as the output.

What’s the practical way to get a “second opinion” on AI-generated code?

Start a fresh session or sub-agent that only has access to the requirements and the code diff, not the original prompt or reasoning. Ask it specifically to find a path or case the existing tests don’t cover, rather than to generally review the code.

Does this mean you shouldn’t trust AI coding agents?

No. It means treating a green checkmark as a starting point for verification rather than the end of it, and keeping enough hands-on coding skill to judge the agent’s work, which Osmani suggests maintaining by writing code without an agent on a regular basis.

Editorial standards

Presented by MindStudio

No spam. Unsubscribe anytime.