principle-error-handling

Standardize error handling with explicit classification, wrapping, retries, and boundary logging.

2|8|Updated Apr 20, 2026
One-click install
npx skills add https://github.com/lugassawan/swe-workbench --skill principle-error-handling
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: principle-error-handling
Source: https://github.com/lugassawan/swe-workbench/tree/main/skills/principle-error-handling
Command: npx skills add https://github.com/lugassawan/swe-workbench --skill principle-error-handling

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It prevents silent failures and confusing bugs by enforcing consistent error modeling, classification, wrapping, retry logic, timeouts, and boundary logging.

Core Features & Use Cases

  • Error contracts that callers can reason about: use value-based errors (e.g., Go error, Rust Result, TypeScript typed errors) and reserve exceptions/panics for programmer errors.
  • Correct handling strategies via classification: distinguish transient, permanent, and programmer errors to decide whether to retry, fail fast, or crash.
  • Context-preserving error chains: wrap and propagate original causes so downstream diagnostics remain accurate.
  • Retry/backoff with safety rails: apply exponential backoff with jitter, enforce retry budgets, and ensure idempotency before retrying.
  • Deadline-aware reliability: propagate timeouts/deadlines correctly and return distinct timeout/deadline exceeded failures.
  • Boundary logging discipline: log once at the layer that handles the error, and never log from libraries.
  • Resilience patterns where needed: use circuit breakers and bulkheads to prevent cascading failures instead of over-retrying.

Quick Start

Ask an AI to review your function or API design for error classification, context-wrapping, retry/idempotency safety, timeout/deadline propagation, and log-once boundary placement for your target language.

Frequently Asked Questions about principle-error-handling

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement retry with exponential backoff and jitter safely?

Safe retry with exponential backoff requires enforcing retry budgets, applying jitter to avoid thundering herds, and ensuring idempotency before retrying operations to prevent duplicate side effects.

What is the best way to classify transient, permanent, and programmer errors?

Error classification distinguishes transient failures for retries, permanent failures to fail fast, and programmer errors to crash, allowing systems to apply the correct handling strategy based on error type.

How do I propagate timeouts and deadlines across service layers?

Deadline-aware reliability propagates timeouts and deadlines correctly across service layers and returns distinct timeout or deadline exceeded failures to ensure accurate downstream diagnostics.

Why should libraries avoid logging errors directly?

Boundary logging discipline dictates logging errors exactly once at the layer that handles them, preventing duplicate logs and confusing diagnostics when libraries log directly.

When should I use circuit breakers instead of retrying failed requests?

Use circuit breakers and bulkheads to prevent cascading failures when over-retrying occurs, stopping traffic to failing services instead of continuously attempting retries that exacerbate system load.

How do I preserve context when wrapping errors across application layers?

Context-preserving error chains wrap and propagate original causes correctly, ensuring downstream diagnostics remain accurate by maintaining the full context of the failure across application boundaries.