issue-analyze · git:20260305.c56d819 · 2026-03-05 · sha256 722f6698952e3330

issue-analyze git:20260305.c56d819A

Immutable. This exact content is served forever at /api/v1/blob/722f6698952e3330.

---
name: issue-analyze
description: GitHub Issue 深度分析。讀取 issue → 分類問題 → 選擇調查策略 → 整合四種調查工具。
allowed-tools: Read, Grep, Glob, Bash(git:*), Bash(gh:*), mcp__codex__codex
---

# Issue Analyze Skill

## Trigger

- Keywords: 分析 issue, analyze issue, 調查問題, 問題分析, root cause, 根因分析

## When NOT to Use

- 已知根因,直接修復(用 `/bug-fix`)
- 純功能開發(用 `/feature-dev`)
- 只需代碼審查(用 `/codex-review`)

## Workflow

```
┌─────────────────────────────────────────────────────────────────┐
│ Phase 1: 讀取 Issue                                              │
├─────────────────────────────────────────────────────────────────┤
│ gh issue view <number> --json title,body,labels,comments        │
│ 提取:症狀、重現步驟、錯誤訊息、相關檔案                         │
└─────────────────────────────────────────────────────────────────┘
                              ↓
┌─────────────────────────────────────────────────────────────────┐
│ Phase 2: 問題分類                                                │
├─────────────────────────────────────────────────────────────────┤
│ 判斷問題類型 → 選擇調查策略                                      │
│                                                                 │
│ ┌────────────────┬──────────────────────────────────┐           │
│ │ 類型           │ 調查策略                         │           │
│ ├────────────────┼──────────────────────────────────┤           │
│ │ 功能不理解     │ /code-explore                    │           │
│ │ 回歸問題       │ /git-investigate                 │           │
│ │ 複雜根因       │ /code-investigate(雙視角)      │           │
│ │ 多種可能原因   │ /codex-brainstorm(窮舉)        │           │
│ │ 綜合問題       │ 組合使用多種策略                 │           │
│ └────────────────┴──────────────────────────────────┘           │
└─────────────────────────────────────────────────────────────────┘
                              ↓
┌─────────────────────────────────────────────────────────────────┐
│ Phase 3: 執行調查                                                │
├─────────────────────────────────────────────────────────────────┤
│ 根據分類結果,調用對應的調查指令                                 │
└─────────────────────────────────────────────────────────────────┘
                              ↓
┌─────────────────────────────────────────────────────────────────┐
│ Phase 4: 整合報告                                                │
├─────────────────────────────────────────────────────────────────┤
│ 綜合調查結果,產出分析報告                                       │
└─────────────────────────────────────────────────────────────────┘
```

## 問題分類決策樹

```
Issue 症狀
    │
    ├─ 「以前可以,現在不行」 ──────→ /git-investigate
    │                                  (找引入點)
    │
    ├─ 「不知道這功能怎麼運作」 ────→ /code-explore
    │                                  (快速理解)
    │
    ├─ 「有錯誤訊息 / stack trace」
    │       │
    │       ├─ 錯誤明確 ─────────────→ /code-explore
    │       │                          (追蹤路徑)
    │       │
    │       └─ 錯誤模糊 / 間歇性 ────→ /code-investigate
    │                                  (雙視角確認)
    │
    ├─ 「可能原因很多」 ────────────→ /codex-brainstorm
    │                                  (窮舉分析)
    │
    └─ 綜合 / 不確定 ──────────────→ 先 /code-explore
                                       再依結果選擇
```

## 調查工具對照

| 工具                | 用途         | 速度 | 深度   |
| ------------------- | ------------ | ---- | ------ |
| `/code-explore`     | 快速理解代碼 | 快   | 單視角 |
| `/git-investigate`  | 追蹤變更歷史 | 中   | 單視角 |
| `/code-investigate` | 雙重確認     | 慢   | 雙視角 |
| `/codex-brainstorm` | 窮舉可能性   | 最慢 | 對抗式 |

## Verification

- [ ] Issue 內容完整提取
- [ ] 問題類型正確分類
- [ ] 調查策略合理選擇
- [ ] 報告包含根因分析
- [ ] 有具體修復建議

## References

- `references/classification.md` - 問題分類詳細指引
- `references/report-template.md` - 報告模板

## Examples

### 回歸問題

```
輸入:/issue-analyze 123
Phase 1: gh issue view 123 → 「更新後 API 回傳 500」
Phase 2: 分類 = 回歸問題
Phase 3: /git-investigate → 找到引入 commit
Phase 4: 報告 + 修復建議
```

### 間歇性錯誤

```
輸入:/issue-analyze 456
Phase 1: gh issue view 456 → 「隨機出現 timeout」
Phase 2: 分類 = 複雜根因(間歇性)
Phase 3: /code-investigate → Claude + Codex 雙視角
Phase 4: 整合報告 → 可能原因排序
```

### 未知功能

```
輸入:/issue-analyze 789
Phase 1: gh issue view 789 → 「為什麼會有這個行為?」
Phase 2: 分類 = 功能不理解
Phase 3: /code-explore → 追蹤執行路徑
Phase 4: 報告 + 流程圖
```