error-handlinglisted
Install: claude install-skill akaszubski/autonomous-dev
# Error Handling
Patterns for building resilient Python systems. Focus on recoverability, not just catching exceptions.
## Core Principle
**Handle what you can recover from. Propagate what you can't. Never swallow errors silently.**
## Exception Hierarchy
Design exceptions that help the caller decide what to do.
```python
class AppError(Exception):
"""Base for all application errors. Always catchable as a group."""
class ConfigError(AppError):
"""Configuration is invalid or missing. Not retryable."""
class ExternalServiceError(AppError):
"""External dependency failed. May be retryable."""
class RateLimitError(ExternalServiceError):
"""Rate limit hit. Retryable after delay."""
def __init__(self, message: str, retry_after: float = 60.0):
super().__init__(message)
self.retry_after = retry_after
class ValidationError(AppError):
"""Input data is invalid. Not retryable without fixing input."""
def __init__(self, message: str, field: str | None = None):
super().__init__(message)
self.field = field
```
### Rules
- **One base exception per library/package** — callers can catch everything with one class
- **Categorize by recoverability** — retryable vs not-retryable is the most important distinction
- **Include context** — what failed, what was expected, how to fix it
- **Never inherit from BaseException** — only `Exception` subclasses
## Retry Pattern
Use for transient failures (network, rate limits, temporary un