idempotency

Ensures identical POST-like requests are processed only once via keyed lookup.

13|2|Updated Jan 21, 2026
One-click install
npx skills add https://github.com/yanko-belov/code-craft --skill idempotency-yanko-belov
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: idempotency
Source: https://github.com/yanko-belov/code-craft/tree/main/skills/idempotency
Command: npx skills add https://github.com/yanko-belov/code-craft --skill idempotency-yanko-belov

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Idempotency protects against duplicate mutations caused by network timeouts, retries, or double-clicks by requiring a unique idempotency key for each operation.

Core Features & Use Cases

  • Enforces Idempotency-Key headers on critical mutations.
  • Caches successful responses and errors by idempotency key to ensure consistent results on retries.
  • Applies to payments, order creation, inventory adjustments, and any mutation that must not execute twice.

Quick Start

  1. Generate a unique idempotency key on the client for each mutation.
  2. Include the key in the Idempotency-Key header when calling the API.
  3. On the first request, process the operation and store the response; on subsequent requests with the same key, return the cached response without reprocessing.

Frequently Asked Questions about idempotency

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

FAQPage Schema
How do I prevent duplicate API mutations caused by network retries or double-clicks?

You prevent duplicate API mutations by enforcing an Idempotency-Key header on critical requests and caching the initial response. Subsequent retries using the same idempotency key return the cached result without reprocessing the mutation.

What is an idempotency key and how does it work for backend APIs?

An idempotency key is a unique client-generated identifier sent in the Idempotency-Key header. The backend checks a durable key store for existing requests, returning cached responses for duplicates while executing only the first mutation.

When do I need idempotency for API endpoints?

You need idempotency for critical, non-repeatable API operations like payments, order creation, and inventory adjustments. It guarantees safe retries by preventing network timeouts or double-clicks from executing the same mutation twice.

Do I need a durable key store to implement idempotency for backend mutations?

Yes, implementing idempotency requires a durable key store to track active and completed requests. This persistent storage enables the backend to check for existing keys and cache both successful responses and errors for duplicate requests.

What is the best way to handle idempotency for payment and order processing APIs?

The best way to handle idempotency for payments and orders is requiring a client-generated Idempotency-Key header. The API processes the first request, stores the response, and returns the cached result for subsequent duplicate requests.