SKILL.md
唯讀
名稱
sentry-pr-code-review
描述
審查專案的 PR,檢查 Seer Bug Prediction 在程式碼審查中偵測到的問題。當需要審查或修復 Sentry 在 PR 留言中指出的問題,或是要尋找帶有 Sentry 回饋的近期 PR 時使用。
Sentry 程式碼審查 (Sentry Code Review)
審查並修復 Seer (by Sentry) 在 GitHub PR 留言中指出的問題。
何時呼叫此 Skill
- 使用者要求「審查 Sentry 留言」或「修復 PR 上的 Sentry 問題」
- 使用者分享了 PR 的 URL/編號,並提到 Sentry 或 Seer 的回饋
- 使用者要求「處理 Sentry 審查意見」或「解決 Sentry 發現的事項」
- 使用者想要尋找帶有未解決 Sentry 留言的 PR
先決條件
- 已安裝
ghCLI 並完成驗證 - 存放庫已安裝 Seer by Sentry GitHub App
重要事項: 下方解析的留言格式是基於 Seer 目前的輸出。這並非 API 規格合約,隨時可能變更。請務必確認實際的留言結構。
階段 1:擷取 Seer 留言
gh api repos/{owner}/{repo}/pulls/{PR_NUMBER}/comments --paginate \
--jq '.[] | select(.user.login == "seer-by-sentry[bot]") | {file: .path, line: .line, body: .body}'
Bot 的登入名稱為 seer-by-sentry[bot] — 不是 sentry[bot] 或 sentry-io[bot]。
若未提供 PR 編號,請尋找帶有 Seer 留言的近期 PR:
gh pr list --state open --json number,title --limit 20 | \
jq -r '.[].number' | while read pr; do
count=$(gh api "repos/{owner}/{repo}/pulls/$pr/comments" --paginate \
--jq '[.[] | select(.user.login == "seer-by-sentry[bot]")] | length')
[ "$count" -gt 0 ] && echo "PR #$pr: $count Seer comments"
done
階段 2:解析每則留言
從 Markdown 內文中擷取:
- Bug description:開頭為
**Bug:**的行 - Severity/Confidence:位於
<sub>Severity: X | Confidence: X.XX</sub>內 - Analysis:位於
<summary>🔍 <b>Detailed Analysis</b></summary>區塊內 - Suggested Fix:位於
<summary>💡 <b>Suggested Fix</b></summary>區塊內 - AI Prompt:位於
<summary>🤖 <b>Prompt for AI Agent</b></summary>區塊內
階段 3:驗證與修復
針對每個問題:
- 讀取指定行號處的檔案
- 確認問題仍存在於目前的程式碼中(未在後續 commit 中修復)
- 審查周圍的程式碼,評估其為真實問題或誤報 (false positive)
- 執行修復(以建議的修復作為起點,或自行編寫)
- 考量邊界條件 (edge cases) 與迴歸風險
階段 4:總結並回報結果
## Seer Review: PR #[number]
### Resolved
| File:Line | Issue | Severity | Fix Applied |
|-----------|-------|----------|-------------|
| path:123 | desc | HIGH | what done |
### Skipped (false positive or already fixed)
| File:Line | Issue | Reason |
|-----------|-------|--------|
**Summary:** X resolved, Y skipped
Seer 審查觸發條件
| 觸發條件 | 時間點 |
|---|---|
| PR 設定為 "Ready for Review" | 自動錯誤預測 |
| PR 處於 Ready 狀態時 push 了 commit | 重新執行預測 |
@sentry review 留言 |
手動觸發完整審查與修復建議 |
| 草稿 PR (Draft PR) | 跳過 — 直到標記為 Ready 才進行審查 |
疑難排解
| 問題 | 解決方案 |
|---|---|
| 找不到 Seer 留言 | 確認存放庫是否已安裝 Seer GitHub App |
| Bot 名稱不符合 | 登入名稱應為 seer-by-sentry[bot],非 sentry[bot] |
| 新 PR 上未出現留言 | PR 必須處於 "Ready for Review" 狀態(不能是 Draft) |
gh api 傳回部分結果 |
確保包含 --paginate 旗標 |
常見問題類型
| 類別 | 範例 |
|---|---|
| 型別安全 (Type Safety) | 缺少 null 檢查、不安全的型別斷言 |
| 錯誤處理 (Error Handling) | 忽略/吞掉錯誤 (swallowed errors)、缺少邊界處理 |
| 驗證 (Validation) | 過於寬鬆的輸入、缺少清理過濾 (sanitization) |
| 設定 (Config) | 缺少環境變數、路徑不正確 |






