debug
Guide systematic debugging through hypothesis generation and verification
When & Why to Use This Skill
This Claude skill provides a structured and systematic debugging workflow designed to accelerate root cause identification. It automates the process of hypothesis generation, parallel code exploration, and external research, ensuring a rigorous approach to troubleshooting complex software issues. By integrating with Obsidian, it transforms transient debugging sessions into a permanent, searchable knowledge base, significantly improving long-term maintenance and team knowledge retention.
Use Cases
- Systematic Root Cause Analysis: Guiding developers through a step-by-step framework to isolate the cause of specific error messages or unexpected system behaviors.
- Complex Issue Investigation: Managing multi-track investigations for intermittent bugs, race conditions, or edge cases using ranked hypothesis testing.
- Dependency and External Research: Searching for known issues in third-party libraries and matching local error signatures with global issue trackers.
- Automated Debugging Documentation: Automatically generating and saving detailed debugging logs, evidence, and findings to Obsidian for future reference and technical debt management.
| name | debug |
|---|---|
| description | Guide systematic debugging through hypothesis generation and verification |
Structured Debugging Workflow
Current Time: !date
System: !uname -a
Guide systematic debugging through hypothesis generation, investigation, and verification. Documents findings to Obsidian for knowledge retention.
Input
- Problem statement: symptoms, error messages, reproduction steps
- Context: environment, recent changes, frequency
- Optional: initial hypotheses or suspected areas
Investigation Strategy
Launch parallel investigation tracks:
Track 1: Codebase Exploration (explore agent)
- Trace code paths related to error messages/symptoms
- Find error handling and logging in affected areas
- Identify recent changes to suspect code
- Map data flow through affected components
Track 2: Code Analysis (inferred agent: go/frontend/postgres)
- Deep analysis of suspect code paths
- Identify potential failure modes
- Review error handling completeness
- Check for race conditions, edge cases, nil handling
Track 3: External Research (librarian agent)
- Search for known issues matching error signatures
- Find similar bugs in dependency issue trackers
- Research common causes for the symptom pattern
Debugging Framework
1. Problem Definition
- What is the expected behavior?
- What is the actual behavior?
- What changed recently?
- Is it reproducible? How?
2. Hypothesis Generation
Generate ranked hypotheses based on:
- Probability (how likely is this the cause?)
- Testability (how easy to verify/falsify?)
- Recent changes (correlation with deployments)
- Error signatures (what do the errors suggest?)
3. Investigation Plan
For each hypothesis:
- What evidence would confirm it?
- What evidence would refute it?
- What's the fastest way to test?
4. Evidence Collection
- Log analysis
- Metric correlation
- Code inspection
- Reproduction attempts
- Binary search (git bisect)
5. Root Cause Identification
- Distinguish symptoms from causes
- Identify contributing factors
- Verify fix addresses root cause
Output
Write to Obsidian via obsidian_append_content at:
$OBSIDIAN_PATH/Debugging/YYYY-MM-DD-HHMM-issue-title.md
Note:
$OBSIDIAN_PATHmust be a vault-relative path (e.g.,Projects/myapp), set per-project via direnv. Theobsidian_append_contenttool expects paths relative to the vault root.
Document Structure
Use this template for the Obsidian document:
@~/.config/opencode/templates/debug-session.md
Behavior
- Parse problem statement to extract symptoms and context
- Infer appropriate code agent from error context
- Launch explore, librarian, and inferred code agent in parallel
- Generate ranked hypotheses based on findings
- Create investigation plan for top hypotheses
- Document evidence and investigation log
- Write debug session to Obsidian via
obsidian_append_contentwith auto-generated filename:YYYY-MM-DD-HHMM-issue-title.md
$ARGUMENTS