Skip to content
aj-geddes avatar

Idempotency Handling

Guide for building idempotent operations so retries never cause duplicate effects.

CCM score
42 of 100
skills.sh installs
468
GitHub stars
396
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers idempotency keys, stored request and response pairs, and TTL-based cleanup of old records
  • Includes a Redis-backed Express example plus reference guides for database-based, Stripe-style, and message queue idempotency
  • Enforces rules such as validating that a retried request body matches the stored request and never applying it to GET requests
  • Designed for payment systems, retrying APIs, webhooks, message queue consumers, and distributed transactions

Install

$ npx -y skills add aj-geddes/useful-ai-prompts --skill idempotency-handling -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Idempotency Handling

Table of Contents

Overview

Implement idempotency to ensure operations produce the same result regardless of how many times they're executed.

When to Use

  • Payment processing
  • API endpoints with retries
  • Webhooks and callbacks
  • Message queue consumers
  • Distributed transactions
  • Bank transfers
  • Order creation
  • Email sending
  • Resource creation

Quick Start

Minimal working example:

import express from "express";
import Redis from "ioredis";
import crypto from "crypto";

interface IdempotentRequest {
  key: string;
  status: "processing" | "completed" | "failed";
  response?: any;
  error?: string;
  createdAt: number;
  completedAt?: number;
}

class IdempotencyService {
  private redis: Redis;
  private ttl = 86400; // 24 hours

  constructor(redisUrl: string) {
    this.redis = new Redis(redisUrl);
  }

Details

Repository
github.com/aj-geddes/useful-ai-prompts
Category
Backend & APIs
First seen
Jun 3, 2026

Questions

What does the idempotency-handling skill do?

The idempotency-handling skill implements idempotency keys so operations can be safely retried without duplicate effects. It stores each request and its response together, returns the same response for duplicate requests, and handles concurrent requests gracefully.

When should I use idempotency-handling?

Use idempotency-handling when building payment systems, APIs with retries, webhooks, message queue consumers, bank transfers, order creation or email sending. It is aimed at distributed transactions and resource creation where a repeated call must not repeat its effect.

How do I install idempotency-handling?

Run npx -y skills add aj-geddes/useful-ai-prompts --skill idempotency-handling -y in your project. Once installed, idempotency-handling lets the agent add idempotency keys and duplicate-safe handling to your API and payment code.

Where does idempotency-handling stand in the Backend & APIs category?

idempotency-handling is listed in the Backend & APIs category on Claude Marketplaces, alongside entra-app-registration, neon, firebase-basics, firebase-auth-basics and workers-best-practices. It stands apart by focusing on retry safety through keyed request storage and response replay.

More from aj-geddes/useful-ai-prompts

All 258

Similar to Idempotency Handling

More Backend & APIs