Agent skill

Bug Detective

by Galaxy-Dawn in Galaxy-Dawn/claude-scholar

Applies a systematic debugging workflow to errors, exceptions and failures, with error-type tables, localization techniques and reference notes for Python, JavaScript and shell.

MITAuto-check passedDevelopment

Install Bug Detective

skills CLI
$ npx skills add Galaxy-Dawn/claude-scholar --skill bug-detective -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install Galaxy-Dawn/claude-scholar bug-detective --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/Galaxy-Dawn/claude-scholar.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/bug-detective .claude/skills/bug-detective && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
bug-detective
GitHub stars
5.7k
Used in
1 other repo
Token cost
~2.1k tokens
SKILL.md length
587 words
Files
9 (incl. references)
Skills in repo
34
Repo updated
First seen
Licence
MIT

At a glance

Applies a systematic debugging workflow to errors, exceptions and failures, with error-type tables, localization techniques and reference notes for Python, JavaScript and shell.

  • Works in 12 steps: Understand the Problem → Analyze Error Type → Locate the Problem Source → …
  • Debugging an error message or stack trace
  • SKILL.md covers Core Philosophy, Debugging Workflow, Python Common Error Patterns and JavaScript/TypeScript Common…, plus 2 more sections
  • Runs Python and Shell scripts from its folder; calls git, bash and node

What it does

The skill treats debugging as a scientific process: understand the problem, gather evidence, form hypotheses, verify them and resolve the issue. It begins by collecting the complete error message, the file and line, reproduction steps, expected versus actual behavior and environment details, using a short question template when information is missing.

A table maps error types such as syntax, import, type, attribute, key, index, null reference, network, permission and resource errors to a debugging method, and localization techniques include binary search by commenting out code and log tracing. Reference files cover common patterns, debugging tools and JavaScript, Python and shell errors, and the `examples` folder has Python and shell workflow scripts plus error-handling patterns.

When your agent uses it

  • Debugging an error message or stack trace
  • Investigating something that is broken with an unclear cause
  • Choosing a debugging strategy based on the type of error

Example prompts

  • “Debug this: my script raises a KeyError on the second loop iteration.”
  • “Something broke after the upgrade and the logs show a ConnectionError, so investigate.”
  • “Why is this test failing? Here is the stack trace.”

Workflow steps

12 steps, taken from the step headings in SKILL.md.

  1. Understand the Problem
  2. Analyze Error Type
  3. Locate the Problem Source
  4. Form and Verify Hypotheses
  5. Apply Fix
  6. Indentation Errors
  7. Mutable Default Arguments
  8. Closure Issues in Loops
  9. Modifying a List While Iterating
  10. Using is for String Comparison
  11. Forgetting to Call super().init()
  12. this Binding Issues

What it can do on your machine

Read from SKILL.md and the folder at commit 9037873. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships script files (Python and Shell), which the agent can run.

    Shell commands in SKILL.md call:

    • git
    • bash
    • node
    • python
    • pytest

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use git, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Bug Detective loads about 2.1k tokens when it runs, and up to ~6.1k if it reads all its reference files. Until then it costs about 83 tokens; SKILL.md has 587 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~83
When it runs · the whole SKILL.md, loaded when a task matches
~2.1k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~6.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from Galaxy-Dawn/claude-scholar at commit 9037873, republished under its MIT licence (© Galaxy-Dawn). 587 words, ~2,128 tokens.

Download SKILL.mdSave it as .claude/skills/bug-detective/SKILL.md (or your agent's skills folder). This skill also uses 8 other files; get the full folder from GitHub.
name
bug-detective
description
This skill should be used when the user asks to "debug this", "fix this error", "investigate this bug", "troubleshoot this issue", "find the problem", "something is broken", "this isn't working", "why is this failing", or reports errors/exceptions/bugs. Provides systematic debugging workflow and common error patterns.
version
0.1.0

Bug Detective

A systematic debugging workflow for investigating and resolving code errors, exceptions, and failures. Provides structured debugging methods and common error pattern recognition.

Core Philosophy

Debugging is a scientific problem-solving process that requires:

  1. Understand the problem - Clearly define symptoms and expected behavior
  2. Gather evidence - Collect error messages, logs, stack traces
  3. Form hypotheses - Infer possible causes based on evidence
  4. Verify hypotheses - Confirm or eliminate causes through experiments
  5. Resolve the issue - Apply fixes and verify

Debugging Workflow

Step 1: Understand the Problem

Before starting to debug, clarify the following information:

Required information to collect:

  • Complete error message content
  • Exact location of the error (filename and line number)
  • Reproduction steps (how to trigger the error)
  • Expected behavior vs actual behavior
  • Environment info (OS, versions, dependencies)

Question template:

1. What is the exact error message?
2. Which file and line does the error occur at?
3. How can this issue be reproduced? Provide detailed steps.
4. What was the expected result? What actually happened?
5. What recent changes might have introduced this issue?
Step 2: Analyze Error Type

Choose a debugging strategy based on error type:

Error TypeCharacteristicsDebugging Method
Syntax ErrorCode cannot be parsedCheck syntax, bracket matching, quotes
Import ErrorModuleNotFoundErrorCheck module installation, path config
Type ErrorTypeErrorCheck data types, type conversions
Attribute ErrorAttributeErrorCheck if object attribute exists
Key ErrorKeyErrorCheck if dictionary key exists
Index ErrorIndexErrorCheck list/array index range
Null ReferenceNoneType/NullPointerExceptionCheck if variable is None
Network ErrorConnectionError/TimeoutCheck network connection, URL, timeout settings
Permission ErrorPermissionErrorCheck file permissions, user permissions
Resource ErrorFileNotFoundErrorCheck if file path exists
Step 3: Locate the Problem Source

Use the following methods to locate the issue:

1. Binary Search Method

  • Comment out half the code, check if the problem persists
  • Progressively narrow the scope until the problematic code is found

2. Log Tracing

  • Add print/logging statements at key locations
  • Track variable value changes
  • Confirm code execution path

3. Breakpoint Debugging

  • Use debugger breakpoint functionality
  • Step through code execution
  • Inspect variable state

4. Stack Trace Analysis

  • Find the call chain from the stack trace in the error message
  • Determine the direct cause of the error
  • Trace back to the root cause
Step 4: Form and Verify Hypotheses

Hypothesis framework:

Hypothesis: [problem description] causes [error phenomenon]

Verification steps:
1. [verification method 1]
2. [verification method 2]

Expected results:
- If hypothesis is correct: [expected phenomenon]
- If hypothesis is wrong: [expected phenomenon]
Show full SKILL.md (250 more words)Show less
Step 5: Apply Fix

After fixing, verify:

  1. The original error is resolved
  2. No new errors have been introduced
  3. Related functionality still works correctly
  4. Tests added to prevent regression

Python Common Error Patterns

1. Indentation Errors
2. Mutable Default Arguments
3. Closure Issues in Loops
4. Modifying a List While Iterating
5. Using is for String Comparison
6. Forgetting to Call super().__init__()

JavaScript/TypeScript Common Error Patterns

1. this Binding Issues
2. Async Error Handling
3. Object Reference Comparison

Bash/Zsh Common Error Patterns

1. Spacing Issues
bash
# ❌ No spaces allowed in assignment
name = "John"  # Error: tries to run 'name' command

# ✅ Correct assignment
name="John"

# ❌ Missing spaces in conditional test
if[$name -eq 1]; then  # Error

# ✅ Correct
if [ $name -eq 1 ]; then
2. Quoting Issues
bash
# ❌ Variables not expanded inside single quotes
echo 'The value is $var'  # Output: The value is $var

# ✅ Use double quotes
echo "The value is $var"  # Output: The value is actual_value

# ❌ Using backticks for command substitution (confusing)
result=`command`

# ✅ Use $()
result=$(command)
3. Unquoted Variables
bash
# ❌ Unquoted variable, empty value causes errors
rm -rf $dir/*  # If dir is empty, deletes all files in current directory

# ✅ Always quote variables
[ -n "$dir" ] && rm -rf "$dir"/*

# Or use set -u to prevent undefined variables
set -u  # or set -o nounset
4. Variable Scope in Loops
bash
# ❌ Pipe creates subshell, outer variable unchanged
cat file.txt | while read line; do
    count=$((count + 1))  # Outer count won't change
done
echo "Total: $count"  # Outputs 0

# ✅ Use process substitution or redirection
while read line; do
    count=$((count + 1))
done < file.txt
echo "Total: $count"  # Correct output
5. Array Operations
bash
# ❌ Incorrect array access
arr=(1 2 3)
echo $arr[1]  # Outputs 1[1]

# ✅ Correct array access
echo ${arr[1]}  # Outputs 2
echo ${arr[@]}  # Outputs all elements
echo ${#arr[@]} # Outputs array length
6. String Comparison
bash
# ✅ Use `=` inside POSIX `[` tests and `==` inside Bash `[[ ]]` tests
if [ "$name" = "John" ]; then
if [[ "$name" == "John" ]]; then

# ❌ Using -eq for numeric comparison instead of =
if [ $age = 18 ]; then  # Wrong

# ✅ Use arithmetic operators for numeric comparison
if [ $age -eq 18 ]; then
if (( age == 18 )); then
7. Command Failure Continues Execution
bash
# ❌ Execution continues after command failure
cd /nonexistent
rm file.txt  # Deletes file.txt in current directory

# ✅ Use set -e to exit on error
set -e  # or set -o errexit
cd /nonexistent  # Script exits here
rm file.txt

# Or check if command succeeded
cd /nonexistent || exit 1

Common Debugging Commands

Python pdb Debugger
bash
python -m pdb script.py
pytest -x -vv tests/test_target.py
Node.js Inspector
bash
node --inspect-brk app.js
node --trace-warnings app.js
Git Bisect
bash
git bisect start
git bisect bad
git bisect good <known-good-commit>
Bash Debugging
bash
# Run script in debug mode
bash -x script.sh  # Print each command
bash -v script.sh  # Print command source
bash -n script.sh  # Syntax check, no execution

# Enable debugging within a script
set -x  # Enable command tracing
set -v  # Enable verbose mode
set -e  # Exit on error
set -u  # Error on undefined variables
set -o pipefail  # Fail if any command in pipe fails

Preventive Debugging

1. Use Type Checking
2. Input Validation
3. Defensive Programming
4. Logging

Debugging Checklist

Before Starting
  • Obtain the complete error message
  • Record the stack trace of the error
  • Confirm reproduction steps
  • Understand expected behavior
During Debugging
  • Check recent code changes
  • Use binary search to locate the issue
  • Add logs to trace variables
  • Verify hypotheses
After Resolution
  • Confirm the original error is fixed
  • Test related functionality
  • Add tests to prevent regression
  • Document the problem and solution

Additional Resources

Reference Files

For detailed debugging techniques and patterns:

  • references/python-errors.md - Python error details
  • references/javascript-errors.md - JavaScript/TypeScript error details
  • references/shell-errors.md - Bash/Zsh script error details
  • references/debugging-tools.md - Debugging tools usage guide
  • references/common-patterns.md - Common error patterns
Example Files

Working debugging examples:

  • examples/debugging-workflow.py - Complete debugging workflow example
  • examples/error-handling-patterns.py - Error handling patterns
  • examples/debugging-workflow.sh - Shell script debugging example

© Galaxy-Dawn, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 8 other files (references) in skills/bug-detective of Galaxy-Dawn/claude-scholar.

  • SKILL.md
  • examples/debugging-workflow.py
  • examples/debugging-workflow.sh
  • examples/error-handling-patterns.py
  • references/common-patterns.md
  • references/debugging-tools.md
  • references/javascript-errors.md
  • references/python-errors.md
  • references/shell-errors.md

Open the folder on GitHubat commit 9037873

Used in 1 other repository

We found 1 copy of this SKILL.md (exact, near-identical or edited) in other folders, from 1 other GitHub owner. This page covers the copy in Galaxy-Dawn/claude-scholar, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Bug Detective next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Bug Detective compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Bug Detective this skillGalaxy-Dawn/claude-scholar5.7k1 repos~2.1kAutomated safety check: PassMIT
The Art of Debuggingstas00/the-art-of-debugging1.7k—~6.1kAutomated safety check: NotesCC-BY-SA-4.0
MCP Debuggerdebugmcp/mcp-debugger172—~3.8kAutomated safety check: PassMIT
LSP Symbol Navigation Guideweave-os/router5.6k—~794Automated safety check: PassApache-2.0
CodeScope Codebase Graph AnalysisQwenLM/qwen-code28k1 repos~9.3kAutomated safety check: PassApache-2.0
SlintMoosync/Moosync259—~2.4kAutomated safety check: PassGPL-3.0

Similar skills

  • The Art of Debugging

    stas00/the-art-of-debugging

    Condensed debugging method and tool recipes for Unix, Python and PyTorch programs: crashes, hangs, segfaults, wrong output, CUDA OOM, NaN values and slowness.

    1.7k GitHub stars~6.1k tokensUpdated 3 days ago
    DevelopmentAuto-check: notes
  • MCP Debugger

    debugmcp/mcp-debugger

    A skill your agent uses when investigating a bug, failing test, or unexpected runtime behavior and the mcp-debugger MCP server is available — drives real step-through debuggers (breakpoints, stack…

    172 GitHub stars~3.8k tokensUpdated 2 days ago
    DevelopmentAuto-check passed
  • Shows when to answer a code question through a real language server instead of grep, covering definitions, references, hover, outlines, and errors.

    5.6k GitHub stars~794 tokensUpdated today
    DevelopmentAuto-check passed
  • Answers questions about code structure, history, bugs and PR risk using a CodeScope knowledge graph and semantic index built from the repository.

    28k GitHub starsUsed in 1 repo~9.3k tokens
    DevelopmentAuto-check passed
  • Slint

    Moosync/Moosync

    Expert guidance for building, debugging, and working with Slint GUI applications.

    259 GitHub stars~2.4k tokensUpdated 8 days ago
    DevelopmentAuto-check passed
  • Codegraph QA

    QwenLM/qwen-code-examples

    Use CodeScope to analyze any indexed codebase via its graph database (neug) and vector index (zvec).

    143 GitHub stars~4.3k tokensUpdated 4 mo ago
    DevelopmentAuto-check passed

More from Galaxy-Dawn/claude-scholar

All 34 skills in this repo
  • Citation Verification Guide

    Galaxy-Dawn/claude-scholar

    Reference guidance for checking every citation in academic writing against canonical sources such as DOI, arXiv, CrossRef and Semantic Scholar, to catch fake or wrong references.

    5.7k GitHub starsUsed in 2 repos~1.9k tokens
    Auto-check passed
  • Skill Improvement Plan Executor

    Galaxy-Dawn/claude-scholar

    Reads an improvement-plan file from a companion quality-review skill and applies its suggested fixes to a Claude Skill, backing up first.

    5.7k GitHub starsUsed in 1 repo~1.8k tokens
    Auto-check passed
  • Skill Quality Reviewer

    Galaxy-Dawn/claude-scholar

    Scores a skill across description, content organization, writing style and structure, then produces letter grades and a prioritized improvement plan.

    5.7k GitHub starsUsed in 1 repo~3k tokens
    Auto-check passed
  • UI/UX Design System Advisor

    Galaxy-Dawn/claude-scholar

    Turns a vague UI request into a concrete design system with style, palette, typography and layout guidance from a search script, plus stack-specific implementation advice.

    5.7k GitHub starsUsed in 1 repo~1.1k tokens
    Auto-check passed
  • Daily Paper Digest

    Galaxy-Dawn/claude-scholar

    Finds recent arXiv and bioRxiv papers on a topic, narrows them in stages to one pick per field, and writes bilingual Chinese and English summaries.

    5.7k GitHub stars~1k tokensUpdated 16 days ago
    Auto-check passed
  • Nature Data

    Galaxy-Dawn/claude-scholar

    Prepare, audit, or revise Nature-ready Data Availability statements, data repository plans, dataset citations, and FAIR metadata checklists for manuscripts.

    5.7k GitHub starsUsed in 3 repos~1.6k tokens
    Auto-check passed

Categories

Questions about Bug Detective

What does Bug Detective do?

Applies a systematic debugging workflow to errors, exceptions and failures, with error-type tables, localization techniques and reference notes for Python, JavaScript and shell. The skill treats debugging as a scientific process: understand the problem, gather evidence, form hypotheses, verify them and resolve the issue. It begins by collecting the complete error message, the file and line, reproduction steps, expected versus actual behavior and environment details, using a short question template when information is missing.

When should I use Bug Detective?

Bug Detective fits situations like: debugging an error message or stack trace; investigating something that is broken with an unclear cause; choosing a debugging strategy based on the type of error.

How do I install Bug Detective in Claude Code?

Run `npx skills add Galaxy-Dawn/claude-scholar --skill bug-detective -a claude-code`. Or copy the skill folder (skills/bug-detective in Galaxy-Dawn/claude-scholar) into .claude/skills/bug-detective in your project. Claude Code loads it when a task matches its description.

How do I install Bug Detective in Codex?

Run `npx skills add Galaxy-Dawn/claude-scholar --skill bug-detective -a codex`. Or copy the skill folder (skills/bug-detective in Galaxy-Dawn/claude-scholar) into .agents/skills/bug-detective in your project. Codex loads it when a task matches its description.

Can I use Bug Detective in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add Galaxy-Dawn/claude-scholar --skill bug-detective -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/bug-detective, .gemini/skills/bug-detective, .github/skills/bug-detective and .opencode/skills/bug-detective in your project.

What does Bug Detective need to run?

Going by SKILL.md and its folder, Bug Detective needs Python and a shell for the scripts in its folder and the command-line tools its instructions call (git, bash, node, python and pytest).

Does Bug Detective access the network?

SKILL.md contains no URLs. Its commands use git, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Bug Detective safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Bug Detective use?

Bug Detective is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Bug Detective use?

About 2.1k tokens (SKILL.md is roughly 8.5k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.9k tokens, read only when the agent opens those files.

What are the alternatives to Bug Detective?

Skills that share tags, products or a category with Bug Detective: The Art of Debugging (stas00/the-art-of-debugging, 1.7k stars), MCP Debugger (debugmcp/mcp-debugger, 172 stars), LSP Symbol Navigation Guide (weave-os/router, 5.6k stars) and CodeScope Codebase Graph Analysis (QwenLM/qwen-code, 28k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Bug Detective?

Galaxy-Dawn (a GitHub user) maintains it in Galaxy-Dawn/claude-scholar, which has 5,717 GitHub stars. The repository holds 34 skills in this directory. The repository was last updated on September 23, 2026.

Source: Galaxy-Dawn/claude-scholar on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.