# Build Reliable Error Handling

Unhandled failures obscure root causes and weaken application reliability. This skill applies typed errors, retries, circuit breakers, cleanup, and graceful degradation across common programming languages.

## Install

```bash
npx skillstore add sickn33/error-handling-patterns
```

## Metadata

- Status: approved
- Slug: sickn33-error-handling-patterns
- Skillstore revision: r2
- Version status: missing
- Tree hash: bd438039bb1d06d01ba5e88fcd7d766477f84bb00ef821cee545b8e708404473
- Author: sickn33
- GitHub username: sickn33
- License: MIT
- Repository: https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/error-handling-patterns
- Ref: 88a8e9a07f4c54ab105c1c41b6267c287146b07b
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: allowed
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Risk factors: external\_commands, network
- Quality score: 78
- Quality tier: bronze
- Public page: https://skillstore.pages.dev/skills/sickn33-error-handling-patterns
- Manifest: https://skillstore.pages.dev/api/skills/sickn33-error-handling-patterns/manifest

## Capabilities

- Designs custom exception hierarchies and typed Result patterns for Python, TypeScript, Rust, and Go.
- Applies retry, exponential backoff, circuit breaker, error aggregation, and graceful degradation patterns.
- Reviews asynchronous and promise-based failure handling.
- Recommends context preservation, cleanup, logging, wrapping, and user-focused messages.
- Produces verification steps for application-specific error handling changes.

## Use Cases

- Standardize API Errors: Define typed failures, stable error codes, safe client messages, and consistent status mappings for an application API.
- Protect External Dependencies: Add bounded retries, timeouts, circuit breakers, and fallbacks around unreliable services without hiding the original cause.
- Review Team Practices: Create shared guidance for logging, cleanup, error propagation, async failures, and focused reliability tests.

## Prompt Templates

### Add Basic Error Handling

```
Review this function and add clear validation, typed errors, cleanup, and useful messages. Explain each change and suggest focused tests.
```

### Design API Errors

```
Design an error model for this API. Define categories, status mappings, stable codes, safe client messages, logging context, and tests.
```

### Harden a Service Dependency

```
Refactor this service call with bounded retries, exponential backoff, timeout handling, and a circuit breaker. Preserve the original error context.
```

### Audit Distributed Failure Handling

```
Audit this distributed workflow for partial failures and cascading risk. Propose idempotency, compensation, graceful degradation, aggregation, observability, and chaos-test scenarios.
```

## Limitations

- Provides reference patterns, not executable tooling or automated code analysis.
- Requires project context to choose appropriate recovery behavior and retry limits.
- Does not replace environment-specific testing, observability, or expert review.
- Example snippets may require imports, types, and production safeguards before use.

## Best Practices

- Classify failures before choosing retry, fallback, propagation, or termination behavior.
- Preserve the original cause and useful context while keeping sensitive details out of user-facing messages.
- Verify failure paths with focused tests, cleanup checks, and observable recovery behavior.

## Anti Patterns

- Do not catch broad exceptions unless the handler can recover, add context, or rethrow safely.
- Do not retry validation, authentication, or other permanent failures.
- Do not swallow async errors or return generic messages without preserving diagnostic context.

## Security Audit

- Audited at: 2026-07-23T23:56:58.294\+00:00
- Summary: All 16 static findings are false positives. The backticks are Markdown references or JavaScript template literals, network calls are illustrative examples, and flagged identifiers are ordinary sample code. No prompt injection, exfiltration intent, or executable automation was found.

## Stats

- Views: 136
- Downloads: 8
- Favorites: 0
- Popularity score: 0
