bug-detective
できること
このスキルは、AIにコードのバグ、例外、障害を追跡するための段階的な方法を与えます。コードが壊れていて、慎重で証拠に基づいた修正がほしい人のためのものです。
使う場面
- ✓調べるべきエラーメッセージ、例外、スタックトレースがあるとき。
- ✓何かが壊れていたり、機能が突然止まったりしたとき。
- ✓コードが失敗する理由を尋ねたが、原因が明らかでないとき。
スキルのリンク
https://github.com/Galaxy-Dawn/claude-scholar/blob/main/skills/bug-detective/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“最新のデプロイの後、ログインページで500エラーが出ます。原因を見つけて直してください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントはエラーの詳細を集め、エラーの種類を分類し、考えられる原因を挙げ、それぞれを検証してから、修正を適用して確認します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
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
よくある質問
どんな情報を伝えればいいですか?
エラーメッセージ全体、わかればファイルと行番号、再現の手順、期待していた動作です。
修正を推測しますか?
いいえ。考えられる原因を挙げ、コードを変える前にそれぞれを確かめます。
よくあるエラーのパターンを知っていますか?
はい。原因の特定を早めるために、よくあるエラーのパターンを含んでいます。
詳細
作者による元の説明
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.
人気
- GitHubのスター
- 6.0k
- ランキング
- #14480
- ライセンス
- MIT
- 更新日
- 2026/10/19
コメント
- …
このリポジトリの他のスキル
agent-identifier
6.0kClaude Codeのエージェントを作る方法をエージェントに教えます。名前、トリガーの説明、システムプロンプト、設定を正しく書きます。
architecture-design
6.0k機械学習プロジェクトのコードの標準的な構成を教えます。登録可能な部品を追加するときは、ファクトリーとレジストリのパターンを使います。
citation-verification
6.0k学術論文の各引用を信頼できる学術情報源と照らして確認し、偽物や誤った参考文献を見つけるようエージェントを支援します。
code-review-excellence
6.0kコードの変更とプルリクエストを、明確で親切で優先順位の付いたフィードバックでレビューし、本当のバグを見つけてコードを改善するようエージェントを支援します。
似ているスキル
diffs
394k編集内容の実際の共有可能な差分を、手書きの要約ではなく、ビューアーのリンクや画像ファイルとして作成するようエージェントを支援します。
coding-agent
394kCodex、Claude Code、OpenCodeに大きめのコーディング作業をバックグラウンドのワーカーとして渡し、その進捗を確認するようエージェントを支援します。
gh-issues
394kGitHubのイシューを探し、取り組むものを選び、修正を含むプルリクエストを開くようエージェントを支援します。レビューコメントへの対応も含みます。