Agent Skills: Error Handling

Comprehensive error handling patterns for robust applications including custom errors, error boundaries, recovery strategies, and user-facing error messages. Use this skill when designing error hierarchies, implementing React error boundaries, adding retry logic or fallbacks, creating API error responses, integrating error tracking (Sentry), or improving user error communication. Triggers on "error handling", "error boundary", "custom error", "retry logic", "graceful degradation", "error tracking", "Sentry", "user error message", "try-catch", "Result type", "circuit breaker".

UncategorizedID: srstomp/pokayokay/error-handling

Install this agent skill to your local

pnpm dlx add-skill https://github.com/srstomp/pokayokay/tree/HEAD/plugins/pokayokay/skills/error-handling

Skill Files

Browse the full folder contents for error-handling.

Download Skill

Loading file tree…

plugins/pokayokay/skills/error-handling/SKILL.md

Skill Metadata

Name
error-handling
Description
Use when designing error hierarchies, implementing React error boundaries, adding retry logic or fallbacks, creating API error responses, integrating error tracking (Sentry), or improving user-facing error communication.

Error Handling

Design resilient applications through intentional error handling strategies. Errors are data, not just exceptions — design them intentionally.

Quick Decision Guide

| Situation | Pattern | Reference | |-----------|---------|-----------| | Typed error categories | Custom error classes | error-patterns.md | | Explicit handling (no throws) | Result/Either type | error-patterns.md | | React component crash | Error boundary | react-errors.md | | API error response | Structured API errors | api-errors.md | | Network calls that fail | Retry with backoff | recovery-patterns.md | | Unreliable downstream service | Circuit breaker | recovery-patterns.md |

Key Principles

  • Debuggable: Rich context, stack traces, correlation IDs
  • Recoverable: Retry logic, fallbacks, circuit breakers
  • User-friendly: Clear messages, recovery guidance, no leaked internals
  • Consistent: Same error shape across all API endpoints

Quick Start Checklist

  1. Define base AppError class with code and context
  2. Create domain-specific error subclasses
  3. Implement consistent API error response shape
  4. Add error boundaries at app, route, and component levels
  5. Set up error tracking (Sentry) with scrubbing

References

| Reference | Description | |-----------|-------------| | error-patterns.md | Custom errors, Result types, error hierarchies | | react-errors.md | Error boundaries, Suspense, React error handling | | api-errors.md | HTTP errors, response shapes, status codes | | recovery-patterns.md | Retry, circuit breaker, fallbacks, degradation | | overview.md | Error types, Result pattern, user messages, tracking, anti-patterns | | anti-rationalization.md | Iron Law, common rationalizations, red flag STOP list for error handling discipline | | tdd-patterns.md | Test-first patterns for error paths, retry logic, boundaries | | review-checklist.md | Error handling review checklist (classes, messages, recovery, tracking) |