idempotency

Implement Redis-backed idempotent API operations with Express and FastAPI middleware.

Updated Jan 30, 2026
One-click install
npx skills add https://github.com/jrmatherly/metorial-workspace --skill idempotency
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: idempotency
Source: https://github.com/jrmatherly/metorial-workspace/tree/main/.github/skills/idempotency
Command: npx skills add https://github.com/jrmatherly/metorial-workspace --skill idempotency

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents duplicate side effects by ensuring idempotent API operations across retries, saving time and reducing errors in critical workflows.

Core Features & Use Cases

  • Idempotency Store: Centralized storage for request status, keyed by method, path, and idempotency key.
  • Locking & Replay Prevention: Short-lived processing lock and cached responses to safely replay requests.
  • Cross-Platform Middleware: Implementations for Express (TypeScript) and FastAPI (Python) with Redis as backend.
  • Use Case: Protect payments, order creation, webhooks, and any endpoint susceptible to retry storms.

Quick Start

Install a Redis instance, install the skill’s dependencies, wire in the idempotency middleware, and test by sending repeated requests with the same Idempotency-Key.

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 requests when clients retry webhooks or payments?▼

To prevent duplicate API requests during retries, implement idempotency middleware that uses a Redis-backed store to track request status and cache completed responses keyed by an idempotency key.

What is idempotency in API middleware and how does it protect order creation?▼

Idempotency in API middleware ensures retried requests produce no duplicate side effects by applying a short-lived processing lock and replaying cached responses for operations like order creation.

Can I use Redis idempotency middleware with both FastAPI and Express?▼

Yes, you can use Redis idempotency middleware with both FastAPI and Express. The skill provides cross-platform middleware implementations for FastAPI in Python and Express in TypeScript.

How do I set up idempotent API endpoints with a Redis backend?▼

To set up idempotent API endpoints, install a Redis instance, add the skill dependencies, wire the idempotency middleware into your Express or FastAPI application, and send requests with an Idempotency-Key.

Why does my idempotency implementation need a processing lock and TTL-based caching?▼

An idempotency implementation needs a processing lock to prevent concurrent duplicate processing and TTL-based caching to automatically clear stale completed responses, safely handling retry storms.

What are the limitations of using Redis for idempotency key tracking?▼

Using Redis for idempotency key tracking requires a running Redis instance and depends on TTL-based caching for expiration, meaning stored request statuses and replay prevention locks are short-lived.