debugger-detective
Debugger Detective is a debugging skill that uses claudemem's AST-based call chain analysis to perform root cause investigation and impact assessment. It is best used when identifying why code is broken, finding bug sources, performing root cause analysis, or tracing error origins by leveraging the context command to show full caller and callee chains, enabling efficient backwards and forwards tracing through execution flow.
git clone --depth 1 https://github.com/MadAppGang/claude-code /tmp/debugger-detective && cp -r /tmp/debugger-detective/plugins/code-analysis/skills/debugger-detective ~/.claude/skills/debugger-detectiveSKILL.md
# Debugger Detective Skill
This skill uses claudemem's context command for debugging and root cause analysis.
## Why Claudemem Works Better for Debugging
| Task | claudemem | Native Tools |
|------|-----------|--------------|
| Trace backwards | `callers` shows call chain | Manual tracing |
| Trace forwards | `callees` shows dependencies | Manual tracing |
| Full context | `context` gives both directions | Multiple reads |
| Root cause | Call chain reveals origin | Trial and error |
**Primary commands:**
- `claudemem --agent context <name>` - Full call chain (callers + callees)
- `claudemem --agent callers <name>` - Trace back to error source
- `claudemem --agent callees <name>` - Trace forward from failure point
# Debugger Detective Skill
**Version:** 3.3.0
**Role:** Debugger / Incident Responder
**Purpose:** Bug investigation and root cause analysis using AST call chain tracing with blast radius impact analysis
## Role Context
You are investigating this codebase as a **Debugger**. Your focus is on:
- **Error origins** - Where exceptions are thrown
- **Call chains** - How execution flows to the failure point
- **State mutations** - What changed the data before failure
- **Root causes** - The actual source of problems (not just symptoms)
- **Impact radius** - What else might be affected
## Why `context` is Perfect for Debugging
The `context` command shows you:
- **Symbol definition** = Where the buggy code is
- **Callers** = How we got here (trace backwards)
- **Callees** = What happens next (trace forward)
- **Full call chain** = Complete picture for root cause analysis
## Debugger-Focused Commands (v0.3.0)
### Find the Bug Location
```bash
# Find the function mentioned in error
claudemem --agent symbol authenticate
# Get full context (callers + callees)
claudemem --agent context authenticate```
### Trace Back to Source (callers)
```bash
# Who called this function? (trace backwards)
claudemem --agent callers authenticate
# Follow the chain backwards
claudemem --agent callers LoginControllerclaudemem --agent callers handleRequest```
### Trace Forward to Effect (callees)
```bash
# What does this function call? (trace forward)
claudemem --agent callees authenticate
# Find where state changes happen
claudemem --agent callees updateSession```
### Blast Radius Analysis (v0.4.0+ Required)
```bash
# After finding the bug, check what else is affected
IMPACT=$(claudemem --agent impact buggyFunction)
if [ -z "$IMPACT" ] || echo "$IMPACT" | grep -q "No callers"; then
echo "No static callers - bug is isolated (or dynamically called)"
else
echo "$IMPACT"
echo ""
echo "This shows:"
echo "- Direct callers (immediately affected)"
echo "- Transitive callers (potentially affected)"
echo "- Complete list for testing after fix"
fi
```
**Use for**:
- Post-fix verification (test all impacted code)
- Regression prevention (know what to test)
- Incident documentation (impact scope)
**Limitations:**
Event-driven/callback architectures may have callers not visible to static analysis.
### Error Origin Hunting
```bash
# Map error handling code
claudemem --agent map "throw error exception"
# Find specific error types
claudemem --agent symbol AuthenticationError
# Who throws this error?
claudemem --agent callers AuthenticationError```
### State Mutation Tracking
```bash
# Find where state changes
claudemem --agent map "set state update mutate"
# Find the mutation function
claudemem --agent symbol updateUserState
# Who calls this mutation?
claudemem --agent callers updateUserState```
## PHASE 0: MANDATORY SETUP
### Step 1: Verify claudemem v0.3.0
```bash
which claudemem && claudemem --version
# Must be 0.3.0+
```
### Step 2: If Not Installed → STOP
Use AskUserQuestion (see ultrathink-detective for template)
### Step 3: Check Index Status
```bash
# Check claudemem installation and index
claudemem --version && ls -la .claudemem/index.db 2>/dev/null
```
### Step 3.5: Check Index Freshness
Before proceeding with investigation, verify the index is current:
```bash
# First check if index exists
if [ ! -d ".claudemem" ] || [ ! -f ".claudemem/index.db" ]; then
# Use AskUserQuestion to prompt for index creation
# Options: [1] Create index now (Recommended), [2] Cancel investigation
exit 1
fi
# Count files modified since last index
STALE_COUNT=$(find . -type f \( -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.jsx" -o -name "*.py" -o -name "*.go" -o -name "*.rs" \) \
-newer .claudemem/index.db 2>/dev/null | grep -v "node_modules" | grep -v ".git" | grep -v "dist" | grep -v "build" | wc -l)
STALE_COUNT=$((STALE_COUNT + 0)) # Normalize to integer
if [ "$STALE_COUNT" -gt 0 ]; then
# Get index time with explicit platform detection
if [[ "$OSTYPE" == "darwin"* ]]; then
INDEX_TIME=$(stat -f "%Sm" -t "%Y-%m-%d %H:%M" .claudemem/index.db 2>/dev/null)
else
INDEX_TIME=$(stat -c "%y" .claudemem/index.db 2>/dev/null | cut -d'.' -f1)
fi
INDEX_TIME=${INDEX_TIME:-"unknown time"}
# Get sample of stale files
STALE_SAMPLE=$(find . -type f \( -name "*.ts" -o -name "*.tsx" \) \
-newer .claudemem/index.db 2>/dev/null | grep -v "node_modules" | grep -v ".git" | head -5)
# Use AskUserQuestion (see template in ultrathink-detective)
fi
```
### Step 4: Index if Needed
```bash
claudemem index
```
---
## Workflow: Bug Investigation (v0.3.0)
### Phase 1: Locate the Symptom
```bash
# Find where the error appears
claudemem --agent map "error message keywords"
# Or find the specific function
claudemem --agent symbol failingFunction```
### Phase 2: Get Full Context
```bash
# Get callers + callees in one command
claudemem --agent context failingFunction```
### Phase 3: Trace Backwards (Find Root Cause)
```bash
# For each caller, check if it's the source
claudemem --agent callers caller1claudemem --agent callers caller2
# Keep tracing until you find the root
```
### Phase 4: Verify the Chain
```bash
# Once you suspect a root cause, verify the path
cl|
|
|
Common agent patterns and templates for Claude Code. Use when implementing agents to follow proven patterns for Tasks integration, quality checks, and external model invocation via claudish CLI.
YAML frontmatter schemas for Claude Code agents and commands. Use when creating or validating agent/command files.
XML tag structure patterns for Claude Code agents and commands. Use when designing or implementing agents to ensure proper XML structure following Anthropic best practices.
YAML format for Claude Code agent definitions as alternative to markdown. Use when creating agents with YAML, converting markdown agents to YAML, or validating YAML agent schemas. Trigger keywords - "YAML agent", "agent YAML", "YAML format", "agent schema", "YAML definition", "convert to YAML".
Linear API patterns and examples for autopilot. Includes authentication, webhooks, issue CRUD, state transitions, file attachments, and comment handling.