Agent skill · software engineering · secondsky

idempotency-handling

Idempotent API operations with idempotency keys, Redis caching, DB constraints. Use for payment systems, webhook retries, safe retries, or encountering duplicate processing, race conditions, key expiry errors.

Why this skill is useful

Adds executable scripts for idempotency handling in payment systems, including Redis caching and database constraints that aren't in public docs.

What it needs

Requires pg, redis installed locally. About 3k tokens when loaded. Last updated 2026-08-06. 204 stars on the source repository.

What this skill does

Idempotency Handling Ensure operations produce identical results regardless of execution count. Idempotency Key Pattern Database-Backed Idempotency When to Apply Payment processing Order creation Webhook handling Email sending Any operation where duplicates cause issues Best Practices Require idempotency keys for mutations Validate request body matches stored request Set appropriate TTL (24 hours typical) Use atomic database operations Implement cleanup jobs to prevent table bloat TTL Cleanup Strategy To prevent unbounded table growth, implement periodic cleanup of expired keys: Option 1: Scheduled Database Job (PostgreSQL) Option 2: Application Cleanup Job (Node.js) Option 3: Application Cleanup Job (Python) Cleanup Best Practices: Run cleanup during low-traffic periods to minimize lock contention Use batched deletes (LIMIT 1000) for large tables Monitor cleanup job execution and failures Consider partitioning the table by createdat for easier cleanup Set up alerts if table size grows unexpectedly

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills secondsky/idempotency-handling

View the source on GitHub

Browse the @skills marketplace