bug-hunt▌
boshu2/agentops · updated Apr 8, 2026
MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.
Quick Ref: 4-phase investigation (Root Cause → Pattern → Hypothesis → Fix). Output: .agents/research/YYYY-MM-DD-bug-*.md
Bug Hunt Skill
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 — or proactive audit to find hidden bugs before they bite.
Requires:
- session-start.sh has executed (creates
.agents/directories for output) - bd CLI (beads) for issue tracking if creating follow-up issues
Modes
| Mode | Invocation | When |
|---|---|---|
| Investigation | /bug-hunt <symptom> |
You have a known bug or failure |
| Audit | /bug-hunt --audit <scope> |
Proactive sweep for hidden bugs |
Investigation mode uses the 4-phase structure below. Audit mode uses systematic read-and-classify — see Audit Mode.
The 4-Phase Structure (Investigation Mode)
| 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 |
For failure category taxonomy and the 3-failure rule, read skills/bug-hunt/references/failure-categories.md.
Execution Steps
Given /bug-hunt <symptom>:
Step 0: Load Prior Bug Context
Before investigating, check for prior learnings about this area of the codebase:
if command -v ao &>/dev/null; then
ao lookup --query "<symptom-keywords> bug patterns" --limit 3 2>/dev/null || true
fi
Apply retrieved knowledge: If learnings are returned, check each for applicability to the current bug. For applicable learnings (e.g., prior bugs in same area, known fragile patterns), include as investigation leads and cite by filename. Record: ao metrics cite "<path>" --type applied 2>/dev/null || true
Prior bug reports, fix patterns, and known fragile areas reduce investigation time.
Phase 1: Root Cause Investigation
Step 1.1: Confirm the Bug
First, reproduce the issue:
- What's the expected behavior?
- What's the actual behavior?
- Can you reproduce it consistently?
Read error messages carefully. Do not skip or skim them.
If the bug can't be reproduced, gather more information before proceeding.
Step 1.2: Locate the Symptom
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
Step 1.3: Git Archaeology
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
Step 1.4: Trace the Execution Path
USE THE TASK TOOL (subagent_type: "Explore") to trace the execution path:
- Find the entry point where the bug manifests
- Trace backward to find where bad data/state originates
- Identify all functions in the path and recent changes to them
- Return: execution path, likely root cause location, responsible changes
Step 1.5: Identify Root Cause
Based on tracing, identify:
- What is wrong (the actual bug)
- Where it is (file:line)
- When it was introduced (commit)
- Why it happens (the logic error)
Phase 2: Pattern Analysis
Step 2.1: Find Working Examples
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
Step 2.2: Compare Against Reference
Identify ALL differences between:
- The broken code
- The working reference
Document each difference.
Phase 3: Hypothesis and Testing
Step 3.1: Form Single Hypothesis
State your hypothesis clearly:
"I think X is wrong because Y"
One hypothesis at a time. Do not combine multiple guesses.
Step 3.2: Test with Smallest Change
Make the SMALLEST possible change to test the hypothesis:
- If it works → proceed to Phase 4
- If it fails → record failure, form NEW hypothesis
Step 3.3: Check Failure Counter
Check failure count per skills/bug-hunt/references/failure-categories.md. After 3 countable failures, escalate to architecture review.
Phase 4: Implementation
Step 4.1: Design the Fix
Before writing code, design the fix:
- What needs to change?
- What are the edge cases?
- Will this fix break anything else?
- Are there tests to update?
Step 4.2: Create Failing Test (if possible)
Write a test that demonstrates the bug BEFORE fixing it.
Step 4.3: Implement Single Fix
Fix at the ROOT CAUSE, not at symptoms.
Step 4.4: Verify Fix
Run the failing test - it should now pass.
If the bug is in a high-complexity function, consider /refactor after fix to prevent recurrence.
Audit Mode
When invoked with --audit, bug-hunt switches to a proactive sweep. No symptom needed — you're hunting for bugs that haven't been reported yet.
/bug-hunt --audit cli/internal/goals/ # audit a package
/bug-hunt --audit src/auth/ # audit a directory
/bug-hunt --audit . # audit recent changes in repo
Audit Step 1: Scope
Identify target files from the scope argument:
# Find source files in scope
find <scope> -name "*.go" -o -name "*.py" -o -name "*.ts" -o -name "*.rs" | head -50
If scope is . or broad (>50 files), narrow to recently changed files:
git log --since="2 weeks ago" --name-only --pretty=format: -- <scope> | sort -u | head -30
Audit Step 2: Systematic Read
Read every file in scope line by line. For each file, check:
| Category | What to Look For |
|---|---|
| Resource Leaks | Unclosed handles, orphaned processes, missing cleanup/defer |
| String Safety | Byte-level truncation of UTF-8, unsanitized input |
| Dead Code | Unreachable branches, unused constants, shadowed variables |
| Hardcoded Values | Paths, URLs, repo-specific assumptions that won't work elsewhere |
| Edge Cases | Empty input, nil/zero values, boundary conditions |
| Concurrency | Unprotected shared state, goroutine leaks, missing signal handlers |
| Error Handling | Swallowed errors, missing context, wrong error types |
Key discipline: Read line by line. Do not skim. The proven methodology (5 bugs found, 0 hypothesis failures) came from careful reading, not heuristic scanning.
USE THE TASK TOOL (subagent_type: "Explore") for large scopes — split files across parallel agents.
Audit Step 3: Classify Findings
For each finding, assign severity:
| Severity | Criteria | Examples |
|---|---|---|
| HIGH | Data loss, security, resource leak, process orphaning | Zombie processes, SQL injection, file handle leak |
| MEDIUM | Wrong output, incorrect defaults, silent data corruption | UTF-8 truncation, hardcoded paths, wrong error code |
| LOW | Dead code, cosmetic, minor inconsistency | Unreachable branch, unused import, style violation |
Performance bugs (slow queries, memory leaks, N+1) → escalate to /perf for deeper analysis.
Audit Step 4: Write Audit Report
For audit report format, read skills/bug-hunt/references/audit-report-template.md.
Write to .agents/research/YYYY-MM-DD-bug-<scope-slug>.md.
Report to user with a summary table:
| # | Bug | Severity | File | Fix |
|---|-----|----------|------|-----|
| 1 | <description> | HIGH | <file:line> | <proposed fix> |
Include failure count (hypothesis tests that didn't confirm). Zero failures = clean audit.
Bug-Finding Pyramid Modes (BF1–BF5)
When running --audit, check for missing bug-finding test coverage:
BF4 — Chaos/Negative Testing (highest bug-finding power): For every file that makes external calls (APIs, databases, filesystems), verify:
- Timeout injection test exists
- Connection failure test exists
- Permission denied test exists
- Corrupt input test exists
If any boundary lacks failure injection → flag as finding (severity: significant).
BF5 — Script Functional Testing: For every .sh script that calls external tools (oc, kubectl, helm):
- Stub-based functional test exists
- JSON output schema validated
- Both healthy and unhealthy stub paths tested
If scripts lack functional tests → flag as finding (severity: moderate).
BF1 — Property-Based Testing: For every data transformation (parse/render/serialize):
- Property test with randomized inputs exists
Reference: the test pyramid standard in /standards for full BF level definitions and per-language tooling.
Step 5: Write Bug Report
For bug report template, read skills/bug-hunt/references/bug-report-template.md.
Step 6: Report to User
Tell the user:
- Root cause identified (or not yet)
- Location of the bug (file:line)
- Proposed fix
- Location of bug report
- Failure count and types encountered
- Next step: implement fix or gather more info
Key Rules
- Reproduce first - confirm the bug exists
- Use git archaeology - understand history
- Trace systematically - follow the execution path
- Identify root cause - not just symptoms
- Design before fixing - think through the solution
- Document findings - write the bug report
Quick Checks
Common bug patterns to check:
- Off-by-one errors
- Null/undefined handling
- Race conditions
- Type mismatches
- Missing error handling
- State not reset
- Cache issues
Examples
Investigating a Test Failure
User says: /bug-hunt "tests failing on CI but pass locally"
What happens:
- Agent confirms bug by checking CI logs vs local test output
- Agent uses git archaeology to find recent changes to test files
- Agent traces execution path to identify environment-specific differences
- Agent forms hypothesis about missing environment variable
- Agent creates failing test locally by unsetting the variable
- Agent implements fix by adding default value
- Bug report written to
.agents/research/2026-02-13-bug-test-failure.md
Result: Root cause identified as missing ENV variable in CI configuration. Fix applied and verified.
Tracking Down a Regression
User says: /bug-hunt "feature X broke after yesterday's deployment"
What happens:
- Agent reproduces issue in current state
- Agent uses
git log --since="2 days ago"to find recent commits - Agent uses
git bisectto identify exact breaking commit - Agent compares broken code against working examples in codebase
- Agent forms hypothesis about introduced type mismatch
- Agent implements minimal fix and verifies with existing tests
- Bug report documents commit sha, root cause, and fix
Result: Regression traced to commit abc1234, type conversion error fixed at root cause in validation logic.
Proactive Code Audit
User says: /bug-hunt --audit cli/internal/goals/
What happens:
- Agent scopes to all
.gofiles in the goals package - Agent reads each file line by line, checking for resource leaks, string safety, dead code, etc.
- Agent finds 5 bugs: zombie process groups (HIGH), UTF-8 truncation (MEDIUM), hardcoded paths (MEDIUM), lost paragraph breaks (LOW), dead branch (LOW)
- All findings confirmed on first pass — 0 hypothesis failures
- Audit report written to
.agents/research/2026-02-24-bug-goals-go.md
Result: 5 concrete bugs with severity, file:line, and proposed fix — ready for implementation without debugging.
Troubleshooting
| Problem | Cause | Solution |
|---|---|---|
| Can't reproduce bug | Insufficient environment context or intermittent issue | Ask user for specific steps, environment variables, input data. Check for race conditions or timing issues. |
| Git archaeology returns too many commits | Broad search or high-churn file | Narrow timeframe with --since flag, focus on specific function with git blame, search commit messages for related keywords. |
| Hit 3-failure limit during hypothesis testing | Multiple incorrect hypotheses or complex root cause | Escalate to architecture review. Read failure-categories.md to determine if failures are countable. Consider asking for domain expert input. |
| Bug report missing key information | Incomplete investigation or skipped steps | Verify all 4 phases completed. Ensure root cause identified with file:line. Check git blame ran for responsible commit. |
Reference Documents
How to use bug-hunt on Cursor
AI-first code editor with Composer
Prerequisites
Before installing skills in Cursor, ensure your development environment meets these requirements:
- ›Cursor installed and configured on your development machine
- ›Node.js version 16.0+ with npm package manager (verify with
node --version) - ›Active project directory or workspace where you want to add bug-hunt
Execute installation command
Execute the skills CLI command in your project's root directory to begin installation:
The skills CLI fetches bug-hunt from GitHub repository boshu2/agentops and configures it for Cursor.
Select Cursor when prompted
The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:
Verify installation
Confirm successful installation by checking the skill directory location:
Reload or restart Cursor to activate bug-hunt. Access the skill through slash commands (e.g., /bug-hunt) or your agent's skill management interface.
Security & Verification Notice
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.
List & Monetize Your Skill
Submit your Claude Code skill and start earning
Use Cases▌
User Story & Requirements Generation
Create detailed user stories, acceptance criteria, and feature specs
Example
Generate user stories for 'password reset feature' with acceptance criteria, edge cases, and test scenarios
Reduce spec writing time by 50%, ensure comprehensive coverage
Competitive Analysis
Research competitors, compare features, identify gaps
Example
Analyze 5 competitor products, create feature comparison matrix, suggest differentiation opportunities
Complete competitive research in 2 hours instead of 2 days
Roadmap Prioritization
Evaluate features using frameworks (RICE, ICE, Kano) and create prioritized backlogs
Example
Score 20 feature ideas using RICE framework, generate prioritized roadmap with rationale
Make data-driven prioritization decisions faster
Stakeholder Communication
Draft PRDs, status updates, and stakeholder presentations
Example
Create executive summary of Q3 roadmap, monthly progress report, feature launch announcement
Save 3-5 hours/week on communication overhead
Implementation Guide▌
Prerequisites
- ›Claude Desktop or compatible AI client
- ›Access to product documentation and roadmap tools (Jira, Notion, etc.)
- ›Understanding of product management frameworks (RICE, Jobs-to-be-Done, etc.)
- ›Stakeholder contact information and communication channels
Time Estimate
30-60 minutes to see productivity improvements
Installation Steps
- 1.Install product management skill
- 2.Start with user story generation for known feature
- 3.Progress to competitive analysis: research 2-3 competitors
- 4.Use for roadmap prioritization: apply RICE/ICE scoring
- 5.Draft stakeholder communications and refine based on feedback
- 6.Build template library for recurring PM tasks
- 7.Share effective prompts with product team
Common Pitfalls
- ⚠Not validating competitive research—verify facts before sharing
- ⚠Accepting user stories without involving engineering team
- ⚠Over-relying on frameworks without qualitative judgment
- ⚠Not customizing outputs to company culture and communication style
- ⚠Skipping stakeholder validation of generated requirements
Best Practices▌
✓ Do
- +Validate research and competitive analysis with real data
- +Collaborate with engineering when generating technical requirements
- +Customize frameworks and templates to your company context
- +Use skill for first drafts, refine with stakeholder input
- +Document successful prompt patterns for PM tasks
- +Combine AI efficiency with human judgment and intuition
✗ Don't
- −Don't publish competitive analysis without fact-checking
- −Don't finalize user stories without engineering review
- −Don't make prioritization decisions solely on AI scoring
- −Don't skip customer validation of generated requirements
- −Don't ignore company-specific context and culture
💡 Pro Tips
- ★Provide context: company goals, constraints, customer feedback
- ★Ask for alternatives: 'Show 3 ways to prioritize this roadmap'
- ★Request stakeholder-specific formatting: 'Executive summary vs. engineering spec'
- ★Use skill for 70% generation + 30% customization to company needs
When to Use This▌
✓ Use When
Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.
✗ Avoid When
Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.
Learning Path▌
- 1Basic: user stories, feature specs, status updates
- 2Intermediate: competitive analysis, prioritization frameworks, PRDs
- 3Advanced: product strategy, go-to-market planning, OKR setting
- 4Expert: product vision, market positioning, business model innovation
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.5★★★★★26 reviews- ★★★★★Soo Bansal· Dec 28, 2024
bug-hunt is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Ganesh Mohane· Dec 24, 2024
bug-hunt has been reliable in day-to-day use. Documentation quality is above average for community skills.
- ★★★★★Shikha Mishra· Dec 20, 2024
Registry listing for bug-hunt matched our evaluation — installs cleanly and behaves as described in the markdown.
- ★★★★★Camila Farah· Nov 19, 2024
Solid pick for teams standardizing on skills: bug-hunt is focused, and the summary matches what you get after install.
- ★★★★★Yash Thakker· Nov 11, 2024
bug-hunt reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Isabella Martin· Oct 10, 2024
We added bug-hunt from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Dhruvi Jain· Oct 2, 2024
I recommend bug-hunt for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
- ★★★★★Anika Tandon· Sep 1, 2024
bug-hunt is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Soo Singh· Aug 20, 2024
bug-hunt fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★Henry Srinivasan· Jul 11, 2024
We added bug-hunt from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
showing 1-10 of 26