Claude Code

Verified against Claude Code · 2026-08-01

Stop Claude Code from over-engineering a bug fix

A constraint block to paste in front of a bug report that locks Claude Code, or any agentic coding assistant, to the minimal fix, an explicit acceptance checklist, and a hard no-refactor boundary.

Claude CodeCursorWindsurf

The prompt

Ready to copy — highlighted parts are example details you can swap.

You are fixing exactly one bug. You are not refactoring, redesigning, renaming, or reformatting anything else in this file or repo, even if you notice something else that looks wrong while you are in there.

BUG
Clicking Export CSV on the reports page throws a TypeError reading toFixed of undefined when a report has zero rows.

ACCEPTANCE CRITERIA
1. Exporting a zero-row report downloads an empty CSV with headers only, no error. 2. Exporting a report with rows is unchanged. 3. No new console errors.

CONSTRAINTS
- Change only what is required to satisfy every item in the acceptance criteria above. Nothing else.
- Do not rename variables, extract functions, reformat unrelated lines, or add abstractions while you are in there.
- Do not add new dependencies, new config, or new files unless the bug is provably unfixable without one. If so, stop and say why before writing code.
- Do not add speculative error handling, logging, or validation for cases that are not in the bug report.
- If satisfying the acceptance criteria requires touching more than two files, stop and explain the plan before writing any code.

OUTPUT FORMAT
1. One-sentence root cause.
2. The diff, and nothing but the diff.
3. A line mapping each changed line to the acceptance criterion it satisfies.
4. A final line: either "No other changes were made." or a named exception with the reason it was unavoidable.
Customize the highlighted detailsoptional — the prompt above already works

Why this works

Agentic coding assistants are documented to expand scope opportunistically. Once a model is editing a file it tends to clean up adjacent code unless explicitly told not to, because the same training signal that makes it helpful also makes it eager to keep going. Naming the negative space directly, such as do not rename, do not reformat, do not add abstractions, closes exactly the loopholes a vaguer just fix the bug leaves open — Claude and similar models follow explicit, direct constraints far more reliably than they infer scope boundaries from context. The numbered acceptance criteria block gives the model a checkable exit condition instead of a subjective good enough, so it can verify its own diff against a list rather than deciding when it is done, which is precisely the moment scope creep otherwise starts. Separating the bug, the acceptance criteria, and the constraints into distinct labeled sections also reduces cross-contamination in longer tickets — the model is far less likely to treat a description of the broken behavior as an instruction to also fix nearby code when the two are structurally separated.

What you get back

1. Root cause: formatRowCount divides rows.length by total and calls toFixed on the result without guarding total equals zero, producing NaN.toFixed which throws. 2. Diff: - const avg = (rows.length / total).toFixed(1) + const avg = total === 0 ? '0.0' : (rows.length / total).toFixed(1) 3. This line satisfies criterion 1, the zero-row export no longer throws, and criterion 2, the non-zero path is unchanged. 4. No other changes were made.

Verified against

Claude Code Sonnet 4.6 · 2026-08-01

Changelog

  • 2026-08-01 Initial publish, verified against Claude Code (Sonnet 4.6).

Building this for real?

This is a free starting point. If you'd rather have custom software built and running for your business, that's Scult's day job.

EXPLORE CUSTOM SOFTWARE
All Claude Code prompts

Check your AI visibility

One URL in, a 0–100 score and the exact fixes out.

RUN THE CHECK

Browse all the tools

15 tools across six categories
13 of them never send your data anywhere

Free · No signup · No trial clock

SEE THE DIRECTORY