본문으로 건너뛰기
cccskills
무료GitHub에 공개

bug-detective

Investigate code errors through a structured process using reproduction steps, logs, and testable explanations. The workflow guides fault isolation, fixes, and follow-up checks, with common error patterns for Python, JavaScript/TypeScript, and Bash/Zsh.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

원문원문 설명 보기

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.

설치 방법 보기

이럴 때 유용합니다

  • Investigating an error using logs and reproduction steps
  • Finding why code broke after a recent change
  • Troubleshooting common shell script errors
  • Checking related behavior after a fix

포함된 파일(9)

  • SKILL.md8.3 KB
  • examples/debugging-workflow.py6.2 KB
  • examples/debugging-workflow.sh8.6 KB
  • examples/error-handling-patterns.py8.5 KB
  • references/common-patterns.md5.5 KB
  • references/debugging-tools.md405 B
  • references/javascript-errors.md490 B
  • references/python-errors.md5.5 KB
  • references/shell-errors.md3.5 KB

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:

  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]

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

# ❌ 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 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

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Create and configure Claude Code agents using Markdown files with YAML configuration headers. Define when each agent should run, write its responsibilities and workflow, choose models and tools, and check configuration and triggering behavior.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Create a Claude Code subagent
  • Define triggering conditions with concrete examples
  • Configure an agent's model, color, and tools
Galaxy-Dawn/claude-scholar5.9천2026년 10월 19일 업데이트

Add datasets, models, and other components to machine learning projects using consistent registration and creation patterns. The skill guides file placement, configuration, and automatic module loading so new components fit the project's established architecture.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Adding a registered Dataset class
  • Creating a model driven by configuration
  • Wiring registration and creation logic in a new module
Galaxy-Dawn/claude-scholar5.9천2026년 10월 19일 업데이트

Check academic references for existence, accurate publication details, and support for the claims being cited. This guide explains how to verify sources, obtain bibliography entries, and flag references that cannot be confirmed.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Checking references suggested by AI
  • Verifying authors, titles, and publication years
  • Checking whether a paper supports a cited claim
Galaxy-Dawn/claude-scholar5.9천2026년 10월 19일 업데이트

Review code changes and pull requests for correctness, security, performance, and test quality. The skill helps prioritize issues, write specific and constructive feedback, and create shared review checklists and standards for a development team.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Reviewing code changes and pull requests
  • Writing review comments with clear priorities and fixes
  • Creating shared review checklists for a team
Galaxy-Dawn/claude-scholar5.9천2026년 10월 19일 업데이트

Create reusable slash commands, prompts invoked by typing a slash, for Claude Code. The skill explains Markdown structure, arguments, file references, tool permissions, and plugin integration so recurring tasks can follow a defined workflow.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Turning recurring prompts into slash commands
  • Creating review commands with arguments and file references
  • Sharing project-specific commands with a team
Galaxy-Dawn/claude-scholar5.9천2026년 10월 19일 업데이트

Apply a short quality checklist to everyday code changes. Read existing code first, keep edits focused, check types and common security risks, verify execution, remove debugging leftovers, and summarize what changed and its impact.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Checking quality during routine feature work
  • Reviewing type safety in Python and TypeScript
  • Checking input handling and common security risks
Galaxy-Dawn/claude-scholar5.9천2026년 10월 19일 업데이트

Galaxy-Dawn의 스킬 모두 보기

이 스킬의 문제 신고