ai-output-validation
Validates, parses, and sanitizes AI-generated outputs before they reach end users or downstream systems. Structured output enforcement, schema validation, and…
Graceful degradation and meaningful error messages. Errors are first-class citizens, not afterthoughts. Every error path is designed, not discovered.
$ npx -y skills add DevelopersGlobal/ai-agent-skills --skill error-handling --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/error-handlingContext preview
The summary Claude sees to decide when to auto-load this skill.
Graceful degradation and meaningful error messages. Errors are first-class citizens, not afterthoughts. Every error path is designed, not discovered.
name: error-handling description: Graceful degradation and meaningful error messages. Errors are first-class citizens, not afterthoughts. Every error path is designed, not discovered. category: harden applies-to: [claude, gemini, cursor, copilot, any] version: 1.0.0
Error handling is not defensive programming — it's a user experience. When things go wrong (and they will), the system should degrade gracefully, give users actionable information, and leave enough telemetry to diagnose and fix the problem.
1. For every operation, list: what can fail? What does failure look like? 2. Classify failures:
3. Design the failure path for each class before writing the happy path.
**Verify:** Error classes defined for every external operation.
4. Every error message answers: what went wrong? How can the caller fix it?
5. User-facing errors: friendly language, no stack traces. 6. Developer-facing errors (logs): full context, request ID, stack trace. 7. Never expose internal system details (DB schema, file paths) in user-facing errors.
**Verify:** Each error message would help a user or developer understand and fix the problem.
8. Transient errors: retry with exponential backoff + jitter. 9. Maximum retries: 3 (not infinite). 10. After max retries: fail with a clear error, log the final failure. 11. Non-transient errors (validation, auth): never retry.
**Verify:** Retry logic has a maximum. Non-transient errors don't retry.
12. Identify non-critical dependencies. If they fail, degrade — don't crash. 13. Example: recommendation engine fails → show default content, not 500. 14. Circuit breaker pattern for failing dependencies: fail fast after threshold, recover automatically.
**Verify:** Every non-critical dependency has a defined degraded state.
15. API errors return consistent structure:
{
"error": {
"code": "INVALID_EMAIL",
"message": "The email address format is invalid.",
"requestId": "req_abc123"
}
}16. HTTP status codes used correctly: 400 (client error), 404 (not found), 429 (rate limited), 500 (server error).
| Excuse | Rebuttal | |--------|----------| | "I'll add error handling later" | Later means in production, under pressure, while users are impacted. | | "This can't fail" | Everything can fail. Network calls, disk writes, parsing — all can fail. | | "The error message doesn't matter" | It matters when a developer is debugging at 2am. |
AI agent skills for production grade applications
Validates, parses, and sanitizes AI-generated outputs before they reach end users or downstream systems. Structured output enforcement, schema validation, and…
Design stable, versioned, self-documenting APIs. Easy to use correctly, hard to use incorrectly. Apply Hyrum's Law from day one.
Automated quality gates from commit to production. Every merge to main is potentially shippable. No manual steps in the deployment path.
Get layered, context-aware explanations of unfamiliar code. Understand what it does, why it was written that way, and how to work with it safely.
Structured code review focusing on correctness, security, and maintainability. Correctness before style. Every reviewer comment must be actionable.
Load minimum necessary context into agent context windows. Prevents token bloat, reduces cost, and improves focus. Only load what the current task needs.