← Back to library

Add a merge check for every way coding agents break code

Alex Marquardt, whose team leans on Claude Code to build an e-commerce search product, listed on Reddit each way the agents broke the codebase and the automated check that now blocks it. Last month, 1,652 pull requests were merged into their main repository. We turn his list into a checklist you can start this week.

  • OutcomeKeep a running list of the specific ways coding agents have damaged your repository, from hollow tests and invented fake responses to deleted files and silenced type errors, and turn each one into an automated gate that blocks the merge, so the same mistake cannot slip through review twice.
  • SetupAn afternoon+
  • LevelAdvanced
  • Creditu/alexmarquardt on r/ClaudeCode
View original
Works with
Claude CodeCustom agent

Published Nov 10, 2026Updated Nov 10, 2026AI dry run on sample input: passed Nov 10, 2026Source verified Nov 10, 2026

When should you use it?

  • Coding agents open many of your pull requests and human review cannot keep up
  • You have already seen an agent write a test that could never fail, or quietly skip one
  • You want rules that hold even when nobody remembers why they were added

Not for: Solo scripts and throwaway prototypes, where the overhead outweighs the benefit; Teams without a CI pipeline that can block a merge; Replacing human review of security-sensitive changes

What do you need, and what do you get?

You need

  • A repository where coding agents submit pull requests
  • A CI pipeline that can fail a build and block the merge
  • A short log of agent mistakes you have caught so far

You get

  • A failure-to-check table kept in the repository
  • One automated gate per failure mode, wired into CI or git hooks
  • A small set of planted bad changes used to test each new gate

How does it work, step by step?

  1. Write down each failureEvery time an agent change causes harm or nearly does, record what happened in one line, such as a test that copies the logic it checks.
  2. Turn it into a gatePick the cheapest automatic check that would have caught it: a lint rule, a grep over the diff, a duplicate-code scan or a hook that refuses writes outside the working folder.
  3. Test with recorded dataHave agents capture real responses from the live service as fixtures, and refuse hand-written fakes and tests that skip when a dependency is missing.
  4. Attack the new gateBefore a gate goes live, feed it a few deliberately sneaky changes and make sure it blocks them.
  5. Keep the always-loaded guide smallCap the instructions loaded into every agent call at a couple of kilobytes and move detail into topic files the agent opens only when needed.

The prompt

Our own prompt, inspired by u/alexmarquardt on r/ClaudeCode and written to work in Claude Code and Custom agent. Values in lime are placeholders.

Fill in the blanks (optional; the copied prompt uses your values)

Prompt3 variables
You are helping me harden a repository where coding agents open pull requests. Our stack: {stack}. Our CI: {ci_system}.
Here are the agent mistakes we have caught so far, one per line:
{incident_list}
For each mistake, propose the cheapest automated check that would have blocked the merge (lint rule, diff grep, duplicate-code scan, git hook, test naming rule or recorded-fixture rule). Give the exact rule or script, where it runs, and what message it prints when it fails.
Then write one deliberately sneaky change for each check that tries to get past it, and say whether the check as written would catch it.
Do not change any files. Present everything as a table followed by the scripts.

Inspired by u/alexmarquardt on r/ClaudeCode: Reddit post: the ways coding agents broke our codebase, and the check we added for each one. The prompt above is written by playbooks.bot in our own words; nothing from the original is quoted.

What can go wrong?

  • A gate that nobody tested against an evasion is a suggestion. The author found that most planted evasions got past a brand-new gate.
  • Long contributor guides backfire. Agents miss the one rule that matters when it is buried among fifty others.
  • Flaky tests teach everyone to rerun until green. Treat a flaky test as a serious bug rather than noise.
  • Checks do not remove rework. Expect a fix round on many pull requests and budget review time for it.

Our take

Most advice about coding agents is about better prompts. This post is about something more durable: treating every agent mistake as a missing test of the process, then writing that test. What makes the list useful is how specific it is. Hollow tests, fixtures nobody recorded from the real system, a silenced type error on exactly the line with the bug, an agent deleting more than a hundred files it never made. Each has a cheap, mechanical answer, and none of them depends on the model behaving well next week. We especially like two habits. Running every new gate against a set of planted evasions before trusting it, and capping the always-loaded guidance so the important rules stay visible. Our caution is about scale. This team merges well over a thousand pull requests a month, so heavy gating pays for itself. A small business with one agent should copy the method, a log of failures turned into checks, without trying to copy the whole toolchain. In our dry run, the adapted prompt turned five fictional incident notes into five matching gates and one planted evasion for each.

Where the time goes back: Each failure mode gets caught by a machine at merge time instead of by a reviewer who has to spot it in a long diff, or by a customer after release.

FAQ

How much testing does this take?
In the author's repository, test code outweighs solution code by more than three to one. He argues that ratio is what makes a high rate of agent changes safe.
Do I need all of these checks on day one?
No. Start with the failures you have already seen, since each check exists because a real change got through without it.
Does this work with agents other than Claude Code?
Yes. The checks run in CI and git hooks, so they apply to any agent or person who opens a pull request.

Source and credit

Inspired by u/alexmarquardt on r/ClaudeCode. We describe the idea in our own words, link to the original, and wrote the prompt ourselves; nothing is quoted.

Inspired by
Reddit post: the ways coding agents broke our codebase, and the check we added for each one
Creator
u/alexmarquardt on r/ClaudeCode
Published on
Reddit
Original date
Nov 10, 2026
License
Not openly licensed (the poster keeps all rights), so we quote nothing and link to the original
Originally for
Claude Code
AI dry run
Nov 10, 2026: passed. Dry-run tested by our AI test agent on sample input. Five incidents became five gates with fail messages; five planted evasions tested, one gap reported rather than hidden.
AI dry run on sample data; not run with live connected accounts. The playbooks.bot test agent filled the prompt with synthetic inputs, produced the output and checked it against the page's stated outputs and guardrails.
Verified
Nov 10, 2026: source link resolves to the original, the credited creator published it, our excerpt or prompt matches it, and the license allows our use.

Are you the creator? Claim or correct this page.

More in Operations & Admin

All 203 Operations & Admin playbooks →

Related playbooks

Operations & AdminPrompt✓ AI dry run

Give your agents one shared wiki that only one agent edits

Replace scattered agent memories with a single Markdown wiki in git: every agent reads a short daily brief from it, agents and scripts file sourced notes into an inbox instead of editing pages, one steward agent checks and merges those notes each morning, and private agent memory keeps only personal preferences.

Credit: Siim Tolk

An afternoon+
Operations & AdminWorkflow✓ AI dry run

Test every agent change against 20 fixed real tasks

Collect about twenty real jobs your agent handles, including a few it should refuse or stop on, lock that list, and rerun all of them after each change to its prompt, tools, model or setup, scoring completion, forbidden actions, correct hand-offs to a person and cost so you can see what a change improved and what it broke.

Credit: u/ChefOk4636 on r/AI_Agents

Under an hour
Operations & AdminWorkflow✓ AI dry run

Treat agent tickets like patients with staged review gates

Ship a large, correctness-critical feature written entirely by agents, with planning, review rounds and escalation rules that keep quality at human standard.

Credit: Adam Storm

An afternoon+
Operations & AdminWorkflow✓ AI dry run

Give Claude Code a git-backed memory it maintains itself

Keep your working rules and your project history in separate git repositories of plain markdown, use Claude Code hooks to load a short slice of the right rules at the start of each session, block risky actions until the matching rules are loaded, and have the agent append dated notes and commit them at the end of each task.

Credit: u/tahayelkenci on r/ClaudeCode

An afternoon+