mode-debug
4
总安装量
2
周安装量
#49315
全站排名
安装命令
npx skills add https://github.com/duck4nh/antigravity-kit --skill mode-debug
Agent 安装分布
opencode
1
cursor
1
github-copilot
1
antigravity
1
gemini-cli
1
Skill 文档
Debug Mode
Goal: Find the correct cause, fix the right place, prevent recurrence.
Process
- Gather information (5W1H)
- Reproduce the bug
- Analyze root cause
- Propose fix + explanation
- Propose prevention measures
Required Questions If Information Is Missing
- Exact error message? (Copy verbatim)
- Which screen/feature does it occur on?
- Can it be reproduced? Specific steps?
- Any recent code changes?
- Anything unusual in logs?
- Which language/framework are you using?
Common Bug Patterns
Null/None Reference Errors
| Language | Error Message | Typical Cause |
|---|---|---|
| JS/TS | Cannot read property of undefined |
Missing null check |
| Python | AttributeError: 'NoneType' has no attribute |
Variable is None |
| Java | NullPointerException |
Object not initialized |
| Go | panic: runtime error: invalid memory address |
Nil pointer |
Type/Cast Errors
| Language | Error Message | Typical Cause |
|---|---|---|
| JS/TS | TypeError: X is not a function |
Wrong type assignment |
| Python | TypeError: unsupported operand type |
Type mismatch |
| Java | ClassCastException |
Invalid casting |
Common Logic Bugs
| Bug Type | Symptom | All Languages |
|---|---|---|
| Off-by-one | Wrong loop bounds | < vs <=, index starts at 0 or 1 |
| Race condition | Inconsistent data | Async/threading without sync |
| Memory leak | Performance degrades | Missing cleanup, circular refs |
| Infinite loop | App hangs/freezes | Missing break condition |
Output Format
## DEBUG
**Symptom:** [error description]
**Language:** [JS/Python/Java/Go/PHP/Ruby]
**Reproduction:**
1. [Step 1]
2. [Step 2]
3. [Error appears]
---
### Analysis:
**Root Cause:** [root cause]
**Location:** `[file:line]`
### Fix:
```diff
- [old code]
+ [new code]
Reason: [explanation]
Prevention:
| Suggestion | Priority |
|---|---|
| [Add validation] | High |
| [Write unit test] | Medium |
## Quick Fix Examples
### JavaScript
```diff
- const userName = user.name;
+ const userName = user?.name ?? 'Unknown';
Python
- email = data['email']
+ email = data.get('email', '')
Go
- value := items[index]
+ if index < len(items) {
+ value := items[index]
+ }
Principles
| DON’T | DO |
|---|---|
| Guess randomly | Request log/screenshot |
| Refactor randomly | Fix the right place, minimal change |
| Stop after fixing | Propose prevention |
| Fix symptoms | Find and fix root cause |
| Skip testing fix | Verify fix works before delivering |