← ClaudeAtlas

bug-detectivelisted

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.
jessevanwyk1/claude-scholar · ★ 11 · Data & Documents · score 72
Install: claude install-skill jessevanwyk1/claude-scholar
# Bug Detective 系统化的DebugProcess,用于排查和解决CodeError、异常和故障。提供结构化的DebugMethod和常见ErrorPattern识别。 ## 核心理念 Debug是科学问题的解决过程,需要: 1. **理解问题** - 清晰定义症状和预期行为 2. **收集证据** - GetErrorInformation、日志、堆栈跟踪 3. **形成假设** - 基于证据推断可能原因 4. **Verify假设** - 通过实验确认或排除原因 5. **解决问题** - 应用Fix并Verify ## DebugProcess ### 第一步:理解问题 在开始Debug前,明确以下Information: **必须收集的Information:** - Error消息的完整Content - Error发生的具体位置(File名和行号) - 复现Step(如何触发Error) - 预期行为 vs 实际行为 - EnvironmentInformation(操作系统、Version、Dependency) **提问模板:** ``` 1. 具体的Error消息是什么? 2. Error发生在哪个File的哪一行? 3. 如何复现这个���题?请提供详细Step 4. 期望的Result是什么?实际发生了什么? 5. 最近有什么改动可能引入这个问题? ``` ### 第二步:分析ErrorClass型 根据ErrorClass型选择Debug策略: | ErrorClass型 | 特征 | DebugMethod | |---------|------|---------| | **语法Error** | Code无法Parse | Check语法、括号匹配、引号 | | **导入Error** | ModuleNotFoundError | CheckModule安装、PathConfiguration | | **Class型Error** | TypeError | CheckDataClass型、Class型Convert | | **PropertyError** | AttributeError | CheckObjectProperty是否存在 | | **KeyError** | KeyError | Check字典Key是否存在 | | **索引Error** | IndexError | Check列表/数组索引范围 | | **空指针** | NoneType/NullPointerException | CheckVariable是否为 None | | **网络Error** | ConnectionError/Timeout | Check网络连接、URL、超时Set | | **权限Error** | PermissionError | CheckFile权限、用户权限 | | **资源Error** | FileNotFoundError | CheckFilePath是否存在 | ### 第三步:定位问题源头 使用以下Method定位问题: **1. 二分法定位** - Comment掉一半Code,Check问题是否仍然存在 - 逐步缩小范围直到找到问题Code **2. 日志追踪** - 在关Key位置Add print/logging 语句 - 追踪VariableValue的变化 - 确认CodeExecutePath **3. 断点Deb