CC-301f · Module 1

Building Reproduction Steps

3 min read

A bug you cannot reproduce is a bug you cannot fix. Claude Code is remarkably effective at building reproduction steps because it can systematically test hypotheses faster than a human can. The workflow: describe the bug, let Claude propose a reproduction path, execute it, and refine. Claude generates test cases that isolate the failing behavior — a minimal script or test that triggers the bug without the complexity of the full application.

The key prompt pattern is: "This function returns X when given input Y, but it should return Z. Write a minimal test case that demonstrates the failure." Claude writes the test, runs it, confirms the failure, and now you have a reproducible bug. The test becomes the regression test after the fix — it serves double duty as both diagnostic tool and safety net.

// Bug: calculateDiscount returns 0 for premium users
// Ask Claude: "Write a test that reproduces this behavior"

test('premium user discount should be 15%', () => {
  const user = { tier: 'premium', tenure: 24 };
  const result = calculateDiscount(user, 100);
  // This fails — returns 0 instead of 15
  expect(result).toBe(15);
});