error-handling
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.
What this skill does
# 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](references/error-patterns.md) | | Explicit handling (no throws) | Result/Either type | [error-patterns.md](references/error-patterns.md) | | React component crash | Error boundary | [react-errors.md](references/react-errors.md) | | API error response | Structured API errors | [api-errors.md](references/api-errors.md) | | Network calls that fail | Retry with backoff | [recovery-patterns.md](references/recovery-patterns.md) | | Unreliable downstream service | Circuit breaker | [recovery-patterns.md](references/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](references/error-patterns.md) | Custom errors, Result types, error hierarchies | | [react-errors.md](references/react-errors.md) | Error boundaries, Suspense, React error handling | | [api-errors.md](references/api-errors.md) | HTTP errors, response shapes, status codes | | [recovery-patterns.md](references/recovery-patterns.md) | Retry, circuit breaker, fallbacks, degradation | | [overview.md](references/overview.md) | Error types, Result pattern, user messages, tracking, anti-patterns | | [anti-rationalization.md](references/anti-rationalization.md) | Iron Law, common rationalizations, red flag STOP list for error handling discipline | | [tdd-patterns.md](references/tdd-patterns.md) | Test-first patterns for error paths, retry logic, boundaries | | [review-checklist.md](references/review-checklist.md) | Error handling review checklist (classes, messages, recovery, tracking) |
Related in Web Dev
generating-lwc-components
IncludedLightning Web Components with PICKLES methodology and 165-point scoring. Use this skill when the user creates or edits LWC components, builds wire service patterns, or writes Jest tests for LWC. TRIGGER when: user creates/edits LWC components, touches lwc/**/*.js, .html, .css, .js-meta.xml files, or asks about wire service, SLDS, or Jest LWC tests. DO NOT TRIGGER when: Apex classes (use generating-apex), Aura components, or Visualforce.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Set up queries with useQuery, mutations with useMutation, configure QueryClient caching strategies, implement optimistic updates, and handle infinite scroll with useInfiniteQuery. Use when: setting up data fetching in React projects, migrating from v4 to v5, or fixing object syntax required errors, query callbacks removed issues, cacheTime renamed to gcTime, isPending vs isLoading confusion, keepPreviousData removed problems.
document-processor-api
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
nutrient-document-processing
IncludedProcess documents with Nutrient DWS. Use when the user wants to generate PDFs from HTML or URLs, convert Office/images/PDFs, assemble or split packets, OCR scans, extract text/tables/key-value pairs, redact PII, watermark, sign, fill forms, optimize PDFs, or produce compliance outputs like PDF/A or PDF/UA. Triggers include convert to PDF, merge these PDFs, OCR this scan, extract tables, redact PII, sign this PDF, make this PDF/A, or linearize for web delivery.
tanstack-query
IncludedManage server state in React with TanStack Query v5. Covers useMutationState, simplified optimistic updates, throwOnError, network mode (offline/PWA), and infiniteQueryOptions. Use when setting up data fetching, fixing v4→v5 migration errors (object syntax, gcTime, isPending, keepPreviousData), or debugging SSR/hydration issues with streaming server components.
accelint-nextjs-best-practices
IncludedNext.js performance optimization and best practices. Use when writing Next.js code (App Router or Pages Router); implementing Server Components, Server Actions, or API routes; optimizing RSC serialization, data fetching, or server-side rendering; reviewing Next.js code for performance issues; fixing authentication in Server Actions; or implementing Suspense boundaries, parallel data fetching, or request deduplication.