bug-hunter
Systematically finds and fixes bugs using proven debugging techniques. Traces from symptoms to root cause, implements fixes, and prevents regression.
About this skill
This skill empowers an AI agent to act as a dedicated bug hunter, employing a systematic, evidence-based approach to diagnose and resolve software defects. It guides the agent through the entire debugging lifecycle, from initial symptom analysis and consistent reproduction of the bug, to tracing the root cause, implementing effective fixes, and verifying solutions to prevent future regressions. Unlike guesswork, this skill promotes a methodical investigation, ensuring reliable problem-solving and improved software stability across various codebases.
Best use case
Streamlining the software debugging process by providing an AI agent with a structured methodology to find and fix errors efficiently, improving code quality and stability.
Systematically finds and fixes bugs using proven debugging techniques. Traces from symptoms to root cause, implements fixes, and prevents regression.
A clear understanding of the bug's root cause. Identified steps to consistently reproduce the bug. A proposed fix or code modification to resolve the issue. Verification steps to ensure the bug is resolved and no new issues are introduced. Improved stability and correctness of the targeted software or code.
Practical example
Example input
I'm experiencing an error in this Python script:
```python
def calculate_sum(numbers):
total = 0
for element in numbers:
total += element[i] # Typo here
return total
```
When I run `calculate_sum([1, 2, 3])`, it gives `TypeError: 'int' object is not subscriptable` instead of calculating the sum. Can you debug this and provide a fix?Example output
**Bug Report: Type Error in Summation Script**
**1. Reproduce the Bug:**
* **Steps:**
1. Execute the provided Python script.
2. Call `calculate_sum([1, 2, 3])`.
* **Expected Output:** `6` (sum of elements)
* **Actual Output:** `TypeError: 'int' object is not subscriptable`
**2. Isolate the Problem:**
* The error `TypeError: 'int' object is not subscriptable` occurs within the loop where elements are being added to `total`.
**3. Trace the Root Cause:**
* In the line `total += element[i]`, `element` is already the individual integer from the list during iteration (e.g., `1`, `2`, `3`). Attempting `element[i]` treats `element` as if it were a sequence (like a list or string) and tries to access an index `i` that is not defined or applicable, causing the `TypeError`.
**4. Implement Fix:**
* **Original Line:** `total += element[i]`
* **Proposed Fix:** Change to `total += element` (the `[i]` is extraneous as `element` is already the value).
**5. Verify Fix:**
* **Modified Script:**
```python
def calculate_sum(numbers):
total = 0
for element in numbers:
total += element # Fixed line
return total
```
* **Test Run with `calculate_sum([1, 2, 3])`:** Output: `6` (Correct)
* **Test Run with `calculate_sum([])`:** Output: `0` (Correct)
* **Test Run with `calculate_sum([10])`:** Output: `10` (Correct)
**Conclusion:** The bug has been identified and fixed. The updated script now correctly calculates the sum of elements in a list.When to use this skill
- A user reports a bug or error in provided code or system output.
- Software or a specific function isn't working as expected.
- The user explicitly asks the AI to 'fix the bug' or 'debug this.'
- Intermittent failures or unusual system behavior are observed.
When not to use this skill
- The issue is a feature request or involves adding new functionality, not fixing existing broken functionality.
- The problem is related to hardware malfunctions or external system dependencies outside the AI's observable scope.
- The bug requires subjective judgment or creative design decisions beyond technical correction.
- The AI lacks access or permissions to the codebase or environment where the bug resides.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/bug-hunter/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How bug-hunter Compares
| Feature / Agent | bug-hunter | Standard Approach |
|---|---|---|
| Platform Support | Claude | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | easy | N/A |
Frequently Asked Questions
What does this skill do?
Systematically finds and fixes bugs using proven debugging techniques. Traces from symptoms to root cause, implements fixes, and prevents regression.
Which AI agents support this skill?
This skill is designed for Claude.
How difficult is it to install?
The installation complexity is rated as easy. You can find the installation instructions above.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
AI Agent for Product Research
Browse AI agent skills for product research, competitive analysis, customer discovery, and structured product decision support.
SKILL.md Source
# Bug Hunter
Systematically hunt down and fix bugs using proven debugging techniques. No guessing—follow the evidence.
## When to Use This Skill
- User reports a bug or error
- Something isn't working as expected
- User says "fix the bug" or "debug this"
- Intermittent failures or weird behavior
- Production issues need investigation
## The Debugging Process
### 1. Reproduce the Bug
First, make it happen consistently:
```
1. Get exact steps to reproduce
2. Try to reproduce locally
3. Note what triggers it
4. Document the error message/behavior
5. Check if it happens every time or randomly
```
If you can't reproduce it, gather more info:
- What environment? (dev, staging, prod)
- What browser/device?
- What user actions preceded it?
- Any error logs?
### 2. Gather Evidence
Collect all available information:
**Check logs:**
```bash
# Application logs
tail -f logs/app.log
# System logs
journalctl -u myapp -f
# Browser console
# Open DevTools → Console tab
```
**Check error messages:**
- Full stack trace
- Error type and message
- Line numbers
- Timestamp
**Check state:**
- What data was being processed?
- What was the user trying to do?
- What's in the database?
- What's in local storage/cookies?
### 3. Form a Hypothesis
Based on evidence, guess what's wrong:
```
"The login times out because the session cookie
expires before the auth check completes"
"The form fails because email validation regex
doesn't handle plus signs"
"The API returns 500 because the database query
has a syntax error with special characters"
```
### 4. Test the Hypothesis
Prove or disprove your guess:
**Add logging:**
```javascript
console.log('Before API call:', userData);
const response = await api.login(userData);
console.log('After API call:', response);
```
**Use debugger:**
```javascript
debugger; // Execution pauses here
const result = processData(input);
```
**Isolate the problem:**
```javascript
// Comment out code to narrow down
// const result = complexFunction();
const result = { mock: 'data' }; // Use mock data
```
### 5. Find Root Cause
Trace back to the actual problem:
**Common root causes:**
- Null/undefined values
- Wrong data types
- Race conditions
- Missing error handling
- Incorrect logic
- Off-by-one errors
- Async/await issues
- Missing validation
**Example trace:**
```
Symptom: "Cannot read property 'name' of undefined"
↓
Where: user.profile.name
↓
Why: user.profile is undefined
↓
Why: API didn't return profile
↓
Why: User ID was null
↓
Root cause: Login didn't set user ID in session
```
### 6. Implement Fix
Fix the root cause, not the symptom:
**Bad fix (symptom):**
```javascript
// Just hide the error
const name = user?.profile?.name || 'Unknown';
```
**Good fix (root cause):**
```javascript
// Ensure user ID is set on login
const login = async (credentials) => {
const user = await authenticate(credentials);
if (user) {
session.userId = user.id; // Fix: Set user ID
return user;
}
throw new Error('Invalid credentials');
};
```
### 7. Test the Fix
Verify it actually works:
```
1. Reproduce the original bug
2. Apply the fix
3. Try to reproduce again (should fail)
4. Test edge cases
5. Test related functionality
6. Run existing tests
```
### 8. Prevent Regression
Add a test so it doesn't come back:
```javascript
test('login sets user ID in session', async () => {
const user = await login({ email: 'test@example.com', password: 'pass' });
expect(session.userId).toBe(user.id);
expect(session.userId).not.toBeNull();
});
```
## Debugging Techniques
### Binary Search
Cut the problem space in half repeatedly:
```javascript
// Does the bug happen before or after this line?
console.log('CHECKPOINT 1');
// ... code ...
console.log('CHECKPOINT 2');
// ... code ...
console.log('CHECKPOINT 3');
```
### Rubber Duck Debugging
Explain the code line by line out loud. Often you'll spot the issue while explaining.
### Print Debugging
Strategic console.logs:
```javascript
console.log('Input:', input);
console.log('After transform:', transformed);
console.log('Before save:', data);
console.log('Result:', result);
```
### Diff Debugging
Compare working vs broken:
- What changed recently?
- What's different between environments?
- What's different in the data?
### Time Travel Debugging
Use git to find when it broke:
```bash
git bisect start
git bisect bad # Current commit is broken
git bisect good abc123 # This old commit worked
# Git will check out commits for you to test
```
## Common Bug Patterns
### Null/Undefined
```javascript
// Bug
const name = user.profile.name;
// Fix
const name = user?.profile?.name || 'Unknown';
// Better fix
if (!user || !user.profile) {
throw new Error('User profile required');
}
const name = user.profile.name;
```
### Race Condition
```javascript
// Bug
let data = null;
fetchData().then(result => data = result);
console.log(data); // null - not loaded yet
// Fix
const data = await fetchData();
console.log(data); // correct value
```
### Off-by-One
```javascript
// Bug
for (let i = 0; i <= array.length; i++) {
console.log(array[i]); // undefined on last iteration
}
// Fix
for (let i = 0; i < array.length; i++) {
console.log(array[i]);
}
```
### Type Coercion
```javascript
// Bug
if (count == 0) { // true for "", [], null
// Fix
if (count === 0) { // only true for 0
```
### Async Without Await
```javascript
// Bug
const result = asyncFunction(); // Returns Promise
console.log(result.data); // undefined
// Fix
const result = await asyncFunction();
console.log(result.data); // correct value
```
## Debugging Tools
### Browser DevTools
```
Console: View logs and errors
Sources: Set breakpoints, step through code
Network: Check API calls and responses
Application: View cookies, storage, cache
Performance: Find slow operations
```
### Node.js Debugging
```javascript
// Built-in debugger
node --inspect app.js
// Then open chrome://inspect in Chrome
```
### VS Code Debugging
```json
// .vscode/launch.json
{
"type": "node",
"request": "launch",
"name": "Debug App",
"program": "${workspaceFolder}/app.js"
}
```
## When You're Stuck
1. Take a break (seriously, walk away for 10 minutes)
2. Explain it to someone else (or a rubber duck)
3. Search for the exact error message
4. Check if it's a known issue (GitHub issues, Stack Overflow)
5. Simplify: Create minimal reproduction
6. Start over: Delete and rewrite the problematic code
7. Ask for help (provide context, what you've tried)
## Documentation Template
After fixing, document it:
```markdown
## Bug: Login timeout after 30 seconds
**Symptom:** Users get logged out immediately after login
**Root Cause:** Session cookie expires before auth check completes
**Fix:** Increased session timeout from 30s to 3600s in config
**Files Changed:**
- config/session.js (line 12)
**Testing:** Verified login persists for 1 hour
**Prevention:** Added test for session persistence
```
## Key Principles
- Reproduce first, fix second
- Follow the evidence, don't guess
- Fix root cause, not symptoms
- Test the fix thoroughly
- Add tests to prevent regression
- Document what you learned
## Related Skills
- `@systematic-debugging` - Advanced debugging
- `@test-driven-development` - Testing
- `@codebase-audit-pre-push` - Code reviewRelated Skills
gdb-cli
GDB debugging assistant for AI agents - analyze core dumps, debug live processes, investigate crashes and deadlocks with source code correlation
frontend-developer
Build React components, implement responsive layouts, and handle client-side state management. Masters React 19, Next.js 15, and modern frontend architecture.
codebase-audit-pre-push
Deep audit before GitHub push: removes junk files, dead code, security holes, and optimization issues. Checks every file line-by-line for production readiness.
workspace-surface-audit
Audit the active repo, MCP servers, plugins, connectors, env surfaces, and harness setup, then recommend the highest-value ECC-native skills, hooks, agents, and operator workflows. Use when the user wants help setting up Claude Code or understanding what capabilities are actually available in their environment.
safety-guard
Use this skill to prevent destructive operations when working on production systems or running agents autonomously.
repo-scan
Cross-stack source code asset audit — classifies every file, detects embedded third-party libraries, and delivers actionable four-level verdicts per module with interactive HTML reports.
project-flow-ops
Operate execution flow across GitHub and Linear by triaging issues and pull requests, linking active work, and keeping GitHub public-facing while Linear remains the internal execution layer. Use when the user wants backlog control, PR triage, or GitHub-to-Linear coordination.
manim-video
Build reusable Manim explainers for technical concepts, graphs, system diagrams, and product walkthroughs, then hand off to the wider ECC video stack if needed. Use when the user wants a clean animated explainer rather than a generic talking-head script.
laravel-plugin-discovery
Discover and evaluate Laravel packages via LaraPlugins.io MCP. Use when the user wants to find plugins, check package health, or assess Laravel/PHP compatibility.
design-system
Use this skill to generate or audit design systems, check visual consistency, and review PRs that touch styling.
click-path-audit
Trace every user-facing button/touchpoint through its full state change sequence to find bugs where functions individually work but cancel each other out, produce wrong final state, or leave the UI in an inconsistent state. Use when: systematic debugging found no bugs but users report broken buttons, or after any major refactor touching shared state stores.
ck
Persistent per-project memory for Claude Code. Auto-loads project context on session start, tracks sessions with git activity, and writes to native memory. Commands run deterministic Node.js scripts — behavior is consistent across model versions.