Danielle Scantling6 pieces · 6 min
Do We Really Need All These Lines? How to Tell If Your AI Agent Writes Too Much Code (2026)
The PR works. The tests pass. It is also 400 lines for a 100-line job (example numbers, but you have seen this PR).
This is the slop nobody flags in review. The code is not wrong. There is just too much of it. A March 2026 benchmark, SlopCodeBench, found agent code is 2.2x more verbose than human code in the same 48 open-source repos. Worse: the human code stayed flat over time. The agent code got worse with each change.
So ask the question every reviewer should ask: do we really need all these lines?
01 / 06 · 1 min
What Too Much Code Looks Like
Verbose agent code has a look. Once you see it, you see it everywhere.
- Wrappers nobody asked for. A helper class around one function call.
- A try/catch around every call. Errors get caught, logged and swallowed.
- Null checks on values that cannot be null. The type system already says no.
- Comments that repeat the code.
// increment counterabovecounter++. - Options nobody uses. Config flags and parameters for cases that will never happen.
- A second copy of code that already exists. The agent did not look, so it wrote it again.
02 / 06 · 1 min
How to Find Out
You do not need a new tool. You need five checks.
- The shrink test. Give the agent its own code back and say: "Make this 30% shorter. Do not change behavior. All tests must still pass." If it can, the first version was too long. This is the one to try today.
- The diff ratio. Compare the size of the change to the size of the task. A one-line bug fix should not touch six files.
- The duplication scan. Run jscpd on the repo. It finds copy-paste blocks across files and languages.
- The dead code scan. Run Knip for TypeScript, or turn on the .NET code analyzers for C#. Unused exports and parameters are a clear sign of extra code.
- The "why" check. Pick any 10 lines from the PR. Say why each one exists. If you cannot, delete it and run the tests.
03 / 06 · 1 min
Why It Gets Worse
The agent copies what it sees. The SlopCodeBench authors found that each edit keeps and extends the bad patterns from earlier edits.
So one bloated PR is not one problem. It is a template. The next task reads it, learns from it and writes more of the same. Your repo is the prompt.
And reviewers miss it. A 2026 study of agent pull requests found reviewers reacted more positively to AI code than to human code, even though the AI code had more duplication. It looks clean, so it gets merged.
04 / 06 · 1 min
What Others Are Seeing
I am not the only one asking this.
- Researchers measured it. A 2026 paper on agent patches compared agent fixes to the real fixes. When agent patches ran long, two AI judges named verbose implementation (like extra variables that do nothing) as a top cause, in about 60% of the long patches that still solved the bug.
- Someone tried the shrink test for real. Maxim Saplin cut about 40% of the lines from an AI-grown codebase in a weekend, with no loss of features. His point: the bloat comes from accumulation, a little more with every agent turn.
- Engineering leads are changing their review question. One engineering leader on LinkedIn says the bigger risk is not bad code but too much code, and that "did we need to change that much?" is becoming a key review question.
- There is a cost angle too. A UX Collective essay argues that token pricing gives tools little reason to push for short code, and that verbose code then becomes context for the next request.
Different people, same finding: working code is not the same as the right amount of code.
05 / 06 · 1 min
The One Rule
Put one line at the top of your root CLAUDE.md:
Write the least code that solves the task. Delete before you add.Claude Code reads the root CLAUDE.md on every task, so the rule reaches every folder. Folder-level CLAUDE.md files can add local detail, but this line stays on top.
One caution: CLAUDE.md is advice, not enforcement. For rules you cannot let slide, add a hook. A simple one flags any change over a set number of lines and asks for a reason before it continues.
06 / 06 · 1 min
Try It This Week
Fewer lines is not the goal. Fewer lines you cannot explain is the goal.
Pick your last agent PR. Run the shrink test. If the agent cuts 30% and the tests still pass, you just found your slop. Then add the rule and stop it from spreading.
Share this thread
References
- 01SlopCodeBench: Benchmarking How Coding Agents Degrade Over Long-Horizon Iterative Tasks (Orlanski et al., March 2026)
- 02More Code, Less Reuse: Investigating Code Quality and Reviewer Sentiment towards AI-generated Pull Requests (2026)
- 03Humans are Missing from AI Coding Agent Research (2026)
- 04Debloating The AI-Grown Codebase (Maxim Saplin, DEV Community)
- 05The perverse incentives of Vibe Coding (UX Collective)
- 06Engineering leader post on AI agents writing too much code (LinkedIn)
- 07jscpd: copy/paste detector
- 08Knip: find unused files, dependencies and exports
- 09Overview of .NET source code analysis (Microsoft Learn)
- 10Claude Code hooks reference