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.
Applies a systematic debugging workflow to errors, exceptions and failures, with error-type tables, localization techniques and reference notes for Python, JavaScript and shell.
$ npx skills add Galaxy-Dawn/claude-scholar --skill bug-detective -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install Galaxy-Dawn/claude-scholar bug-detective --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ 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-srcUse ~/.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/
Install the "bug-detective" agent skill from https://github.com/Galaxy-Dawn/claude-scholar/tree/main/skills/bug-detective into .claude/skills/bug-detective/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "bug-detective", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/Galaxy-Dawn/claude-scholar/tree/main/skills/bug-detectiveType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add Galaxy-Dawn/claude-scholar --skill bug-detective -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install Galaxy-Dawn/claude-scholar bug-detective --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/Galaxy-Dawn/claude-scholar.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills/bug-detective .agents/skills/bug-detective && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "bug-detective" agent skill from https://github.com/Galaxy-Dawn/claude-scholar/tree/main/skills/bug-detective into .agents/skills/bug-detective/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "bug-detective", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add Galaxy-Dawn/claude-scholar --skill bug-detective -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install Galaxy-Dawn/claude-scholar bug-detective --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/Galaxy-Dawn/claude-scholar.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills/bug-detective .cursor/skills/bug-detective && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "bug-detective" agent skill from https://github.com/Galaxy-Dawn/claude-scholar/tree/main/skills/bug-detective into .cursor/skills/bug-detective/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "bug-detective", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/Galaxy-Dawn/claude-scholar.git --path skills/bug-detective--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add Galaxy-Dawn/claude-scholar --skill bug-detective -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install Galaxy-Dawn/claude-scholar bug-detective --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/Galaxy-Dawn/claude-scholar.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills/bug-detective .gemini/skills/bug-detective && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "bug-detective" agent skill from https://github.com/Galaxy-Dawn/claude-scholar/tree/main/skills/bug-detective into .gemini/skills/bug-detective/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "bug-detective", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install Galaxy-Dawn/claude-scholar bug-detectiveInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add Galaxy-Dawn/claude-scholar --skill bug-detective -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/Galaxy-Dawn/claude-scholar.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills/bug-detective .github/skills/bug-detective && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "bug-detective" agent skill from https://github.com/Galaxy-Dawn/claude-scholar/tree/main/skills/bug-detective into .github/skills/bug-detective/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "bug-detective", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add Galaxy-Dawn/claude-scholar --skill bug-detective -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install Galaxy-Dawn/claude-scholar bug-detective --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/Galaxy-Dawn/claude-scholar.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills/bug-detective .opencode/skills/bug-detective && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "bug-detective" agent skill from https://github.com/Galaxy-Dawn/claude-scholar/tree/main/skills/bug-detective into .opencode/skills/bug-detective/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "bug-detective", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
bug-detectiveApplies 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.
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.
12 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit 9037873. It shows what the files ask for, not the result of running them.
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.
Ships script files (Python and Shell), which the agent can run.
Shell commands in SKILL.md call:
gitbashnodepythonpytestFrom the folder's file list and the shell code blocks in SKILL.md.
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.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
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.
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.
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.
The full file from Galaxy-Dawn/claude-scholar at commit 9037873, republished under its MIT licence (© Galaxy-Dawn). 587 words, ~2,128 tokens.
.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.A systematic debugging workflow for investigating and resolving code errors, exceptions, and failures. Provides structured debugging methods and common error pattern recognition.
Debugging is a scientific problem-solving process that requires:
Before starting to debug, clarify the following information:
Required information to collect:
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?Choose a debugging strategy based on error type:
| Error Type | Characteristics | Debugging Method |
|---|---|---|
| Syntax Error | Code cannot be parsed | Check syntax, bracket matching, quotes |
| Import Error | ModuleNotFoundError | Check module installation, path config |
| Type Error | TypeError | Check data types, type conversions |
| Attribute Error | AttributeError | Check if object attribute exists |
| Key Error | KeyError | Check if dictionary key exists |
| Index Error | IndexError | Check list/array index range |
| Null Reference | NoneType/NullPointerException | Check if variable is None |
| Network Error | ConnectionError/Timeout | Check network connection, URL, timeout settings |
| Permission Error | PermissionError | Check file permissions, user permissions |
| Resource Error | FileNotFoundError | Check if file path exists |
Use the following methods to locate the issue:
1. Binary Search Method
2. Log Tracing
3. Breakpoint Debugging
4. Stack Trace Analysis
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]After fixing, verify:
is for String Comparisonsuper().__init__()this Binding Issues# ❌ 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# ❌ 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)# ❌ 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# ❌ 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# ❌ 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# ✅ 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# ❌ 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 1python -m pdb script.py
pytest -x -vv tests/test_target.pynode --inspect-brk app.js
node --trace-warnings app.jsgit bisect start
git bisect bad
git bisect good <known-good-commit># 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 failsFor detailed debugging techniques and patterns:
references/python-errors.md - Python error detailsreferences/javascript-errors.md - JavaScript/TypeScript error detailsreferences/shell-errors.md - Bash/Zsh script error detailsreferences/debugging-tools.md - Debugging tools usage guidereferences/common-patterns.md - Common error patternsWorking debugging examples:
examples/debugging-workflow.py - Complete debugging workflow exampleexamples/error-handling-patterns.py - Error handling patternsexamples/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
SKILL.md and 8 other files (references) in skills/bug-detective of Galaxy-Dawn/claude-scholar.
Open the folder on GitHubat commit 9037873
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.
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.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Bug Detective this skillGalaxy-Dawn/claude-scholar | 5.7k | 1 repos | ~2.1k | Automated safety check: Pass | MIT | |
| The Art of Debuggingstas00/the-art-of-debugging | 1.7k | — | ~6.1k | Automated safety check: Notes | CC-BY-SA-4.0 | |
| MCP Debuggerdebugmcp/mcp-debugger | 172 | — | ~3.8k | Automated safety check: Pass | MIT | |
| LSP Symbol Navigation Guideweave-os/router | 5.6k | — | ~794 | Automated safety check: Pass | Apache-2.0 | |
| CodeScope Codebase Graph AnalysisQwenLM/qwen-code | 28k | 1 repos | ~9.3k | Automated safety check: Pass | Apache-2.0 | |
| SlintMoosync/Moosync | 259 | — | ~2.4k | Automated safety check: Pass | GPL-3.0 |
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.
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…
weave-os/router
Shows when to answer a code question through a real language server instead of grep, covering definitions, references, hover, outlines, and errors.
QwenLM/qwen-code
Answers questions about code structure, history, bugs and PR risk using a CodeScope knowledge graph and semantic index built from the repository.
Moosync/Moosync
Expert guidance for building, debugging, and working with Slint GUI applications.
QwenLM/qwen-code-examples
Use CodeScope to analyze any indexed codebase via its graph database (neug) and vector index (zvec).
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.
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.
Galaxy-Dawn/claude-scholar
Scores a skill across description, content organization, writing style and structure, then produces letter grades and a prioritized improvement plan.
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.
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.
Galaxy-Dawn/claude-scholar
Prepare, audit, or revise Nature-ready Data Availability statements, data repository plans, dataset citations, and FAIR metadata checklists for manuscripts.
Works with
Categories
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.
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.
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.
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.
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.
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).
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.
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.
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.
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.
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.
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.