Error Handling Agent Skill
Structured errors, React error boundaries, and graceful degradation.
The Skill
Full content, every format. Copy it, download it, or install with one command.
---
description: Structured errors, React error boundaries, and graceful degradation.
homepage: https://yepapi.com/skills/error-handling
metadata:
tags: [errors, error-handling, boundaries, resilience]
---
# Error Handling
## Rules
- Structured error types: `class AppError extends Error { code: string; statusCode: number }`
- Error boundaries in React for crash recovery — show fallback UI, log error
- Graceful degradation: feature fails → show message, don't crash app
- User-friendly messages: "Something went wrong" not stack traces
- Log errors with context: user ID, request ID, timestamp, error code
- Retry transient errors (network, 502, 429) with exponential backoff — max 3 retries
- Fail fast on validation errors — return 400 immediately, don't process further
- Never swallow errors with empty catch blocks — at minimum, log themInstall
Why Use the Error Handling Skill?
Without this skill, your AI guesses at error handling patterns. It might hallucinate deprecated APIs, use outdated conventions, or miss best practices entirely. With it, your AI follows a proven ruleset — every suggestion aligns with current standards.
Drop this skill into your project and your AI instantly knows the rules. Better code suggestions, fewer errors, faster shipping.
Try These Prompts
These prompts work better with the Error Handling skill installed. Your AI knows the context and writes code that fits.
"Add structured error handling with custom error classes and React error boundaries"
"Create a global error handler that logs to Sentry and shows user-friendly error messages"
"Build a resilient API layer with retry logic, circuit breakers, and graceful degradation"
Error Handling skill — FAQ
It enforces structured error classes, React error boundaries, and graceful degradation patterns. Your AI writes code with proper error handling instead of letting exceptions propagate silently.
Run `npx skills add YepAPI/skills --skill error-handling` in your project root. This copies the skill file into your repo where your AI coding tool can read it automatically.
Use both. React error boundaries catch rendering errors and show fallback UI. Try-catch handles async errors in event handlers and API calls. The skill covers both patterns with Sentry integration.