Debug code

From definableai/definable.ai · View interactive version

Debug code is an AI agent skill from the GitHub repository definableai/definable.ai. Systematic debugging methodology

How to use this skill

Skill file

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

  1. Reproduce: Confirm the exact error message, stack trace, or unexpected behavior. Identify the minimal reproduction steps.
  2. Locate: Trace the error to its origin. Follow the stack trace, identify the failing function, and note the input that triggers the bug.
  3. Hypothesize: Form 2-3 candidate explanations for the failure. Consider: wrong input, incorrect logic, missing initialization, race condition, dependency issue.
  4. Test hypotheses: For each hypothesis, identify what evidence would confirm or refute it. Check variable values, execution paths, and preconditions.
  5. Root cause: Identify the actual root cause (not just the symptom). Ask "why?" until you reach the fundamental issue.
  6. Fix: Propose a minimal, targeted fix. Explain why it addresses the root cause without introducing side effects.
  7. Verify: Describe how to verify the fix works and doesn't break other functionality.

Rules

Output Format

  1. Error: The exact error or unexpected behavior.
  2. Root Cause: What is actually going wrong and why.
  3. Fix: The specific code change needed.
  4. Verification: How to confirm the fix works.
  5. Prevention: How to prevent similar bugs in the future (tests, types, assertions).
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.