Best for
- Designing how a new feature, API, or service reports failure.
- Reviewing a diff that introduces a new exception class, Result, or sentinel return.
- Debugging production noise that traces back to inconsistent error semantics.
event4u-app/agent-config/src/skills/error-handling-patterns/SKILL.md
Use when picking a failure-reporting strategy — exceptions vs Result types, recoverable vs not, retry / circuit-breaker / graceful degradation — decision framework only, catalogues externalized.
Decision brief
Decision framework for picking an error-handling strategy. Catalogues of language-specific code live upstream (links in § Provenance) — this skill is the predicate, not the pattern library. Sunset-policy compliant: large language-specific catalogues stay in authoritative upstrea…
Compatibility matrix
| Platform | Status | Evidence | What to check |
|---|---|---|---|
| Codex | Not declared | No explicit evidence | Portability before use |
| Claude Code | Not declared | No explicit evidence | Portability before use |
| Cursor | Not declared | No explicit evidence | Portability before use |
| Gemini CLI | Not declared | No explicit evidence | Portability before use |
Installation
The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.
npx skills add https://github.com/event4u-app/agent-config --skill "src/skills/error-handling-patterns"Inspect the Agent Skill "error-handling-patterns" from https://github.com/event4u-app/agent-config/blob/0adf49a8ae84b0ff6e2de8759eea43257e020eff/src/skills/error-handling-patterns/SKILL.md at commit 0adf49a8ae84b0ff6e2de8759eea43257e020eff. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.
Workflow
Review the “Step 1 — Classify the failure” section in the pinned source before continuing.
Review the “Step 2 — Pick the reporting mechanism” section in the pinned source before continuing.
Review the “Step 3 — Pick the resilience strategy” section in the pinned source before continuing.
Every produced error must carry: code (stable string), message (human-readable), cause (chained), context (sanitized inputs), correlationid (request / trace).
Exactly one layer translates internal errors to the egress format (HTTP status + body, queue requeue policy, CLI exit code). Anywhere else doing this duplication is the bug.
Permission review
The documentation asks the agent to run terminal commands or scripts.
Python/PHP/JS: exceptions)Evidence record
| Signal | Value | Evidence type | Meaning |
|---|---|---|---|
| Quality score | 95/100 | Computed | Documentation, specificity, maintenance, and trust rules |
| Repository stars | 7 | Source | Repository attention, not individual Skill quality |
| Compatibility | 0 platforms | Source | Declared in the catalog source record |
| Usage guide | automated source guide | Editorial | Generated or reviewed according to the visible evidence level |
Pinned source
Decision framework for picking an error-handling strategy. Catalogues of language-specific code live upstream (links in § Provenance) — this skill is the predicate, not the pattern library. Sunset-policy compliant: large language-specific catalogues stay in authoritative upstream docs.
Result<T, E>, or sentinel return.Do NOT use when:
try/catch in language X — read the upstream language guide directly.laravel-validation.bug-analyzer.Failure is:
caller's fault (bad input, missing auth) → reject at boundary, structured error
expected operational (timeout, 404, rate-limit) → Result-type / typed return; retry-aware
unexpected operational (DB down, OOM, deadlock) → exception; observability + alert
programmer bug (null deref, off-by-one) → crash early; do not catch
IF failure is an EXPECTED, branchable outcome the caller will route on
→ Result type / tagged union / typed error return.
Forces the caller to handle it; the type system is the proof.
IF failure is UNEXPECTED and most callers cannot do anything useful
→ exception, propagated to a single boundary handler.
One layer (HTTP, queue, CLI) translates exceptions to user-facing errors.
IF failure is UNRECOVERABLE (invariant violated, data corruption)
→ fail loud, fail fast. No catch-and-continue.
Log structured context, exit / panic / 500.
IF the language idiom forces one choice (Go: errors are values; Rust: Result;
Python/PHP/JS: exceptions)
→ follow the idiom. Inventing a foreign mechanism is more cost than the
correctness it buys.
External call?
Idempotent + transient failure mode → retry with exponential backoff + jitter, cap.
Non-idempotent → no blind retry; require an idempotency key.
Repeated failure across instances → circuit breaker; open → half-open probe → close.
Optional functionality → graceful degradation (cached / default / null result).
Required functionality → propagate; surface to user with a recovery hint.
Every produced error must carry: code (stable string), message (human-readable), cause (chained), context (sanitized inputs), correlation_id (request / trace).
Forbidden: secrets, raw SQL, full stack traces in user-facing surfaces, internal class names leaked through API boundaries.
Exactly one layer translates internal errors to the egress format (HTTP status + body, queue requeue policy, CLI exit code). Anywhere else doing this duplication is the bug.
refresh_trigger above.defense-in-depth, laravel-validation, bug-analyzer, api-design.agents/settings/contexts/skills-provenance.yml (entry: error-handling-patterns).verify-before-complete, skill-quality, non-destructive-by-default.Alternatives
K-Dense-AI/scientific-agent-skills
Use when working directly with the `esm` Python SDK, ESM3 or ESMC model IDs, Forge/Biohub inference clients, or ESMFold2 folding workflows.
event4u-app/agent-config
ONLY when user asks for single-pass tech-stack detection or `agents/evidence/analysis/` write-up. Deep multi-pass audit → `universal-project-analysis`. Raw primitives → `project-analysis-core`.
event4u-app/agent-config
Use when creating or rewriting a README for a reusable package or library. Focus on installability, minimal usage example, compatibility, and developer onboarding.
github/awesome-copilot
Import existing Azure resources into Terraform using Azure CLI discovery and Azure Verified Modules (AVM). Use when asked to reverse-engineer live Azure infrastructure, generate Infrastructure as Code from existing subscriptions/resource groups/resource IDs, map dependencies, derive exact import addresses from downloaded module source, prevent configuration drift, and produce AVM-based Terraform files ready for validation and planning across any Azure resource type.