From workflows
Four-phase root cause analysis for bug investigation. Activates when debugging unexpected behavior, failing tests, or production issues — follows reproduce, isolate, analyze, fix with defense-in-depth. Uses condition-based waiting instead of arbitrary delays. Available anytime, not tied to the inner loop sequence.
npx claudepluginhub brite-nites/brite-claude-plugins --plugin workflowsThis skill uses the workspace's default tool permissions.
<!-- AUTO-GENERATED from SKILL.md.tmpl — do not edit directly -->
Provides Ktor server patterns for routing DSL, plugins (auth, CORS, serialization), Koin DI, WebSockets, services, and testApplication testing.
Conducts multi-source web research with firecrawl and exa MCPs: searches, scrapes pages, synthesizes cited reports. For deep dives, competitive analysis, tech evaluations, or due diligence.
Provides demand forecasting, safety stock optimization, replenishment planning, and promotional lift estimation for multi-location retailers managing 300-800 SKUs.
You are investigating a bug using a structured four-phase process. The goal is to find and fix the root cause, not just suppress the symptom.
After activation, print the banner (see _shared/observability.md):
---
**Systematic Debugging** activated
Trigger: [describe the symptom in your own words — e.g., "test failure in auth flow" or "unexpected 500 on endpoint"]
Produces: root cause analysis, regression test, fix
---
Narrate: Phase 1/4: Reproducing the problem...
Before anything else, reliably reproduce the problem.
## Reproduction
Steps: [exact steps]
Expected: [what should happen]
Actual: [what happens instead]
Frequency: [always / intermittent / specific conditions]
Environment: [OS, Node version, browser, etc.]
If reproduction fails after reasonable effort, use error recovery (see _shared/observability.md). AskUserQuestion with options: "Add more logging and retry / Get more info from reporter / Proceed with best guess (risky)."
Narrate: Phase 1/4: Reproducing the problem... done
Narrate: Phase 2/4: Isolating the bug...
Narrow down where the bug lives.
git bisect start, git bisect bad, git bisect good [known-good-commit]console.log everywhere)assert statements at key points to catch violations## Isolation
Location: [file:line or module]
Narrowed from: [original scope] → [isolated location]
Method: [how you narrowed it down]
Narrate: Phase 2/4: Isolating the bug... done
Narrate: Phase 3/4: Analyzing root cause...
Understand why the bug exists, not just where.
Log the root cause decision (see _shared/observability.md Decision Log format):
Decision: Root cause is [category] — [specific cause] Reason: [evidence from isolation phase] Alternatives: [other hypotheses that were ruled out]
After identifying the root cause, ask:
## Root Cause
Cause: [precise description]
Category: [logic / state / integration / environment / missing handling]
Why it wasn't caught: [gap in testing, types, or review]
Related risks: [other places with similar patterns]
Narrate: Phase 3/4: Analyzing root cause... done
Narrate: Phase 4/4: Applying fix...
Fix the root cause and prevent regression.
Log defense-in-depth decisions:
Decision: [which defense-in-depth measures to add] Reason: [what class of bug this prevents] Alternatives: [other measures considered]
Beyond the immediate fix, consider:
If the bug involves timing or async behavior:
sleep 5, setTimeout(5000))sleep 2 && check_result, use i=0; while ! check_result && [ $i -lt 100 ]; do sleep 0.1; i=$((i+1)); done## Fix
Change: [what was changed and why]
Files: [list of modified files]
Test: [the regression test that was added]
Defense: [additional protective measures added]
Related fixes: [similar patterns fixed elsewhere, or "none"]
Narrate: Phase 4/4: Applying fix... done
Present the full debugging report:
**Debugging summary.**
Root cause: [one-line root cause]
Fix: [one-line fix description]
Bug: [one-line description]
Reproduction → Isolation → Analysis → Fix
[Link to each section above]
Regression test: [test name and how to run it]
Tests: All passing
Build: Clean
After the completion report, print this completion marker exactly:
**Debugging complete.**
Artifacts:
- Regression test: [test file path]
- Files changed: [list]
- Defense-in-depth: [additions, or "none"]
Compound learning: [If this revealed a pattern, it should be captured via compound-learnings]
Returning to the calling workflow.
console.log — add targeted, informative logging