Skip to catalogue

minimal reproduction

The smallest repeatable case that still shows the bug.

Use this when A bug report says something is broken but cannot show how.

without the term

“A user says checkout is broken sometimes but I can't see it. Before you change anything, can you figure out exactly what steps make it break, and make the smallest version that still breaks?”

with the term · How do you ask a model for minimal reproduction?

Create a minimal reproduction for this bug. Record the input, expected result, and actual result before changing the implementation.

XBlueskyLinkedIn

What is minimal reproduction?

A minimal reproduction isolates the triggering input, necessary setup, and observed failure.

Why does minimal reproduction matter when vibe coding?

An agent can otherwise change code without reproducing the reported problem.

How do you do minimal reproduction?

Remove unrelated setup until the failure is small and repeatable. Check it from a clean starting state.

What goes wrong with minimal reproduction?

Removing the condition that causes the failure produces a different test case.

Before and after

A report says the last item disappears from every page of results. Reduce it to an array with one item and a requested page size of one. The expected result is that one item; the actual result is an empty array.

Before

The slice end subtracts one even though JavaScript excludes the end index already. The smallest input reveals the mismatch without a router, UI, network request, or large fixture.

function before(items, start, size) {
  return items.slice(start, start + size - 1);
}

After

Write the failing assertion before changing the endpoint. Use start + size as the exclusive end. Keep the minimal case as a regression check and add a partial last page to cover the neighboring boundary.

function after(items, start, size) {
  return items.slice(start, start + size);
}

Check the change

The exact one-item input returns [] before and [book] afterward. The comparison captures the original assertion failure and checks a full first page, a partial final page, and an empty list.

Save the runnable comparison, then run node --test repro.mjs with Node.js 22.12 or later.

Download the complete teaching example: the bug, prompt, runnable code, expected result, limits, and sources, linked back to this page.

Show the assertions
test('one item and a page size of one reproduce the report', () => {
  const actual = before(['book'], 0, 1);
  assert.deepEqual(actual, []);
  assert.throws(() => assert.deepEqual(actual, ['book']), { code: 'ERR_ASSERTION' });
});

test('the fix keeps the minimal case and neighboring boundaries', () => {
  assert.deepEqual(after(['book'], 0, 1), ['book']);
  assert.deepEqual(after(['a', 'b', 'c'], 0, 2), ['a', 'b']);
  assert.deepEqual(after(['a', 'b', 'c'], 2, 2), ['c']);
  assert.deepEqual(after([], 0, 1), []);
});

When this is not enough

A minimal reproduction must still retain the cause. Do not remove the concurrency, permissions, version, or environment that triggers the real bug just to make the example smaller. This example assumes nonnegative integer start and size values; it does not define API validation or pagination across a changing dataset. Record the command and runtime alongside the input.

The next decision

  • test-driven development: Turn the observed failure into a regression assertion before fixing it.
  • test isolation: Include execution order and shared resources when the failure appears only in a suite.

Sources and verification

Sources checked . These are illustrative examples with automated checks. How we check content.

Did this help with your task?

After trying the prompt or check, tell us what happened. This optional response records only your choice and this term.

Choose between related terms

adjacent

Expanded example updated .

Historical short-entry review

report a correction