diagnosing-bugs

Diagnose hard bugs and performance regressions through a structured six-phase feedback-loop workflow.

Updated May 19, 2026
One-click install
npx skills add https://github.com/wenyue/SmartKit --skill diagnosing-bugs-wenyue
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: diagnosing-bugs
Source: https://github.com/wenyue/SmartKit/tree/main/skills/diagnosing-bugs
Command: npx skills add https://github.com/wenyue/SmartKit --skill diagnosing-bugs-wenyue

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? Hard bugs and flaky performance regressions resist casual code reading; without a reproducible signal, developers guess at causes and apply fixes that don't stick. This Skill enforces a disciplined diagnosis loop that builds a tight, red-capable reproduction before any hypothesis is tested. ## Core Features & Use Cases - Feedback Loop Construction: Builds a fast, deterministic pass/fail signal using failing tests, curl scripts, CLI invocations, Playwright browser scripts, trace replays, fuzz loops, or git bisect harnesses. - Structured Six-Phase Process: Guides reproduction and minimization, ranked falsifiable hypothesis generation, one-variable-at-a-time instrumentation, regression-test-first fixing, and cleanup with post-mortem. - Human-in-the-Loop Fallback: Ships a bash template (scripts/hitl-loop.template.sh) that drives a human through manual reproduction steps and captures observations as parseable KEY=VALUE output. - Use Case: A user reports that the export button intermittently throws an error. The Skill builds a Playwright loop that reproduces the failure at a high rate, minimizes the scenario, tests ranked hypotheses with tagged debug logs, and lands a fix guarded by a regression test. ## Quick Start Ask the agent to diagnose the bug where the export button throws an error, and have it build a reproduction loop before proposing any fix.

Frequently Asked Questions about diagnosing-bugs

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I debug a bug that only happens sometimes?▼

For non-deterministic bugs, raise the reproduction rate instead of chasing a clean repro: loop the trigger 100 times, parallelize, add stress, and narrow timing windows. A 50%-flake bug is debuggable; keep increasing the rate until the failure is frequent enough to instrument.

How to reproduce a bug before fixing it?▼

Build a tight feedback loop first: a failing test, curl script, CLI invocation, or Playwright script that asserts the user's exact symptom and goes red on this bug. Then minimize the scenario by removing inputs and steps one at a time until every remaining element is load-bearing.

What is the best way to debug performance regressions?▼

For performance regressions, avoid log-based debugging. Establish a baseline measurement with a timing harness, performance.now(), a profiler, or a query plan, then bisect between known-good and known-bad states. Measure first, fix second.

Can I debug a bug that requires manual UI interaction?▼

Yes, use the human-in-the-loop bash template (scripts/hitl-loop.template.sh) as a last resort. It prompts the user through manual steps like signing in and clicking buttons, captures observations as KEY=VALUE output, and feeds them back to the agent for analysis.

Why should I write a regression test before the fix?▼

Writing the regression test first proves the test actually catches the bug by watching it fail before the fix and pass after. Only do this at a correct seam that exercises the real bug pattern; if no correct seam exists, that architectural gap is itself a finding to report.

When should I not use a hypothesis-driven debugging approach?▼

Do not proceed to hypotheses without a working feedback loop; guessing from code reading is the failure mode this process prevents. If you genuinely cannot build a loop, stop, list what you tried, and ask the user for environment access or a redacted captured artifact like a HAR file or log dump.