Galaxy-Dawn/claude-scholar/skills/bug-detective/SKILL.md
bug-detective
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.
- Source repository stars
- 4,981
- Declared platforms
- 0
- Static risk flags
- 1
- Last source update
- 2026-07-17
- Source checked
- 2026-08-04
Decision brief
What it does—and where it fits
A systematic debugging workflow for investigating and resolving code errors, exceptions, and failures. Provides structured debugging methods and common error pattern recognition.
Not for
- Tasks that require unconfirmed production actions or broad system permissions.
- Environments where the pinned source and install steps cannot be inspected.
Compatibility matrix
Platform support, with evidence labels
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
Inspect first. Install second.
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/Galaxy-Dawn/claude-scholar --skill "skills/bug-detective"Inspect the Agent Skill "bug-detective" from https://github.com/Galaxy-Dawn/claude-scholar/blob/2f7766fd541a723d4ddc6230b3277f948d61b093/skills/bug-detective/SKILL.md at commit 2f7766fd541a723d4ddc6230b3277f948d61b093. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
What the source asks the agent to do
- 01
Debugging Workflow
Before starting to debug, clarify the following information:
Complete error message contentExact location of the error (filename and line number)Reproduction steps (how to trigger the error) - 02
Step 1: Understand the Problem
Before starting to debug, clarify the following information:
Complete error message contentExact location of the error (filename and line number)Reproduction steps (how to trigger the error) - 03
Step 2: Analyze Error Type
Choose a debugging strategy based on error type:
Choose a debugging strategy based on error type: - 04
Step 3: Locate the Problem Source
Use the following methods to locate the issue:
Comment out half the code, check if the problem persistsProgressively narrow the scope until the problematic code is foundAdd print/logging statements at key locations - 05
Step 4: Form and Verify Hypotheses
Review the “Step 4: Form and Verify Hypotheses” section in the pinned source before continuing.
Review and apply the “Step 4: Form and Verify Hypotheses” source section.
Permission review
Static risk signals and limitations
Runs scripts
The documentation asks the agent to run terminal commands or scripts.
name = "John" # Error: tries to run 'name' commandRuns scripts
The documentation asks the agent to run terminal commands or scripts.
python -m pdb script.pyEvidence record
Why each signal appears
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 91/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 4,981 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
Provenance and original SKILL.md
- Repository
- Galaxy-Dawn/claude-scholar
- Skill path
- skills/bug-detective/SKILL.md
- Commit
- 2f7766fd541a723d4ddc6230b3277f948d61b093
- License
- MIT
- Collected
- 2026-08-04
- Default branch
- main
View the original SKILL.md
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:
- Understand the problem - Clearly define symptoms and expected behavior
- Gather evidence - Collect error messages, logs, stack traces
- Form hypotheses - Infer possible causes based on evidence
- Verify hypotheses - Confirm or eliminate causes through experiments
- 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 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 |
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]
Step 5: Apply Fix
After fixing, verify:
- The original error is resolved
- No new errors have been introduced
- Related functionality still works correctly
- 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
# ❌ 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
# ❌ 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
# ❌ 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
# ❌ 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
# ❌ 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
# ✅ 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
# ❌ 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
python -m pdb script.py
pytest -x -vv tests/test_target.py
Node.js Inspector
node --inspect-brk app.js
node --trace-warnings app.js
Git Bisect
git bisect start
git bisect bad
git bisect good <known-good-commit>
Bash Debugging
# 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 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 patterns
Example Files
Working debugging examples:
examples/debugging-workflow.py- Complete debugging workflow exampleexamples/error-handling-patterns.py- Error handling patternsexamples/debugging-workflow.sh- Shell script debugging example
Alternatives
Compare before choosing
K-Dense-AI/scientific-agent-skills
dask
Distributed computing for larger-than-RAM pandas/NumPy workflows. Use when you need to scale existing pandas/NumPy code beyond memory or across clusters. Best for parallel file processing, distributed ML, integration with existing pandas code. For out-of-core analytics on single machine use vaex; for in-memory speed use polars.
K-Dense-AI/scientific-agent-skills
neurokit2
Use NeuroKit2 to build or audit reproducible research workflows for physiological time-series preprocessing, event/interval analysis, multimodal alignment, variability, and complexity. Trigger when code imports neurokit2 or needs its current APIs, schemas, and method-aware validation—not for diagnosis or device validation.
dotnet/skills
test-tagging
Analyzes test suites in any language and tags each test with standardized traits (positive, negative, critical-path, boundary, smoke, regression, integration, performance, security). Use when the user wants to categorize, audit, or label tests with traits. Works across .NET (MSTest/xUnit/NUnit/TUnit), Python (pytest), TS/JS (Jest/Vitest), Java, Go, Ruby, Rust, Swift, Kotlin, PowerShell, and C++ — auto-editing when the framework has canonical tag syntax, otherwise report-only. Do not use for writ
K-Dense-AI/scientific-agent-skills
simpy
Build, inspect, test, and analyze bounded process-based discrete-event simulations with SimPy, including events, resources, interrupts, monitoring, replications, warm-up, and reproducible output analysis.