go-idempotent-retry-patterns

Implement context-aware retry with backoff and error classification in Go.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/PremModhaOfficial/sdk-pipeline --skill go-idempotent-retry-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: go-idempotent-retry-patterns
Source: https://github.com/PremModhaOfficial/sdk-pipeline/tree/main/skills/go-idempotent-retry-patterns
Command: npx skills add https://github.com/PremModhaOfficial/sdk-pipeline --skill go-idempotent-retry-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides robust retry mechanisms for Go SDK operations to ensure resilience against transient errors and network issues.

Core Features & Use Cases

  • Error Retry Predicate: Implements a function to determine if an error is retryable based on sentinel comparisons and error types.
  • Context-Aware Backoff: Provides a pattern for exponential backoff with jitter that respects context cancellation, preventing goroutine leaks.
  • Idempotency Support: Includes guidance on using message IDs for server-side deduplication with JetStream and header-based idempotency for HTTP.
  • Use Case: Ensuring message publishing retries do not cause duplicate data insertion in high-reliability systems.

Quick Start

Integrate the provided IsRetryable predicate and executeWithRetry function into your Go application to handle transient errors gracefully during message publishing.

Frequently Asked Questions about go-idempotent-retry-patterns

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

FAQPage Schema
How do I implement retry logic in Go to handle transient errors?

Implement retry logic in Go by integrating an IsRetryable predicate to classify error types and an executeWithRetry function that applies context-aware exponential backoff with jitter.

How does context-aware backoff prevent goroutine leaks during SDK retries?

Context-aware backoff prevents goroutine leaks by ensuring exponential backoff with jitter respects context cancellation, gracefully terminating pending retry loops when operations are aborted.

How do I ensure idempotency in Go message publishing to avoid duplicate data?

Ensure idempotency in Go message publishing by using message IDs for server-side deduplication with JetStream and applying header-based idempotency for HTTP requests during retry attempts.

What is the best way to classify retryable errors in a Go SDK?

The best way to classify retryable errors in a Go SDK is implementing an error retry predicate that evaluates errors based on sentinel comparisons and specific error types to determine if a retry is safe.

Can I use this retry framework for high-reliability message publishing systems?

Yes, you can use this retry framework for high-reliability message publishing systems, as it specifically ensures retry attempts do not cause duplicate data insertion through robust idempotency support.