Debugging Workflow Skill
Use this skill for systematic debugging with research-first approach.
Trigger keywords: debug, error, bug, troubleshoot, investigate, research, fix
When to Use This Skill
Activate this skill when you encounter:
- •Errors or unexpected behavior
- •Failing tests or quality gates
- •Unfamiliar systems or frameworks
- •Multiple failed fix attempts
- •Need to understand root cause before implementing solutions
Core Principle
NEVER implement solutions based on assumptions. ALWAYS research documentation first.
Research Checkpoint Questions
Before implementing any fix, ask yourself:
- •
Have I researched the documentation?
- •Official docs, GitHub issues, hook documentation
- •Use claude-code-guide agent for Claude-specific questions
- •
Do I understand the root cause?
- •Evidence-based diagnosis, not guesses
- •Reproduce the error consistently
- •
Have I considered using debugging agents?
- •Researcher agent - Documentation research
- •Debugger agent - Systematic analysis
- •Test runner agent - Validation
- •
Am I about to try multiple solutions hoping one works?
- •STOP - Research first instead
Quick Debugging Workflow
1. 🔍 RESEARCH - Read documentation - Use claude-code-guide agent - Check GitHub issues 2. 🎯 UNDERSTAND - Identify root cause - Gather evidence (logs, errors) - Reproduce consistently 3. 🔧 IMPLEMENT - Apply fix based on understanding - Make minimal changes - One change at a time 4. ✅ VALIDATE - Run tests - Verify fix works - Check quality gates 5. 📝 DOCUMENT - Capture learning in HtmlGraph spike - Record research findings - Share patterns discovered
Built-in Debug Tools
# Claude Code debugging claude --debug <command> # Verbose output /hooks # List all active hooks /hooks PreToolUse # Show specific hook type /doctor # System diagnostics claude --verbose # Detailed logging # HtmlGraph debugging uv run htmlgraph orchestrator status uv run htmlgraph status uv run htmlgraph feature show <id> uv run htmlgraph session list --active
Quality Gates
Always run before committing:
# Full quality gate uv run ruff check --fix && \ uv run ruff format && \ uv run mypy src/ && \ uv run pytest
Debugging Agents
1. Researcher Agent
Purpose: Research documentation BEFORE implementing solutions
Use when:
- •Encountering unfamiliar errors
- •Working with Claude Code hooks/plugins
- •Before implementing assumptions
- •Multiple fix attempts failed
2. Debugger Agent
Purpose: Systematically analyze and resolve errors
Methodology:
- •Gather evidence (logs, errors, traces)
- •Reproduce consistently
- •Isolate variables
- •Analyze context
- •Form hypothesis
- •Test hypothesis
- •Implement minimal fix
3. Test Runner Agent
Purpose: Validate changes, enforce quality gates
Use when:
- •After code changes
- •Before marking tasks complete
- •After fixing bugs
- •Before committing
Anti-Patterns to Avoid
❌ Trial-and-Error Debugging
- •Making multiple fix attempts without research
- •Hoping one solution works
- •Not understanding root cause
❌ Assumption-Based Fixes
- •"This should work" without evidence
- •Implementing based on guesses
- •Skipping documentation research
❌ Skipping Validation
- •Not running tests after fixes
- •Ignoring quality gate failures
- •Committing broken code
Example: Correct Workflow
Scenario: Duplicate hooks causing errors
✅ Correct approach:
- •Research Claude Code hook loading behavior
- •Use claude-code-guide to understand hook merging
- •Identify hooks from multiple sources MERGE
- •Check all hook sources (.claude/settings.json, plugins)
- •Remove duplicates based on understanding
- •Verify fix works
- •Document learning in spike
❌ Wrong approach:
- •Remove .claude/hooks/hooks.json - Still broken
- •Clear plugin cache - Still broken
- •Remove old plugins - Still broken
- •Remove symlinks - Still broken
- •(Finally research after wasting time)
Integration with HtmlGraph
from htmlgraph import SDK
# Document debugging findings
sdk = SDK(agent='debugger')
spike = sdk.spikes.create('Investigation: Duplicate hooks error') \
.set_findings("""
Research discovered:
- Claude Code merges hooks from multiple sources
- Sources: .claude/settings.json, plugin hooks
- Solution: Remove duplicates from settings.json
""") \
.save()
Documentation References
Detailed methodology: See reference.md in this skill directory
Debugging agents: See packages/claude-plugin/agents/
- •
researcher.md- Research-first methodology - •
debugger.md- Systematic error analysis - •
test-runner.md- Quality gates and testing
Past debugging sessions: See .htmlgraph/spikes/
- •Learn from previous debugging workflows
- •Avoid repeating mistakes
Skill Metadata
Version: 1.0.0 Category: Development Workflow Complexity: Intermediate Estimated time: Varies by issue complexity
Related skills:
- •Test automation
- •Code quality enforcement
- •Documentation research