backend-error-handling
Installation
SKILL.md
Error Handling Skill
Degree of freedom: MIXED. Which layer and message [HIGH freedom];
existing-type/boundary probes [LOW freedom — run exactly].
How to reason
- Observe — existing error types, boundaries,
ActionResult/ApiError - Interpret — missing layer vs inconsistent shape vs swallowed catch
- Classify — reuse-existing / extend-codes / add-boundary / toast-only
- Severity — unhandled 500 on a mutation outranks a missing toast
Worked example
Observe:
createUserthrows PrismaP2002; UI shows a blank catch;ActionResultalready lives intypes/errors.ts. Interpret: known conflict is unmapped; no field/toast path. Classify: reuseActionResult+CONFLICT; toast the message; do not add a second error type. Verify: duplicate email returns{ success: false, error: { code: 'CONFLICT' } }; form alert shown.