A Reviewer’s Field Guide to Slop
Eight kinds of slop in agent code, how to spot each one in a diff & the one-line rule that keeps it out.
Slop Is a Review Problem
Slop is code that works, or looks like it works, & costs more to read & maintain than the task called for.
An agent can write a diff faster than you can read the first file. The writing got cheap. The reading didn’t, & every line the agent adds is one your team reviews today & maintains for as long as it exists.
My bar for agent code is the smallest change that fully does the job, written the way the rest of the codebase already writes it. Google’s code review guidelines draw the same line around over-engineering:
Encourage developers to solve the problem they know needs to be solved now, not the problem that the developer speculates might need to be solved in the future.
Google Engineering Practices, What to Look For in a Code Review
What Kinds of Slop Are There?
Slop comes in three kinds: code the task didn’t need, code that already exists & code that isn’t finished.
Each kind costs you something different. Bloat costs review time. Duplication leaves two places to fix, & the next bug fix lands in only one of them. Half-finished code passes a skim & you find out in production.
Bloat is the easiest to spot & the easiest to wave through. That’s why it’s worth pushing back on first. A stub or a hollow test is much easier to miss in 300 lines than in 30.
The Eight Patterns
Rows are patterns. The middle column is the tell in the diff, & the last is a rule short enough to paste into your agent’s instructions.
Bloated
| Pattern | Spot it in the diff | The rule |
|---|---|---|
| 1Speculative abstraction | A new interface, base class or factory with exactly one implementation. A Manager or Provider wrapped around a single case. | Add the abstraction when the second case shows up. |
| 2Options nobody asked for | New parameters every caller leaves at the default. New config keys. A flag for behavior the task never mentioned. | Build what the task asks for & nothing it might ask for later. |
| 3Defensive code | Null checks on values the types already guarantee. A try/catch that logs & rethrows. The same validation at every layer. | Validate at the boundary & trust the types inside it. |
| 4Narrating comments | A comment above each line saying what the line does: // Save the order. | Comment the why. The code already says what. |
Duplicated
| Pattern | Spot it in the diff | The rule |
|---|---|---|
| 5Duplicate helpers | A new private method with a generic name in a feature file: FormatDate, IsValidEmail, RoundToCents. | Search the codebase before you write a helper. |
| 6A second way to do it | A different error handling style, a new library for a job an existing one does, a folder shape no other feature uses. | Follow the pattern the codebase already uses. When there isn’t one, ask. |
Half-finished
| Pattern | Spot it in the diff | The rule |
|---|---|---|
| 7Stubs & TODOs | TODO comments, NotImplementedException, hard-coded return values, sample data left in place, new code nothing calls yet. | Finish every path, or list the gap in the pull request. |
| 8Tests that test nothing | Assertions that only check a mock was called. Expected values edited to match new output. Skipped tests. | A test has to fail when the behavior it covers breaks. |
Keep the rules this short. A reviewer can quote one in a comment, & an agent can follow one without guessing what you meant.
If the task didn’t need a line, the diff shouldn’t have it.
One Diff, Seven Patterns
Here is the kind of diff an agent sends back for a one-line task: give loyalty members 10% off the order total.
Catch It Before Review
Review is the most expensive place to catch slop. Stop each pattern at the earliest stage that can catch it.
I’d rather an agent read a rule once than write the same review comment every week. A rule works best with an example from your own codebase beside it, so the agent copies the right shape instead of guessing at it.
| Pattern | Catch it with |
|---|---|
| 1Speculative abstraction | A rule in the agent’s instructions, with an example of when your codebase does add an interface. Review catches the rest. |
| 2Options nobody asked for | Unused parameter analyzers catch the options nothing reads: IDE0060 in .NET, no-unused-vars in ESLint. Review catches the ones no caller sets. |
| 3Defensive code | Strict null checking, plus a linter rule for conditions that can never be true, like typescript-eslint’s no-unnecessary-condition. |
| 4Narrating comments | A rule in the agent’s instructions, then review. Telling a useful comment from a narrating one takes judgment. |
| 5Duplicate helpers | Copy & paste detection (jscpd, PMD’s CPD) for near copies. A “search before you write” rule for helpers that do the same job with different code. |
| 6A second way to do it | Architecture tests (ArchUnit, NetArchTest) for layers, dependencies & naming. An example of the existing pattern in the agent’s instructions. |
| 7Stubs & TODOs | A CI check that fails when a pull request adds TODO, FIXME or NotImplementedException. |
| 8Tests that test nothing | Mutation testing (Stryker) breaks your code on purpose & shows which tests still pass. |
How Do You Review a Diff for Slop?
Most slop shows up before you read a line of logic, if you read the diff from the outside in.
When the scan turns up a pattern, send the pull request back with the rule quoted. Cleaning it up yourself fixes one pull request. Adding the rule to the agent’s instructions fixes the next one too.
An Afternoon Audit
You can find out which patterns your agents fall into most in an afternoon. Do it with the people who review the most agent code. They already know which patterns they’re tired of.
- Pick 10 recent pull requests where an agent wrote most of the code.
- Scan each one outside in & tally the patterns you find.
- Next to each pull request, note how many lines the task needed & how many it added. A rough guess is fine.
- Take your top three patterns. Add their rules to the instructions your agents read, each with one example of the right way from your own code.
- Add a tooling check for any of the three that a tool can catch.
- Two weeks later, run the same audit on the next 10 & compare.
The writing got cheap. Keep the reading cheap too: put the rules where the agent reads them before it starts, & save review for the calls only a person can make.
proto[code] serves your rules & examples to every coding agent through MCP, so each agent reads them before it writes.
Resources
The guidelines & tools behind these patterns, if you want to go deeper.
- What to Look For in a Code Review: Google’s guidance on complexity & over-engineering
- Yagni: Martin Fowler on building features before you need them
- AGENTS.md: a shared format for the instructions coding agents read
- Stryker: mutation testing for .NET, JavaScript & Scala
- ArchUnit: architecture rules as unit tests for Java
- NetArchTest: architecture rules as unit tests for .NET
- jscpd: copy & paste detection across languages
- no-unnecessary-condition: typescript-eslint’s rule for checks that can never fire