sysdesign-idempotency-patterns

Introduce idempotency keys and a dedup store for retried write requests.

Updated Apr 23, 2026
One-click install
npx skills add https://github.com/danilods/matilha-sysdesign-pack --skill sysdesign-idempotency-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sysdesign-idempotency-patterns
Source: https://github.com/danilods/matilha-sysdesign-pack/tree/main/skills/sysdesign-idempotency-patterns
Command: npx skills add https://github.com/danilods/matilha-sysdesign-pack --skill sysdesign-idempotency-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Prevents duplicate side effects on retried write requests by introducing idempotency keys and a dedup store.

Core Features & Use Cases

  • Classify operations by idempotency needs and apply the appropriate contract.
  • Define a stable Idempotency-Key header, TTL policy, and tenant-scoped key design.
  • Choose a dedup store (Redis, DynamoDB, or a relational table) and ensure atomic claim-then-commit.
  • Store the full response for byte-equal replay and enable observability on dedup hit-rates.

Quick Start

Define an Idempotency-Key header for action-like POST endpoints and implement an atomic dedup store with a replayable response contract.

Frequently Asked Questions about sysdesign-idempotency-patterns

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

FAQPage Schema
How do I prevent duplicate side effects on retried write requests?

Make write endpoints idempotent by specifying an Idempotency-Key header and a dedup store with TTL. This implements an atomic claim-then-commit flow that blocks duplicate side effects during retries.

How does an atomic claim-then-commit flow work for API idempotency?

An atomic claim-then-commit flow works by claiming the Idempotency-Key in a dedup store before processing the write request, then committing the final response. This guarantees safe concurrent requests and duplicate prevention.

What is the best way to implement a dedup store for distributed systems?

The best way to implement a dedup store is using Redis, DynamoDB, or a relational table with a TTL policy. This enables tenant-scoped key design and stores full responses for byte-equal replay on retries.

Can I replay the exact same response when a duplicate idempotency key is sent?

Yes, you can replay the exact same response by storing the full response payload in the dedup store. When a retried request hits the same Idempotency-Key, the system returns the stored response for byte-equal replay.

When do I need idempotency patterns for my API endpoints?

You need idempotency patterns for action-like write endpoints such as payments, shipments, orders, and notifications. These endpoints require idempotency when retries and concurrency can cause duplicate operations.