retry-patterns

Implement retry logic with exponential backoff and jitter for transient failures.

4|1|Updated Mar 15, 2026
One-click install
npx skills add https://github.com/FaysilAlshareef/dotnet-ai-kit --skill retry-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: retry-patterns
Source: https://github.com/FaysilAlshareef/dotnet-ai-kit/tree/main/skills/resilience/retry-patterns
Command: npx skills add https://github.com/FaysilAlshareef/dotnet-ai-kit --skill retry-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides clear guidance and practical code patterns to make network, database, and message operations resilient to transient failures by implementing retries with exponential backoff and jitter while avoiding common pitfalls like retry storms or duplicated side effects.

Core Features & Use Cases

  • HTTP resilience: Configure HttpClient pipelines to retry on 5xx and rate-limit responses, respect Retry-After headers, and log retry events for observability.
  • Database and queue retries: Use EF Core retry settings or custom resilience pipelines for transient SQL errors and message queue operations with capped delays and jitter.
  • Idempotency and safety: Recommend idempotency keys for non-idempotent operations and show when not to retry business errors such as 4xx responses.

Quick Start

Add a retry pipeline with exponential backoff and jitter to your HTTP client configuration and ensure non-idempotent requests include idempotency keys.

Frequently Asked Questions about retry-patterns

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

FAQPage Schema
How do I implement exponential backoff and jitter for HTTP request retries?

Exponential backoff and jitter for HTTP request retries are implemented by configuring an HttpClient pipeline with incremental delays, respecting Retry-After headers on 5xx and rate-limit responses, and applying randomized jitter to prevent thundering herd effects.

What is the best way to handle transient SQL database connection failures?

Handling transient SQL database failures involves applying custom resilience pipelines or EF Core retry settings with capped delays and jitter to automatically recover from temporary connection issues without overwhelming the database server.

Why do I need an idempotency key when retrying network operations?

An idempotency key is needed when retrying network operations to prevent duplicated side effects during non-idempotent operations, ensuring that multiple identical requests resulting from transient failures are processed only once by the receiving service.

When should I avoid retrying HTTP 4xx client error responses?

Retrying HTTP 4xx client error responses should be avoided because these represent business logic or validation errors rather than transient failures, meaning repeated attempts will yield the same failure without improving reliability.

Can I use Polly to add resilience pipelines for message queue operations?

Polly resilience pipelines can be applied to message queue operations by adding retry logic with capped delays and jitter to handle transient messaging errors, ensuring reliable message-publishing across distributed networked systems.