Why Veteran Developers Skip Reading Agent-Generated Code
A seasoned programmer explains how imposing strict testing constraints on AI code agents—through a TDD‑style workflow, a multi‑stage gauntlet, and reproducible evidence—lets him trust generated code without manually reviewing each line.
Core Idea
Uncle Bob Martin’s practice is to never read code generated by AI agents. Instead he surrounds the agent with strict constraints—unit tests, Gherkin scenarios, QA processes, quality metrics, mutation testing, and coverage checks—so that generated code must pass all hurdles before it is trusted.
Open‑Source Skill
The open‑source skill old‑coder implements this idea. Install with a single command:
npx skills add https://github.com/amazingang/old-coderIt supports Claude Code, Codex CLI, Cursor, Aider, or any custom agent loop.
Workflow
The full TDD loop is embedded as:
SPEC → RED → GREEN → REFACTOR → GAUNTLET → EVIDENCE
Only two documents need human review:
SPEC (before coding): the agent produces a test plan with concrete behavior examples and required tools; the engineer approves it.
EVIDENCE (after coding): a reproducible report generated from a fresh run, re‑executable with a single command.
During the cycle the agent writes its own tests, observes failures, writes code to pass them, refactors, and then is pushed through the gauntlet.
Gauntlet Checkpoints
The gauntlet consists of eight core checkpoints, each answering a specific question:
Full test suite – Anything broken?
Type check + lint + complexity – Any obvious errors or unreadable spaghetti?
Changed‑line coverage – Has every new line been exercised?
Mutation testing – Can injected bugs be caught?
Property testing – Do rules hold under hundreds of random inputs?
Real execution – Does the code run outside the test framework?
Supply‑chain & key checks – Has the agent introduced dangerous packages or leaked keys?
Suite health – Is the test suite stable when order changes?
Additional risk‑based layers (concurrency, UI checks, API compatibility, performance, observability) are applied proportionally to potential impact, following the rule “effort scales with risk”.
Preventing Agent Self‑Cheating
Never allow weakening tests to achieve a pass.
Never report a check that was not actually run.
Mark unverified results with unverified and never with pass.
If no one has approved the SPEC, the report must note this and lower confidence.
The gauntlet can only prove that code meets the SPEC; it cannot guarantee the SPEC covers everything, so human review of the SPEC remains essential.
Demo Results
A complete rate‑limiter demo is included in the repository. Running the demo yields:
17 tests, 100% branch coverage, all 8 injected bugs caught. The process also discovered a real bug—a NaN time‑window slipping past input validation.
cd demo-rate-limiter
python3 -m venv .venv && .venv/bin/pip install -r requirements-dev.txt -e .
./tools/gauntlet.shObservations on Code Quality
Bob emphasizes that code quality is more critical for agents because messy code slows them down and can cause them to get stuck. He enforces strict limits on function size, cyclomatic complexity, and test coverage to keep agents efficient.
Supervision
The engineer remains responsible for supervising the constraints, acting as an overseer of the agent without needing to read every generated line.
Repository
Source code and demo are open‑sourced at https://github.com/AmazingAng/old-coder
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
AI Engineering
Focused on cutting‑edge product and technology information and practical experience sharing in the AI field (large models, MLOps/LLMOps, AI application development, AI infrastructure).
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
