idempotency-keys

Implement idempotency patterns to prevent duplicate side effects in distributed systems.

9|3|Updated Jun 13, 2026
One-click install
npx skills add https://github.com/Sir-chawakorn/sanook-cli --skill idempotency-keys
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: idempotency-keys
Source: https://github.com/Sir-chawakorn/sanook-cli/tree/main/skills/idempotency-keys
Command: npx skills add https://github.com/Sir-chawakorn/sanook-cli --skill idempotency-keys

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill prevents the common issue of double-processing or duplicate side effects (like double-charging or double-creating) when network timeouts or retries occur in distributed systems.

Core Features & Use Cases

  • Idempotency Design: Provides patterns for naturally repeatable operations like PUT/upsert and conditional writes.
  • Key-Based Dedup: Implements client-supplied Idempotency-Key headers to safely replay responses for identical requests.
  • Use Case: Use this when building a payment gateway or webhook consumer to ensure that even if a client retries a request multiple times, the underlying business logic executes exactly once.

Quick Start

Apply the idempotency-keys pattern to the current API endpoint by implementing a database-backed dedup table and wrapping the request flow in an atomic transaction.

Frequently Asked Questions about idempotency-keys

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

FAQPage Schema
How do I prevent duplicate side effects when retrying failed API requests?

To prevent duplicate side effects during API retries, implement client-supplied idempotency keys and a database-backed dedup table to safely replay identical responses without re-executing the underlying business logic.

What is the best way to ensure exactly-once processing for webhook consumers?

The best way to ensure exactly-once processing for webhook consumers is applying idempotency patterns with atomic claim-execute-store flows and TTL-bounded storage for deduplication keys.

How does request fingerprinting work for API deduplication?

Request fingerprinting for API deduplication works by generating unique identifiers from client-supplied headers to match identical retries, storing them in a dedup table to return cached responses instead of duplicating effects.

Do I need a database transaction to implement idempotency keys safely?

Yes, you need a database transaction to implement idempotency keys safely, wrapping the request flow in an atomic claim-execute-store transaction to prevent race conditions during concurrent retries.

When should I use idempotency patterns instead of natural upsert operations?

Use idempotency patterns instead of natural upsert operations when handling payment gateways or complex distributed systems where operations lack inherent conditional writes and require explicit key-based deduplication.

Why does at-least-once delivery cause double-charging in distributed systems?

At-least-once delivery causes double-charging in distributed systems because network timeouts trigger retries that re-execute non-idempotent operations, a problem solved by implementing TTL-bounded idempotency key storage.