Prevents silent failures and context loss in error handling. Use when writing try-catch blocks, designing error propagation, reviewing catch blocks, or implementing Result patterns.
If the current repo has its own rules/skills covering this topic (check .claude/rules/ and repo CLAUDE.md), those take precedence — apply this skill only where they're silent.
| Type | Examples | Handling | | ------------ | ---------------------------------- | --------------------------- | | Expected | Validation, Not found, Unauthorized| Return Result type, log info| | Transient| Network timeout, Rate limit | Retry with backoff, log warn| | Unexpected| Null reference, DB crash | Log error, show support ID | | Critical | Auth down, Payment gateway offline | Circuit breaker, alert |
Fail fast for critical dependencies:
await connectToDatabase(); // Throws on failure - app can't run without it
Degrade gracefully for optional features:
const prefs = await loadPreferences(userId).catch(() => DEFAULT_PREFS);
// ❌ Logging at every layer = same error 3x
async function fetchData() {
try { return await fetch(url); }
catch (e) { console.error("Fetch failed:", e); throw e; }
}
// ✅ Log once where handled
async function fetchData() {
const response = await fetch(url);
if (!response.ok) throw new Error(`HTTP ${response.status}`);
return response;
}
// Top level logs the error once
| Pattern | Problem | Fix |
|---------|---------|-----|
| Empty catch blocks | Hides errors | Log or re-throw |
| return false on error | Loses context | Return Result type |
| Generic "Error" messages | Undebuggable | Include what/why/context |
| Logging same error at each layer | Log pollution | Log once at boundary |
| Bare except: / catch (e) all | Catches system signals | Catch specific types |
npx skills add rileyhilliard/handling-errors下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer