Skip to content

Quality with agents

Coding with agents · topic coding-with-agents/quality

Agents make it cheap to produce code and just as cheap to produce debt. This topic covers keeping tests meaningful, documentation current, dependencies deliberate, and reviewing agent output for the security and supply-chain problems it introduces more readily than a careful human would.

Concepts

Testing
Keeping tests that prove behavior rather than mirror implementation. Agents write tests readily, and readily write tests that pass by asserting what the code happens to do. Review agent tests for what they would catch if the code were wrong, keep them fast enough to run in an agent's loop, and never let an agent delete or weaken a test to make a change pass. glossary
Documentation
Keeping the written explanation of a system current as agents change it. Agents can draft documentation from code well, and equally well leave it stale. Treat docs as part of the change: the brief names what must be updated, the review checks it, and project instructions tell the agent where documentation lives and what style it follows. glossary
Dependency hygiene
Adding libraries deliberately and keeping them pinned, current and few. An agent asked to solve a problem will often add a package where a few lines would do, or pick one it has seen frequently rather than one that is maintained. Review every new dependency for need, license, maintenance and size, and lock versions so builds stay reproducible. glossary
Security review of agent output
Checking agent-written code for the classic mistakes it makes easily: unvalidated input, string-built queries and commands, secrets in code, permissive defaults, disabled checks, error handling that hides failures. Agents reproduce common patterns including common vulnerabilities. Static analysis catches some; a reviewer asking "what if the input is hostile" catches more. glossary
Supply-chain risk
The risk that something you install is not what it seems: a package name the agent hallucinated that an attacker has registered, an action or plugin pinned to a moving tag, a transitive dependency with a known flaw. Agents increase exposure by suggesting names from memory. Verify that packages exist and are the intended ones, pin to exact versions, and audit regularly. glossary

Lessons

Your reference

Each lesson above adds its takeaways and its example here once you finish it. Your reference lists every lesson you have finished.

Reviewing what the agent pulled in

Unlocks when you finish Reviewing what the agent pulled in.

Reading agent code as if the input were hostile

Unlocks when you finish Reading agent code as if the input were hostile.

Tests that prove behavior and docs that stay current

Unlocks when you finish Tests that prove behavior and docs that stay current.

Sources