error-handling
Agent skill fromCloudAI-X/claude-workflow-v2
Implements error handling patterns, structured logging, retry strategies, circuit breakers, and graceful degradation. Use when designing error handling, setting up logging, implementing retries, adding error tracking, or when asked about error boundaries, log aggregation, alerting, or resilience patterns.
How to install error-handling
install error-handling
# install the claude-workflow-v2 pack with the skills CLI
npx skills add CloudAI-X/claude-workflow-v2# or add only this skill to Claude Code: copy the folder
skills/error-handling/
# into
~/.claude/skills/error-handling/ (all projects)
.claude/skills/error-handling/ (one project)
1# Error Handling & Observability23### When to Load45- **Trigger**: Try/catch patterns, retry logic, error responses, circuit breakers, structured logging6- **Skip**: No error handling or observability involved in the current task78## Error Handling Workflow910Copy this checklist and track progress:1112```13Error Handling Progress:14- [ ] Step 1: Define error taxonomy (categories and severity)15- [ ] Step 2: Implement error handling by layer16- [ ] Step 3: Set up structured logging17- [ ] Step 4: Add retry and circuit breaker patterns18- [ ] Step 5: Configure error tracking service19- [ ] Step 6: Define user-facing error messages20- [ ] Step 7: Validate against anti-patterns checklist21```2223## Error Handling Patterns by Language2425### JavaScript / TypeScript2627```typescript28// Custom error hierarchy29class AppError extends Error {30 constructor(31 message: string,32 public statusCode: number = 500,33 public code: string = "INTERNAL_ERROR",34 public isOperational: boolean = true,35 ) {36 super(message);37 this.name = this.constructor.name;38 }39}40class NotFoundError extends AppError {41 constructor(resource: string, id: string) {42 super(`${resource} with id ${id} not found`, 404, "NOT_FOUND");43 }44}45class ValidationError extends AppError {46 constructor(public errors: Record<string, string[]>) {47 super("Validation failed", 400, "VALIDATION_ERROR");48 }49}5051// WRONG: Swallowing errors silently52try {53 await saveUser(data);54} catch (e) {55 // nothing here -- bug hides forever56}57…
Excerpt shown under the repository's MIT license.
