Skip to content

commandWorkflow

Reproduce Bug

Turns a bug report into the smallest set of steps or a failing test and shows the actual failing output.

npx workspacetemplates add reproduce-bug --tool claude-code

Writes 1 file to .claude/commands/

.claude/commands/reproduce-bug.md14 lines · 1.2 KBFile
---
description: Turns a bug report into the smallest set of steps or a failing test and shows the actual failing output.
argument-hint: "<bug report text or ticket link>"
---

Reproduce this bug and prove it fails: $ARGUMENTS

1. Extract from the report: expected behavior, actual behavior, inputs, environment, version. List what is missing; guess nothing silently.
2. Find the code path involved and the existing tests nearest to it. Copy their setup style.
3. Write the smallest reproduction: a unit test is best, otherwise a script or exact command with sample input. Remove every step that is not needed, one at a time, and re-run to confirm it still fails.
4. Run it. Capture the real output, exit code and the line where it breaks. If it passes, vary one input at a time (empty values, large sizes, time zones, concurrency) and report what you tried.
5. Save the test under the project's test folder with a name that describes the bug, but mark nothing as skipped.

Report: reproduction steps (numbered), the command to run, the failing output verbatim, and your confidence that this is the reported bug. If you cannot reproduce it, say so plainly and list the next information to request. Do not fix the bug in this step.

What it does

A bug you cannot reproduce cannot be fixed with confidence. This command takes the report, strips it down to the minimum conditions and proves the failure by running it.

The result is either a small failing test or exact steps, plus the output as evidence.

Example

you › /reproduce-bug Invoices show the wrong total when a discount code and a refund are both applied

agent › Reproduced with tests/invoice.refund-discount.test.ts. Command: npm test -- invoice.refund. Failure: expected 42.50, received 45.00 at invoice.ts:118. Needs both a percent discount and a partial refund.

Questions

Does it fix the bug too?
No. It stops once the failure is proven, so the fix starts from a trustworthy test.
What if the bug will not reproduce?
You get the list of variations tried and the details to ask the reporter for.
  • Debug Error

    CommandWorkflow

    Free
  • Estimate Task

    CommandWorkflow

    Free
  • Explain Code

    CommandWorkflow

    Free
  • Plan Feature

    CommandWorkflow

    Free