AGENT SKILL

error-handling

Error envelopes, boundaries, and never-swallow rules for APIs and UI. Use when writing fallible logic on either side.

License 许可
MIT
最近更新
2026-10-20
Stars
★ 0
Forks
0

01 前言 Front Matter

name
error-handling
license
MIT
description
Error envelopes, boundaries, and never-swallow rules for APIs and UI. Use when writing fallible logic on either side.
compatibility
opencode

03 SKILL.md 正文

What I do

  • Make every failure explicit, typed, and safe to show.

When to use me

Use when writing fallible logic — API handlers, services, data fetching, forms.

Rules

  1. Backend envelope: errors return the shared shape (code, message, per-field details); 4xx for caller faults, 5xx for ours; never stack traces or SQL text to clients — log those server-side with a correlation id.
  2. Never swallow: no empty catch, no ignored rejections; catching without rethrow or a typed user-facing error fails review — log-and-continue only at the top-level boundary.
  3. UI boundaries: every async flow renders loading → success | friendly-error-with-retry; forms show field-level errors plus a summary.
  4. Fail fast: validate at system boundaries (request schemas, function preconditions) and reject with clear messages before side effects.

04 同仓库更多 Skills