agentleFS
goca-segoca-se/dotcontext/.claude/skills/bug-reproduction/SKILL.md

bug-reproduction

Skill9 starsChanged 4 months agoMITView on GitHub

Reproduce a bug with a failing test before fixing it. Use when investigating a bug, working a bug report or issue, or before attempting any fix — always reproduce first. Pairs with the /fix-bug workflow.

We split this skill into the rules it gives an agent

26 rules. About 0 are common, 24 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈24

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before attempting ANY fix — always reproduce first

    line 14
  2. Very specific:

    When using the /fix-bug command

    line 15
  3. Distinctive:

    Read the bug description carefully.

    line 27
  4. Distinctive:

    Trigger conditions: When does it occur? (specific input, state, timing)

    line 30
  5. Distinctive:

    Check for additional context:

    line 32
  6. Distinctive:

    Search for the affected code path:

    line 39
  7. Distinctive:

    Read the code and trace the execution path from trigger to failure.

    line 52
  8. Distinctive:

    Write a test that:

    line 56
  9. Distinctive:

    Run the test and confirm it fails:

    line 76
  10. Distinctive:

    Check that the test fails for the RIGHT reason:

    line 83
  11. Distinctive:

    If the test passes, the bug is not reproduced — revisit Step 1

    line 86
  12. Distinctive:

    After implementing the fix:

    line 90
  13. Distinctive:

    Run the reproduction test — it should now PASS

    line 91
  14. Distinctive:

    Run the full test suite — no regressions

    line 92
  15. Distinctive:

    Don't mock the bug away — test the real code path

    line 104
  16. Distinctive:

    Don't write a test that passes — it must FAIL first

    line 105
  17. Distinctive:

    Don't fix the bug before writing the test

    line 106
  18. Distinctive:

    Don't write overly broad tests — isolate the specific bug

    line 107
  19. Distinctive:

    Don't skip running the test before fixing — you need to SEE it fail

    line 108
  20. Distinctive:

    Don't assume the first failure is the right failure — verify the error relates to the bug

    line 109
  21. Distinctive:

    When the bug involves UI behavior that can't easily be unit tested, create a test plan document:

    line 115
  22. Distinctive:

    Prefer screenshots over selector-based assertions (less fragile)

    line 136
  23. Distinctive:

    Run browser checks in subagents for isolation

    line 137
  24. Distinctive:

    Document visual references with file paths

    line 138
  25. Very specific:

    CLI bugs: Run dotcontext init or dotcontext update --templates in a temp directory and check output

    line 149
  26. Distinctive:

    Template bugs: Check that files are downloaded correctly and contain expected content

    line 151

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Skill: Bug Reproduction

When to Use

  • You encounter a bug that needs fixing
  • You're working on a bug report or issue
  • Before attempting ANY fix — always reproduce first
  • When using the /fix-bug command

Test Framework

  • Framework: Manual testing + shellcheck (bash CLI project, no unit test framework)
  • Run command: bash -n dotcontext (syntax check), shellcheck dotcontext (lint)
  • Test directory: N/A — testing is manual via dotcontext init in a temp directory

How to Reproduce a Bug

Step 1: Understand the Bug

Read the bug description carefully. Identify:

  • Expected behavior: What should happen?
  • Actual behavior: What happens instead?
  • Trigger conditions: When does it occur? (specific input, state, timing)

Check for additional context:

  • Error logs or stack traces
  • Screenshots or recordings
  • Related GitHub issues or PRs

Step 2: Locate the Code

Search for the affected code path:

# Search by error message
grep -r "error message text" src/

# Search by function/method name
grep -r "functionName" src/

# Search by route/endpoint
grep -r "/api/endpoint" src/

Read the code and trace the execution path from trigger to failure.

Step 3: Write a Failing Test

Write a test that:

  1. Sets up the conditions that trigger the bug
  2. Performs the action that causes the failure
  3. Asserts the EXPECTED (correct) behavior

The test must FAIL — proving the bug exists.

# Example pattern (adapt to your framework):
describe("bug: [short description]") {
  it("should [expected behavior] when [condition]") {
    // Arrange: set up the conditions
    // Act: perform the action that triggers the bug
    // Assert: check for correct behavior (this should FAIL)
  }
}

Step 4: Verify the Failure

Run the test and confirm it fails:

# Run the specific test
[test command] [test file]

Check that the test fails for the RIGHT reason:

  • The assertion should fail because of the bug, not because of a typo in the test
  • The error message should relate to the actual bug behavior
  • If the test passes, the bug is not reproduced — revisit Step 1

Step 5: Fix and Verify

After implementing the fix:

  1. Run the reproduction test — it should now PASS
  2. Run the full test suite — no regressions
# Run reproduction test
[test command] [test file]

# Run full suite
[test command]

Anti-Patterns

  • Don't mock the bug away — test the real code path
  • Don't write a test that passes — it must FAIL first
  • Don't fix the bug before writing the test
  • Don't write overly broad tests — isolate the specific bug
  • Don't skip running the test before fixing — you need to SEE it fail
  • Don't assume the first failure is the right failure — verify the error relates to the bug

UI Bugs

Markdown Test Plans

When the bug involves UI behavior that can't easily be unit tested, create a test plan document:

## Test Plan: [Bug Description]

### Steps to Reproduce
1. Navigate to [URL/page]
2. [Action 1]
3. [Action 2]
4. Expected: [what should happen]
5. Actual: [what happens instead]

### Validation Method
- [ ] Screenshot comparison
- [ ] DOM element assertion
- [ ] Network request validation
- [ ] Console error check

Browser Validation

  • Prefer screenshots over selector-based assertions (less fragile)
  • Run browser checks in subagents for isolation
  • Document visual references with file paths

E2E Test Patterns

  • E2E Framework: N/A (CLI tool — test via manual invocation)
  • Run command: dotcontext init --yes --no-setup in a temp directory
  • Test directory: N/A

Examples from This Codebase

This project is a bash CLI with markdown command templates. Bug reproduction involves:

  • CLI bugs: Run dotcontext init or dotcontext update --templates in a temp directory and check output
  • Command template bugs: Invoke the slash command in Claude Code and verify behavior
  • Template bugs: Check that files are downloaded correctly and contain expected content
  • Syntax validation: bash -n dotcontext catches syntax errors

Download now (ZIP)

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. DodoraApp/DodoStream★ 243same name
    2. petrkindlmann/qa-skills★ 209same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository7 other files it gives its agents.

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.