一键导入
bug-hunt
Investigate suspected bugs with git archaeology and root cause analysis. Triggers: "bug", "broken", "doesn't work", "failing", "investigate bug".
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Investigate suspected bugs with git archaeology and root cause analysis. Triggers: "bug", "broken", "doesn't work", "failing", "investigate bug".
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
This skill should be used when the user asks to "track issues", "create beads issue", "show blockers", "what's ready to work on", "beads routing", "prefix routing", "cross-rig beads", "BEADS_DIR", "two-level beads", "town vs rig beads", "slingable beads", or needs guidance on git-based issue tracking with the bd CLI.
Analyze code complexity and find refactor targets using radon/gocyclo. Triggers: "complexity", "analyze complexity", "find complex code", "refactor targets", "cyclomatic complexity", "code metrics".
Fully autonomous epic execution. Runs until ALL children are CLOSED. Level 1 uses /swarm (Task tool). Level 2 uses /spawn + Agent Mail for cross-session orchestration with Chiron help routing. NO human prompts, NO stopping.
This skill should be used when the user asks to "generate documentation", "validate docs", "check doc coverage", "find missing docs", "create code-map", "sync documentation", "update docs", or needs guidance on documentation generation and validation for any repository type. Triggers: doc, documentation, code-map, doc coverage, validate docs.
Extract decisions and learnings from Claude session transcripts. Triggers: "extract learnings", "process pending", SessionStart hook.
Knowledge flywheel health monitoring. Checks velocity, pool depths, staleness. Triggers: "flywheel status", "knowledge health", "is knowledge compounding".
| name | bug-hunt |
| description | Investigate suspected bugs with git archaeology and root cause analysis. Triggers: "bug", "broken", "doesn't work", "failing", "investigate bug". |
Quick Ref: 4-phase investigation (Root Cause → Pattern → Hypothesis → Fix). Output:
.agents/research/YYYY-MM-DD-bug-*.md
YOU MUST EXECUTE THIS WORKFLOW. Do not just describe it.
Systematic investigation to find root cause and design a complete fix.
Requires:
.agents/ directories for output)| Phase | Focus | Output |
|---|---|---|
| 1. Root Cause | Find the actual bug location | file:line, commit |
| 2. Pattern | Compare against working examples | Differences identified |
| 3. Hypothesis | Form and test single hypothesis | Pass/fail for each |
| 4. Implementation | Fix at root, not symptoms | Verified fix |
Track failures by TYPE - not all failures are equal:
| Failure Type | Counts Toward Limit? | Action |
|---|---|---|
root_cause_not_found | YES | Re-investigate from Phase 1 |
fix_failed_tests | YES | New hypothesis in Phase 3 |
design_rejected | YES | Rethink approach |
execution_timeout | NO (reset counter) | Retry same approach |
external_dependency | NO (escalate) | Report blocker |
The 3-Failure Rule:
root_cause_not_found, fix_failed_tests, design_rejectedTrack in issue notes:
bd update <issue-id> --append-notes "FAILURE: <type> at $(date -Iseconds) - <reason>" 2>/dev/null
Given /bug-hunt <symptom>:
First, reproduce the issue:
Read error messages carefully. Do not skip or skim them.
If the bug can't be reproduced, gather more information before proceeding.
Find where the bug manifests:
# Search for error messages
grep -r "<error-text>" . --include="*.py" --include="*.ts" --include="*.go" 2>/dev/null | head -10
# Search for function/variable names
grep -r "<relevant-name>" . --include="*.py" --include="*.ts" --include="*.go" 2>/dev/null | head -10
Find when/how the bug was introduced:
# When was the file last changed?
git log --oneline -10 -- <file>
# What changed recently?
git diff HEAD~10 -- <file>
# Who changed it and why?
git blame <file> | grep -A2 -B2 "<suspicious-line>"
# Search for related commits
git log --oneline --grep="<keyword>" | head -10
USE THE TASK TOOL to explore the code:
Tool: Task
Parameters:
subagent_type: "Explore"
description: "Trace bug execution path"
prompt: |
Trace the execution path for: <symptom>
1. Find the entry point where the bug manifests
2. Trace backward to find where bad data/state originates
3. Identify all functions in the path
4. Look for recent changes to these functions
Return:
- Execution path (function call chain)
- Likely location of root cause
- Recent changes that might be responsible
Based on tracing, identify:
Search the codebase for similar functionality that WORKS:
# Find similar patterns
grep -r "<working-pattern>" . --include="*.py" --include="*.ts" --include="*.go" 2>/dev/null | head -10
Identify ALL differences between:
Document each difference.
State your hypothesis clearly:
"I think X is wrong because Y"
One hypothesis at a time. Do not combine multiple guesses.
Make the SMALLEST possible change to test the hypothesis:
# Count failures (excluding timeouts and external blockers)
failures=$(bd show <issue-id> --json 2>/dev/null | jq '[.notes[]? | select(startswith("FAILURE:")) | select(contains("root_cause") or contains("fix_failed") or contains("design_rejected"))] | length')
if [[ "$failures" -ge 3 ]]; then
echo "3+ fix attempts failed. Escalating to architecture review."
bd update <issue-id> --append-notes "ESCALATION: Architecture review needed after 3 failures" 2>/dev/null
exit 1
fi
Before writing code, design the fix:
Write a test that demonstrates the bug BEFORE fixing it.
Fix at the ROOT CAUSE, not at symptoms.
Run the failing test - it should now pass.
Write to: .agents/research/YYYY-MM-DD-bug-<slug>.md
# Bug Report: <Short Description>
**Date:** YYYY-MM-DD
**Severity:** <critical|high|medium|low>
**Status:** <investigating|root-cause-found|fix-designed>
## Symptom
<What the user sees>
## Expected Behavior
<What should happen>
## Reproduction Steps
1. <step 1>
2. <step 2>
3. <observe bug>
## Root Cause Analysis
### Location
- **File:** <path>
- **Line:** <line number>
- **Function:** <function name>
### Cause
<Explanation of what's wrong>
### When Introduced
- **Commit:** <hash>
- **Date:** <date>
- **Author:** <author>
## Proposed Fix
### Changes Required
1. <change 1>
2. <change 2>
### Risks
- <potential risk>
### Tests Needed
- <test to add/update>
## Related
- <related issues or PRs>
Tell the user:
Common bug patterns to check: