error-handling-gate
審查錯誤處理品質
程式碼審查常常忽略導致靜默失敗和使用者體驗不佳的錯誤處理問題。此閘道提供結構化的檢查清單,確保所有程式碼都能優雅地處理故障並提供有用的使用者回饋。
下载技能 ZIP
在 Claude 中上传
前往 设置 → 功能 → 技能 → 上传技能
开启并开始使用
测试它
正在使用“error-handling-gate”。 Review this function for error handling quality
预期结果:
- ERROR HANDLING GATE: PASSED
- - All async calls wrapped in try/catch
- - User-friendly error messages provided
- - Loading states properly cleaned up
- - Errors logged with context for debugging
正在使用“error-handling-gate”。 Check if error messages are user-friendly
预期结果:
- ERROR HANDLING GATE: WARNING
- - Issue: Technical error shown to users
- - Location: file.ts:88 shows 'TypeError: Cannot read property of undefined'
- - Recommendation: Replace with user-friendly message like 'Something went wrong. Please try again.'
正在使用“error-handling-gate”。 Review error logging for production debugging
预期结果:
- ERROR HANDLING GATE: PASSED
- - Errors include operation context
- - No sensitive data in logs
- - Error types enable categorization
- - Stack traces available in development
安全审计
安全This skill is a pure documentation file containing checklists and guidelines for code review. No executable code, scripts, network calls, or file system access. All 27 static findings are false positives caused by pattern-matching without semantic understanding. The skill contains only markdown documentation and JSON metadata.
风险因素
🌐 网络访问 (1)
📁 文件系统访问 (1)
质量评分
你能构建什么
系統化錯誤審查
使用結構化問題和檢查清單在提取請求審查期間審查錯誤處理。
品質閘道執行
建立錯誤處理標準並驗證提交內容符合品質閾值。
學習錯誤模式
研究常見的錯誤處理錯誤,並從提供的範例中學習最佳實踐。
试试这些提示
審查此程式碼的錯誤處理。檢查空的 catch 區塊、載入狀態清理和使用者友好的訊息。
使用者會看到什麼錯誤訊息?這些訊息是否可操作且不含技術術語?
當網路失敗、驗證失敗或第三方 API 傳回錯誤時會發生什麼?逐步檢視每種失敗模式。
如果生產環境中出現問題,我們要如何除錯?審查錯誤記錄和提供的上下文。
最佳实践
- 始終將非同步操作包裝在 try/catch 中,並包含有意義的錯誤上下文
- 提供使用者友好的錯誤訊息,說明哪裡出了問題並建議下一步
- 使用 finally 區塊確保載入狀態和資源始終被清理
避免
- 空的 catch 區塊會靜默地吞噬錯誤,沒有任何記錄或使用者回饋
- 向使用者暴露技術性錯誤訊息,如 'TypeError: Cannot read property of undefined'
- 缺少載入狀態清理,導致 UI 在失敗後卡在旋轉狀態