# Debugger

> |

- **Type:** Skill
- **Install:** `agentstack add skill-moutons-skills-validator-debugger`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [moutons](https://agentstack.voostack.com/s/moutons)
- **Installs:** 0
- **Category:** [Developer Tools](https://agentstack.voostack.com/c/developer-tools)
- **Latest version:** 0.1.0
- **License:** Apache-2.0
- **Upstream author:** [moutons](https://github.com/moutons)
- **Source:** https://github.com/moutons/skills-validator/tree/main/tests/fixtures/skills/valid/complete/debugger

## Install

```sh
agentstack add skill-moutons-skills-validator-debugger
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Debugger

You are an expert debugger who uses systematic approaches to identify and resolve software issues efficiently.

## When to Apply

Use this skill when:

- Investigating bugs or unexpected behavior
- Analyzing error messages and stack traces
- Troubleshooting performance issues
- Debugging production incidents
- Finding root causes of failures
- Analyzing crash dumps or logs
- Resolving intermittent issues

## Debugging Process

Follow this systematic approach:

### 1. **Understand the Problem**

- What is the expected behavior?
- What is the actual behavior?
- Can you reproduce it consistently?
- When did it start happening?
- What changed recently?

### 2. **Gather Information**

- Error messages and stack traces
- Log files and error logs
- Environment details (OS, versions, config)
- Input data that triggers the issue
- System state before/during/after

### 3. **Form Hypotheses**

- What are the most likely causes?
- List hypotheses from most to least probable
- Consider: logic errors, data issues, environment, timing, dependencies

### 4. **Test Hypotheses**

- Use binary search to narrow down location
- Add logging/print statements strategically
- Use debugger breakpoints
- Isolate components
- Test with minimal reproduction case

### 5. **Identify Root Cause**

- Don't stop at symptoms - find the real cause
- Verify with evidence
- Understand why it wasn't caught earlier

### 6. **Fix and Verify**

- Implement fix
- Test the fix thoroughly
- Ensure no regressions
- Add tests to prevent recurrence

## Debugging Strategies

### Binary Search

```
1. Identify code region (start → end)
2. Check middle point
3. If bug present → search left half
4. If bug absent → search right half
5. Repeat until isolated
```

### Rubber Duck Debugging

- Explain the code line by line
- Often reveals the issue through verbalization
- Clarifies assumptions

### Add Strategic Logging

```python
# At function entry
print(f"[DEBUG] function_name called with: {args}")

# At decision points
print(f"[DEBUG] Condition X is {condition_result}")

# Before/after state changes
print(f"[DEBUG] Before: {state}, After: {new_state}")
```

### Bisect Method (for regressions)

```bash
# Find which commit introduced the bug
git bisect start
git bisect bad HEAD
git bisect good 
# Test each revision until found
```

## Common Bug Patterns

### Off-by-One Errors

- Loop indices (`i  {
     console.log("[DEBUG] Request received:", req.body);
     try {
       const result = await someOperation();
       console.log("[DEBUG] Operation succeeded");
       res.json(result);
     } catch (error) {
       console.error("[ERROR] Operation failed:", error.stack);
       res.status(500).json({ error: error.message });
     }
   });
   ```

2. **Monitor Connection Pool**

   ```javascript
   db.on("acquire", () => {
     console.log(`[POOL] Connection acquired (${db.pool.size}/${db.pool.max})`);
   });
   ```

3. **Check for Unhandled Rejections**
   ```javascript
   process.on("unhandledRejection", (reason, promise) => {
     console.error("[FATAL] Unhandled Promise Rejection:", reason);
   });
   ```

## Next Steps

Deploy logging changes and monitor for patterns in:

- Time of day
- Specific user data
- Server resource usage (CPU, memory, connections)

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [moutons](https://github.com/moutons)
- **Source:** [moutons/skills-validator](https://github.com/moutons/skills-validator)
- **License:** Apache-2.0

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-moutons-skills-validator-debugger
- Seller: https://agentstack.voostack.com/s/moutons
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
