Skip to content

Engineering · For your bots

Reproduce a bug before fixing it

Fix a bug by reproducing it first: turn the report into a failing test or script, shrink it, make the smallest fix, and show the test pass.

In Lobstack: Skills › Library › Add

Download Lobstack

When to use it

A bug report, error trace or wrong behaviour needs fixing in a repository you can run.

What your bot will do

  1. 01

    Write the expected and the actual behaviour in one line each. If the report does not say, ask rather than guess.

  2. 02

    Reproduce it before touching the code: a failing test in the project's own suite if you can, a short script if you cannot. Run it and show it fails for the reported reason, not some other one.

  3. 03

    Shrink the case. Remove inputs and steps until removing anything more makes it pass. The smallest failing case usually points straight at the cause.

  4. 04

    Find the cause, not the place it showed up. Say which line is wrong and why, and look for the same mistake elsewhere.

  5. 05

    Make the smallest change that fixes the cause. Tidying goes in a separate change.

  6. 06

    Run the new test and the rest of the suite, and show both results.

  7. 07

    Work on a branch. Ask before pushing or opening a pull request, and never push to the default branch.

If you cannot reproduce it, say so plainly and list what you tried. A fix for a bug you never saw fail is a guess.

The file

bug-reproduction/SKILL.md33 lines
---name: bug-reproductiondescription: "Fix a bug by reproducing it first: turn the report into a failing test or script, shrink it, make the smallest fix, and show the test pass."metadata:  title: "Reproduce a bug before fixing it"  category: engineering  tags: [debugging, testing]--- ## When to use this A bug report, error trace or wrong behaviour needs fixing in a repository youcan run. ## How 1. Write the expected and the actual behaviour in one line each. If the report   does not say, ask rather than guess.2. Reproduce it before touching the code: a failing test in the project's own   suite if you can, a short script if you cannot. Run it and show it fails for   the reported reason, not some other one.3. Shrink the case. Remove inputs and steps until removing anything more makes   it pass. The smallest failing case usually points straight at the cause.4. Find the cause, not the place it showed up. Say which line is wrong and why,   and look for the same mistake elsewhere.5. Make the smallest change that fixes the cause. Tidying goes in a separate   change.6. Run the new test and the rest of the suite, and show both results.7. Work on a branch. Ask before pushing or opening a pull request, and never push   to the default branch. If you cannot reproduce it, say so plainly and list what you tried. A fix for abug you never saw fail is a guess.

Get Lobstack.