ported/20260305-085418/dev-tools/skills/bug-killer/SKILL.md
Systematic, hypothesis-driven debugging workflow with triage-based track routing. Use when asked to "fix this bug", "debug this", "why is this failing", "this is broken", "investigate this error", "track down this issue", or any debugging situation. Supports --deep flag to force full investigation.
npx skillsauth add sequenzia/agent-alchemy bug-killerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Execute a systematic debugging workflow that enforces investigation before fixes. Every bug gets a hypothesis journal, evidence gathering, and root cause confirmation before any code changes.
agents/bug-investigator.md) -- Executes diagnostic investigation tasks to test debugging hypotheses. Runs tests, traces execution, checks git history, and reports evidence. Used in Phase 3 (deep track).../../core-tools/skills/deep-analysis/agents/code-explorer.md from the core-tools package) -- Read-only exploration agent for investigating codebase areas related to the bug. Used in Phase 2 (deep track).Goal: Understand the bug, reproduce it, and decide the investigation track.
Extract from $ARGUMENTS and conversation context:
--deep is present, skip triage and go directly to deep track (jump to Phase 2 deep track)Attempt to reproduce before investigating:
# Run the specific test to confirm the failure
<test-runner> <test-file>::<test-name>
Capture the exact error output -- this is your primary evidence.
If the bug cannot be reproduced:
Based on the error message and context, form your first hypothesis:
### H1: [Title]
- Hypothesis: [What you think is causing the bug]
- Evidence for: [What supports this -- error message, stack trace, etc.]
- Evidence against: [Anything that contradicts it -- if none yet, say "None yet"]
- Test plan: [Specific steps to confirm or reject]
- Status: Pending
Quick-fix signals (ALL must be true):
Deep-track signals (ANY one triggers deep track):
Present your assessment. Prompt the user to choose:
Track escalation rule: If during quick track execution, 2 hypotheses are rejected, automatically escalate to deep track. Preserve all hypothesis journal entries when escalating.
Goal: Gather evidence systematically, guided by language-specific techniques.
Detect the primary language of the bug's context and load the appropriate reference:
| Language | Reference | |----------|-----------| | Python | See references/python-debugging.md for Python-specific debugging techniques | | TypeScript / JavaScript | See references/typescript-debugging.md for TypeScript-specific debugging techniques | | Other / Multiple | See the General Debugging Reference below |
Always also consult the General Debugging Reference as a supplement when using a language-specific reference.
For quick-track bugs, investigate directly:
git log --oneline -5 -- <file> for the affected filesProceed to Phase 3 (quick track).
For deep-track bugs, use parallel exploration agents:
Plan exploration areas -- identify 2-3 focus areas based on the bug:
Launch exploration agents:
This step uses the code-explorer agent from the deep-analysis skill in the core-tools package (see ../../core-tools/skills/deep-analysis/agents/code-explorer.md).
Spawn 2-3 exploration agents with distinct focus areas:
Prompt for each agent:
Bug context: [description of the bug and error]
Focus area: [specific area for this agent]
Investigate this focus area in relation to the bug:
- Find all relevant files
- Trace the execution/data path
- Identify where behavior diverges from expected
- Note any suspicious patterns, recent changes, or known issues
- Report structured findings
Launch agents in parallel for independent focus areas.
Synthesize exploration results:
Proceed to Phase 3 (deep track).
Goal: Confirm the root cause through systematic hypothesis testing.
For quick-track bugs:
Verify the hypothesis:
If confirmed (Status -> Confirmed):
If rejected (Status -> Rejected):
For deep-track bugs:
Prepare hypotheses for testing:
Launch investigator agents:
Delegate to 1-3 investigator agents (see agents/bug-investigator.md for instructions) to test hypotheses in parallel:
Prompt for each agent:
Bug context: [description of the bug and error]
Hypothesis to test: [specific hypothesis]
Test plan:
1. [Step 1 -- e.g., run this specific test with these arguments]
2. [Step 2 -- e.g., check git blame for this function]
3. [Step 3 -- e.g., trace the data from input to error site]
Report your findings with verdict (confirmed/rejected/inconclusive),
evidence, and recommendations.
Launch agents in parallel when they test independent hypotheses.
Evaluate results:
Update hypothesis journal with each agent's findings
If one hypothesis is confirmed, proceed to Phase 4
If all are rejected/inconclusive, apply 5 Whys technique:
Take the strongest "inconclusive" finding and ask "why?" iteratively:
Observed: [what actually happens]
Why? -> [first-level cause]
Why? -> [second-level cause]
Why? -> [root cause]
Form new hypotheses from 5 Whys analysis and repeat investigation
If stuck after 2 rounds of investigation:
Goal: Fix the root cause and prove the fix works.
Before writing any code:
Run the originally failing test -- it should now pass:
<test-runner> <test-file>::<test-name>
Run related tests -- tests in the same file and nearby test files:
<test-runner> <test-directory>
If tests fail:
Write a test that would have caught this bug:
Deep track only -- skip on quick track.
Load code-quality skill: Refer to the code-quality skill and review the fix against its principles.
Check for related issues:
Goal: Document the investigation trail and capture learnings.
Present to the user:
## Bug Fix Summary
### Bug
[One-line description of the bug]
### Root Cause
[What was actually wrong and why]
### Fix Applied
[What was changed, with file:line references]
### Tests
- [Originally failing test]: Now passing
- [Regression test added]: [test name and location]
- [Related tests]: All passing
### Track
[Quick / Deep] [Escalated from quick: Yes/No]
Present the complete hypothesis journal showing the investigation trail:
### Investigation Trail
#### H1: [Title]
- Status: Confirmed / Rejected
- [Key evidence summary]
#### H2: [Title] (if applicable)
- Status: Confirmed / Rejected
- [Key evidence summary]
[... additional hypotheses ...]
Refer to the project-learnings skill to evaluate whether this bug reveals project-specific knowledge worth capturing.
Follow its workflow to evaluate the finding. Common debugging discoveries that qualify:
Deep track only:
If the investigation revealed broader concerns, present recommendations:
Prompt the user to choose:
The hypothesis journal is the core artifact of this workflow. Maintain it throughout all phases.
## Hypothesis Journal -- [Bug Title]
### H1: [Descriptive Title]
- **Hypothesis:** [What's causing the bug -- be specific]
- **Evidence for:** [Supporting observations with file:line references]
- **Evidence against:** [Contradicting observations]
- **Test plan:** [Concrete steps to confirm or reject]
- **Status:** Pending / Confirmed / Rejected
- **Notes:** [Additional context, timestamps, agent findings]
### H2: [Descriptive Title]
[Same format]
| Aspect | Quick Track | Deep Track | |--------|-------------|------------| | Investigation | Read error location + 1-2 callers | 2-3 exploration agents in parallel | | Hypotheses | Minimum 1 | Minimum 2-3 | | Root cause testing | Manual verification | 1-3 investigator agents in parallel | | Fix validation | Run failing + related tests | Tests + code-quality skill + related issue scan | | Auto-escalation | After 2 rejected hypotheses | N/A | | Typical complexity | Off-by-one, typo, wrong argument, missing null check | Race condition, state corruption, multi-file logic error |
If any phase fails:
Language-agnostic debugging strategies, systematic investigation methods, and common bug categories.
Narrow the problem space by half at each step:
Works for: data transformation pipelines, middleware chains, multi-step processes.
Automate binary search through commit history:
git bisect start
git bisect bad # current commit is broken
git bisect good <known-good-sha> # this commit was working
# Automated: let a test command drive the search
git bisect run <test-command> # returns 0 = good, non-0 = bad
git bisect reset # when done
Best for: regressions where you know "it used to work."
Minimize the input that triggers the bug:
Works for: large inputs, complex configurations, test case reduction.
Explain the problem out loud (or in writing), step by step:
Drill past symptoms to root causes:
Bug: Users see a 500 error on checkout
Why? -> The payment API call throws a timeout
Why? -> The request takes >30 seconds
Why? -> The order total calculation is O(n^2)
Why? -> It recalculates item prices for each item pair
Why? -> The discount logic compares every item against every other item
Root cause: Quadratic discount calculation algorithm
Stop when the answer is something you can directly fix.
| Element | What It Tells You | |---------|-------------------| | Error type/name | Category of failure (null access, type mismatch, etc.) | | Error message | Specific details about what went wrong | | File path + line number | Where the error was thrown | | Function/method name | What was executing when it failed | | Frame ordering | The call chain that led to the error |
Symptoms: Missing first/last element, array index out of bounds, fencepost errors.
Check for:
< vs <= in loop conditionsSymptoms: Null reference exceptions, "undefined is not a function," AttributeError.
Check for:
Symptoms: Intermittent failures, works in debugger but fails normally, order-dependent results.
Check for:
Symptoms: Slow degradation, eventual crashes, "too many open files," memory growth.
Check for:
close() / with / using)Symptoms: Inconsistent data, works sometimes but not always, cascade of errors after a specific action.
Check for:
Log at decision points and data boundaries:
[ENTRY] function_name called with: key_arg=value
[BRANCH] taking path X because condition=value
[DATA] received from external: summary_of_data
[EXIT] function_name returning: summary_of_result
| Anti-Pattern | Problem | Better Approach | |-------------|---------|-----------------| | Logging everything | Noise hides signal | Log at boundaries and decision points | | Logging sensitive data | Security risk | Redact or hash sensitive fields | | Logging inside tight loops | Performance impact, massive output | Log summary after loop, or sample every Nth iteration | | Logging without context | "Error occurred" is useless | Include function name, key parameters, state | | Leaving debug logs in code | Clutters production output | Use conditional debug level, remove before commit |
Before proposing a fix, verify you can answer:
development
Systematic, hypothesis-driven debugging workflow with triage-based track routing. Use when asked to "fix this bug", "debug this", "why is this failing", "this is broken", "investigate this error", "track down this issue", or any debugging situation. Supports --deep flag to force full investigation.
development
Executes diagnostic investigation tasks to test debugging hypotheses. Runs tests, traces execution, checks git history, and reports evidence. (converted from agent)
content-media
Provides architectural pattern knowledge for designing feature implementations including MVC, event-driven, microservices, and CQRS patterns. Use when designing system architecture or choosing implementation patterns.
documentation
Provides Mermaid diagram syntax, best practices, and styling rules for technical visualizations. Use when creating diagrams, flowcharts, sequence diagrams, class diagrams, state diagrams, ER diagrams, architecture diagrams, C4 diagrams, or any visual documentation in markdown.