PromptShop

Reproduce Bug

This skill provides a structured approach to reproduce bugs reported in Linear tickets and create failing regression tests. It guides the user through parsin...

Install

npx promptshop add reproduce-bug

Details

What This Skill Does

This skill provides a structured approach to reproduce bugs reported in Linear tickets and create failing regression tests. It guides the user through parsing ticket information, routing to the appropriate test strategy based on the affected area, locating relevant source files, and tracing the code execution path. This is useful for software engineers and QA to efficiently address and fix bugs.

When to Use

  • Given a bug report, create a reproducible test case.
  • When a bug is reported, identify the affected code area.
  • Reproduce a bug to verify a fix.
  • Create a regression test to prevent future occurrences.
  • Parse error messages and stack traces from bug reports.
  • Trace the code path to understand the root cause of a bug.

Key Features

  • Parses bug reports to extract key information.
  • Routes to the correct test layer based on the affected area.
  • Provides a table of test strategies for different areas.
  • Helps locate source files related to the bug.
  • Guides the user through tracing the code execution path.
  • Suggests using git history to find recent changes.

Given a Linear ticket context ($ARGUMENTS), systematically reproduce the bug

with a failing regression test.

Step 1: Parse Signals

Extract the following from the provided ticket context: Error message / stack trace (if provided) Reproduction steps (if provided) Workflow JSON (if attached) Affected area (node, execution engine, editor, API, config, etc.) Version where it broke / last working version

Step 2: Route to Test Strategy

Based on the affected area, pick the test layer and pattern:

AreaTest LayerPatternKey Location
Node operationJest unitNode Test Harness + nockpackages/nodes-base/nodes/*/test/
Node credentialJest unitjest-mock-extendedpackages/nodes-base/nodes/*/test/
Trigger webhookJest unitmock IHook Functions + jest.mock Generic Functionspackages/nodes-base/nodes/*/test/
Binary dataJest unitNode Test Harness assert Binary Datapackages/core/nodes-testing/
Execution engineJest integrationWorkflow Runner + DI containerpackages/cli/src/tests/
CLI / APIJest integrationsetup Test Server + supertestpackages/cli/test/integration/
ConfigJest unitGlobal Config + Containerpackages/@n8n/config/src/tests/
Editor UIVitestVue Test Utils + Piniapackages/frontend/editor-ui/src/**/tests/
E2E / CanvasPlaywrightTest containers + composablespackages/testing/playwright/

Step 3: Locate Source Files

Find the source code for the affected area: Search for the node/service/component mentioned in the ticket Find the Generic Functions file (common bug location for nodes) Check for existing test files in the same area Look at recent git history on affected files (git log --oneline -10 -- )

Step 4: Trace the Code Path

Read the source code and trace the execution path that triggers the bug: Follow the call chain from entry point to the failure Identify the specific line(s) where the bug manifests Note any error handling (or lack thereof) around the bug

Step 5: Form Hypothesis

State a clear, testable hypothesis: "When [input/condition], the code does [wrong thing] because [root cause]" Identify the exact line(s) that need to change Predict what the test output will show

Step 6: Find Test Patterns

Look for existing tests in the same area: Check test/ directories near the affected code Identify which mock/setup patterns they use Use the same patterns for consistency If no tests exist, find the closest similar node/service tests as a template

Step 7: Write Failing Test

Write a regression test that: Uses the patterns found in Step 6 Targets the specific hypothesis from Step 5 Includes a comment referencing the ticket ID Asserts the CORRECT behavior (test will fail on current code) Also includes a "happy path" test to prove the setup works

Step 8: Run and Score

Run the test from the package directory (e.g., cd packages/nodes-base && pnpm test ).

Classify the result:

ConfidenceCriteriaOutput
CONFIRMEDTest fails consistently, failure matches hypothesisReproduction Report
LIKELYTest fails but failure mode differs slightlyReport + caveat
UNCONFIRMEDCannot trigger the failureReport: what was tried
SKIPPEDHit a hard bailout triggerReport: why skipped
ALREADY_FIXEDBug no longer reproduces on current codeReport: when fixed

Step 9: Iterate or Bail

If UNCONFIRMED after first attempt: Revisit hypothesis — re-read the code path Try a different test approach or layer Maximum 3 attempts before declaring UNCONFIRMED

Hard bailout triggers (stop immediately): Requires real third-party API credentials Race condition / timing-dependent Requires specific cloud/enterprise infrastructure Requires manual UI interaction that can't be scripted

Output: Reproduction Report

Present findings in this format:

Ticket: [ID] — [title] Confidence: [CONFIRMED | LIKELY | UNCONFIRMED | SKIPPED | ALREADY_FIXED]

Root Cause

[1-2 sentences explaining the bug mechanism]

Location

FileLinesIssue
path/to/file.tsXX-YYDescription of the problem

Failing Test

path/to/test/file.test.ts — X/Y tests fail: test name — [failure description]

Fix Hint

[Pseudocode or description of the fix approach]

Important

DO NOT fix the bug — only reproduce it with a failing test Leave test files in place as evidence (don't commit unless asked) Run tests from the package directory (e.g., pushd packages/nodes-base && pnpm test && popd) Always redirect build output: pnpm build > build.log 2>&1 DO NOT look at existing fix PRs — the goal is to reproduce from signals alone Bug Reproduction Framework

Given a Linear ticket context ($ARGUMENTS), systematically reproduce the bug with a failing regression test.

Step 1: Parse Signals

Extract the following from the provided ticket context: Error message / stack trace (if provided) Reproduction steps (if provided) Workflow JSON (if attached) Affected area (node, execution engine, editor, API, config, etc.) Version where it broke / last working version

Step 2: Route to Test Strategy

Based on the affected area, pick the test layer and pattern:

AreaTest LayerPatternKey Location
Node operationJest unitNode Test Harness + nockpackages/nodes-base/nodes/*/test/
Node credentialJest unitjest-mock-extendedpackages/nodes-base/nodes/*/test/
Trigger webhookJest unitmock IHook Functions + jest.mock Generic Functionspackages/nodes-base/nodes/*/test/
Binary dataJest unitNode Test Harness assert Binary Datapackages/core/nodes-testing/
Execution engineJest integrationWorkflow Runner + DI containerpackages/cli/src/tests/
CLI / APIJest integrationsetup Test Server + supertestpackages/cli/test/integration/
ConfigJest unitGlobal Config + Containerpackages/@n8n/config/src/tests/
Editor UIVitestVue Test Utils + Piniapackages/frontend/editor-ui/src/**/tests/
E2E / CanvasPlaywrightTest containers + composablespackages/testing/playwright/

Step 3: Locate Source Files

Find the source code for the affected area: Search for the node/service/component mentioned in the ticket Find the Generic Functions file (common bug location for nodes) Check for existing test files in the same area Look at recent git history on affected files (git log --oneline -10 -- )

Step 4: Trace the Code Path

Read the source code and trace the execution path that triggers the bug: Follow the call chain from entry point to the failure Identify the specific line(s) where the bug manif