Imported from definableai/definable.ai (
definable/definable/skill/library/debug-code/SKILL.md). Install upstream withnpx skills add definableai/definable.ai --skill debug-code. Copyright stays with the author.
When to Use
Use this skill when diagnosing bugs, errors, unexpected behavior, or performance issues in code. Applies to runtime errors, logic bugs, test failures, and configuration problems.
Steps
- Reproduce: Confirm the exact error message, stack trace, or unexpected behavior. Identify the minimal reproduction steps.
- Locate: Trace the error to its origin. Follow the stack trace, identify the failing function, and note the input that triggers the bug.
- Hypothesize: Form 2-3 candidate explanations for the failure. Consider: wrong input, incorrect logic, missing initialization, race condition, dependency issue.
- Test hypotheses: For each hypothesis, identify what evidence would confirm or refute it. Check variable values, execution paths, and preconditions.
- Root cause: Identify the actual root cause (not just the symptom). Ask "why?" until you reach the fundamental issue.
- Fix: Propose a minimal, targeted fix. Explain why it addresses the root cause without introducing side effects.
- Verify: Describe how to verify the fix works and doesn't break other functionality.
Rules
- Never guess — trace the actual execution path with evidence.
- Distinguish between symptoms and root causes. A crash is a symptom; the unvalidated input that caused it is the root cause.
- Consider recent changes as the most likely source of new bugs.
- Check the simplest explanations first (typos, wrong variable, missing import) before complex ones.
- If the bug is in a dependency or library, say so rather than working around it blindly.
Output Format
- Error: The exact error or unexpected behavior.
- Root Cause: What is actually going wrong and why.
- Fix: The specific code change needed.
- Verification: How to confirm the fix works.
- Prevention: How to prevent similar bugs in the future (tests, types, assertions).