Back to Research

A better bug-finding prompt for coding agents

A better bug-finding prompt is one reviewers can replay: receipts, precedence, and connector boundaries for agent-led debugging.

Winter Landscape, landscape painting by Jan Griffier (1680).
Rogier MullerApril 5, 20265 min read

A better bug-finding prompt is one a reviewer can replay without you in the room. The prompt is the standing instruction set a coding agent uses to hunt defects and prove its findings, and the proving half is the part most teams skip. Claude Code, Anthropic's coding agent, will happily find a real bug and pass locally, but if the reviewer cannot replay that run, the fix sits in the queue while everyone waits for you to explain it.

So the goal is not a smarter hunter. The goal is an agent that hands back evidence anyone on the team can check.

Ask for receipts, not just a verdict

Most bug-finding prompts ask the agent to look for problems. That produces confident prose. A good prompt instead demands what the agent hands back when it is done.

The four things worth forcing into every report: an intent line, the command transcript, a diff summary, and the tests that prove the regression guard holds. With those, a reviewer replays the find. Without them, they either reconstruct your session or trust it blind, and both are bad.

Here is the shape of a single report you can paste into a PR description or have the agent emit at the end of a run.

## Bug-find receipt

Intent: why I went looking, and where
Commands run:
  $ <command 1>
  $ <command 2>
Diff summary: files touched + one line each
Regression proof: <test name> now fails on old code, passes on new
Connectors used: <MCP server>, expected? yes/no

Set precedence so the agent stops inventing policy

During a hunt, debugging always wants one more command, and bash approvals turn into muscle memory fast. Hooks help, but the agent still needs to know which rules win.

Put the answer at the top of CLAUDE.md: which hooks win, which folders need human eyes, where temporary overrides live. Now the agent cites policy instead of inventing it mid-run. For a Codex CLI run, the same job belongs in AGENTS.md, plus a note that CLI runs must carry replay-friendly verification, because a CLI pass is easy to merge while the transcript stays invisible to reviewers.

For Cursor, keep scopes explicit in your .mdc rules and forbid any MCP domain you have not declared. The pattern is the same across all three: write the boundary down in the file the agent already reads.

Keep the MCP blast radius mapped

An agent wired to MCP will eventually read data nobody put on the diagram, because connectors ship as capability demos and least privilege needs an explicit boundary. The fix is cheap: one small card per server.

Field What it holds
Server Name of the MCP server
Allowed Actions the agent may take
Forbidden Actions it may never take
Owner Who approves changes
Rollback How to undo a bad call

With the card in place the hunt can range widely and the blast radius still stays known. One thing stays off autopilot no matter how good the prompt gets: threat models, customer promises, and any decision about blast radius belong to a human.

Make forked children report what they touched

If you fork the hunt across child agents, the parent's summary tends to drop the paths the children owned. The summary shrinks under pressure. Receipts do not.

So require every child to return the same block: the paths it touched, the commands it ran, and the tests proving its regression guards still hold. The parent then merges evidence instead of confidence. Reading a hunt for drift is a real skill, and this block is what makes drift visible.

You can pressure-test your own version of this on real repos in our team training, and the sibling patterns live on the agentic coding governance page.

Common questions

What makes a bug-finding prompt actually better? The demands it places on output. A prompt that only asks the agent to find bugs produces confident prose; one that demands an intent line, the command transcript, a diff summary, and tests proving regression guards produces evidence a reviewer can replay. The find is cheap. The replayable proof is what teams are short on.

Why do agent-found fixes stall in review? Because the find happened in a session the reviewer cannot see. A local pass is not team-wide confidence, and without a replay recipe the reviewer either reconstructs the hunt or trusts it blind. Shipping the transcript with the PR removes that choice, so the fix moves instead of waiting on you.

How should a debugging agent report what it touched? With a receipt block: paths touched, commands run, and tests proving the regression guards hold. This applies whether the agent worked alone or forked children. Summaries shrink when things get busy, which is exactly why reviewers should insist on the block rather than accepting a tidy paragraph.

Do I need a separate prompt for Claude, Codex, and Cursor? No. The receipt demands stay the same across all three. What changes is the file the boundary lives in: CLAUDE.md precedence for Claude Code, AGENTS.md replay notes for Codex CLI, and explicit .mdc scopes for Cursor. Write the rule once in the file each agent already reads.

Start here

Pick one debugging run this week and require the receipt block before merge. If it survives that, turn it into a .mdc rule, an AGENTS.md note, or a review checklist so the next run starts with proof built in.

Further reading

Related training topics

Related research

Ready to start?

Transform how your team builds software.

Book a 15-minute sync