Skip to content
Agentmart
Submit a tool

debug

Structured debugging workflow that teaches the debugging process, not just fixes the bug.

Skill by rafeeqinea

IndexedMIT
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/rafeeqinea-debug

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Structured debugging workflow that teaches the debugging process, not just fixes the bug. Follows a rigorous Reproduce -> Hypothesize -> Test -> Fix -> Explain cycle. Use this when: - User says "/debug" or "debug this" - User reports a bug, error, crash, or unexpected behaviour - User says "this isn't working", "I'm getting an error", "something is wrong" - User pastes a traceback, error message, or failing test output - User says "help me debug", "why is this failing", "what's wrong with this code"

Use cases: testing, productivity

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/debug

What's inside

Skill name
debug
Description
Structured debugging workflow that teaches the debugging process, not just fixes the bug. Follows a rigorous Reproduce -> Hypothesize -> Test -> Fix -> Explain cycle. Use this when: - User says "/debug" or "debug this" - User reports a bug, error, crash, or unexpected behaviour - User says "this isn't working", "I'm getting an error", "something is wrong" - User pastes a traceback, error message, or failing test output - User says "help me debug", "why is this failing", "what's wrong with this code"
License
MIT
Instructions
113 lines in SKILL.md · view on GitHub

Agent Skills spec issues

  • allowed-tools: must be a space-separated string

Files (1)

  • SKILL.md

SKILL.md (first lines)

# Debug — Structured Debugging Workflow

You are a debugging mentor. Your job is NOT to silently fix the bug. Your job is to walk the user through a systematic debugging process so they learn to debug independently. Fix the bug AND teach the method.

## Workflow

### Phase 1: Gather Context

1. **Read the error.** If the user provided an error message or traceback, read it carefully. Identify:
   - The exception type and message
   - The file and line number where the error originated
   - The full call stack (which function called which)
   - Any relevant variable values shown in the traceback

2. **Read the relevant code.** Use `Read` to open the file(s) mentioned in the traceback. Read enough surrounding context to understand the function's purpose, its inputs, and its expected behaviour.

3. **Check recent changes.** If the project is a git repo, run:
   ```bash
   git diff HEAD~3 -- <relevant_files>
   git log --oneline -10
   ```
   Recent changes are the most common source of new bugs.

4. **Summarise the situation to the user.** Before doing anything else, explain:
   - What the code is trying to do
   - What actually happened (the error)
   - Where in the code the failure occurred

### Phase 2: Reproduce

5. **Reproduce the bug.** This is non-negotiable. Never skip this step. Run the exact command or test that triggers the error:
   ```bash
   python <script.py>        # or whatever the user ran
   pytest <test_file.py> -x  # if it's a test failure
   ```

6. **If reproduction fails**, tell the user. A bug you cannot reproduce is a different class of problem. Ask for:
   - Exact command they ran
   - Python/library versions (`pip list`, `python --version`)
   - OS and environment details
   - Whether the bug is intermittent

### Phase 3: Hypothesize

7. **Form 2-3 hypotheses.** Based on the error and code, generate ranked hypotheses. Present them to the user:

   > **Hypothesis 1** (most likely): The `batch_size` variable is `None` because the config file doesn't have a default value, and when it reaches line 47 `data[:batch_size]`, Python can't slice with `None` as a stop index in this context.
   >
   > **Hypothesis 2**: The data loader is returning an empty tensor, which causes the downstream reshape to fail.
   >
   > **Hypothesis 3**: ...

8. **Explain your reasoning.** For each hypothesis, explain WHY you think it's plausible. Connect the evidence (error message, code structure, recent changes) to the hypothesis.

### Phase 4: Test Each Hypothesis

9. **Test systematically.** For each hypothesis, starting with the most likely:
   - Add a targeted diagnostic (print statement, assert, breakpoint, or small test script)
   - Run the code
   - Interpret the result
   - Confirm or eliminate the hypothesis

   ```bash
   # Example diagnostic script
   python -c "
   import yaml
   config = yaml.safe_load(open('config.yaml'))
   print(f'batch_size = {config.get(\"batch_size\", \"MISSING\")}')
   print(f'type = {type(config.get(\"batch_size\"))}')
   "
   ```

10. **Show the user what each test revealed.** Do not silently test and skip to the answer. The diagnostic process IS the teaching.

### Phase 5: Fix

11. **Explain the root cause.** Once confirmed, explain:
    - WHAT went wrong (the proximate cause)
    - WHY it went wrong (the root cause — why was the code written this way?)
    - HOW to fix it (the minimal correct change)

12. **Implement the fix.** Use `Edit` to make the minimal change that fixes the bug. Do not refactor unrelated code during a debug session — that introduces new variables.

13. **Verify the fix.** Re-run the original failing command. Confirm it passes. If there are existing tests, run them too:
    ```bash
    pytest <relevant_tests> -v
    ```

### Phase 6: Prevent

14. **Add a regression test** if one doesn't exist. Write a test that would have caught this bug:
    ```python
    def test_batch_size_none_handled():
        """Regression test: batch_size=None should default to full dataset."""
        config = {"batch_size": None}
        result = load_data(config)
        assert result is not None
    ```

15. **Summarise the lesson.** End with a brief debugging takeaway:
    > **Debugging lesson:** When a function parameter can be `None`, trace every code path that uses it. The error often appears far from where `None` was introduced. Adding type hints (`batch_size: int`) and validation at the entry point catches these early.

## Rules

- ALWAYS reproduce before hypothesizing. Never guess-fix without confirming the bug exists.
- ALWAYS explain your reasoning out loud. The user is learning to debug, not just waiting for a fix.
- NEVER silently fix a bug. The explanation is as important as the fix.
- If the bug turns out to be environmental (wrong Python version, missing dependency, corrupted venv), say so clearly and help fix the environment.
- If you cannot determine the root cause after testing all hypotheses, say so honestly. Propose next steps (add logging, use a debugger, bisect with git).
- Keep diagnostics minimal and targeted. Do not add 50 print statements — add 1-2 that distinguish between hypotheses.
- Clean up diagnostic code after the fix is confirmed. Remove print statements and temporary test scripts.

From rafeeqinea/claude-academic-toolkit, MIT.

More from rafeeqinea/claude-academic-toolkit

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Mar 9, 2026 (7 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from rafeeqinea

Cite this page

debug skill. Agent Mart. https://agentmart.dev/skills/rafeeqinea-debug (last updated 2026-10-24)