Agent skill · software engineering · wshobson
python-resilience
Python resilience patterns including automatic retries, exponential backoff, timeouts, and fault-tolerant decorators. Use when adding retry logic, implementing timeouts, building fault-tolerant services, or handling transient failures.
Why this skill is useful
Provides specific patterns and code snippets for implementing resilience in Python applications that the AI may not generate reliably on its own.
What it needs
Requires httpx, tenacity installed locally. About 3k tokens when loaded. Last updated 2026-08-05. 38,570 stars on the source repository.
What this skill does
Python Resilience Patterns Build fault-tolerant Python applications that gracefully handle transient failures, network issues, and service outages. Resilience patterns keep systems running when dependencies are unreliable. When to Use This Skill Adding retry logic to external service calls Implementing timeouts for network operations Building fault-tolerant microservices Handling rate limiting and backpressure Creating infrastructure decorators Designing circuit breakers Core Concepts 1. Transient vs Permanent Failures Retry transient errors (network timeouts, temporary service issues). Don't retry permanent errors (invalid credentials, bad requests). 2. Exponential Backoff Increase wait time between retries to avoid overwhelming recovering services. 3. Jitter Add randomness to backoff to prevent thundering herd when many clients retry simultaneously. 4. Bounded Retries Cap both attempt count and total duration to prevent infinite retry loops. Quick Start Fundamental Patterns Pattern 1: Basic Retry with Tenacity Use the tenacity library for production-grade retry logic. For simpler cases, consider built-in retry functionality or a lightweight custom implementation. Pattern 2: Retry Only Appropriate Errors Whitelist specific transient exceptions. Never retry: ValueError, TypeError - These are bugs, not transient issues AuthenticationError - Invalid credentials won't become valid HTTP 4xx errors (except 429) - Client errors are permanent Pattern 3: HTTP Status Code Retries Retry specific HTTP status codes that indicate transient issues. Pattern 4: Combined Exception and Status Retry Handle both network exceptions and HTTP status codes. Detailed worked examples and patterns Detailed sections (starting with ## Advanced Patterns) live in references/details.md. Read that file when the navigation summary above is insufficient. Best Practices Summary 1. Retry only transient errors - Don't retry bugs or authentication failures 2. …
How to use it
Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:
@skills wshobson/python-resilience