idempotency-test-authorlisted
Install: claude install-skill testland/qa
# idempotency-test-author
## Overview
Authors idempotency tests for any handler where the same input can be
processed twice. Uses the industry-standard idempotency-key pattern
(client sends a unique key per logical operation; the server records
`key -> response` and returns the cached response on duplicates) plus
commutative-side-effect designs for systems that cannot add keys.
Sources in References.
[aws-idem]: https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/
## When to use
- Authoring tests for any handler that mutates state on input.
- Reviewing PRs that add a new POST/PATCH endpoint or job processor.
- The system is on at-least-once delivery (SQS Standard, RabbitMQ
requeue) - idempotency tests are mandatory, not optional.
- Webhook receivers that must handle vendor-side redelivery.
## Step 1 - Classify delivery semantics
| Semantics | Examples | Test requirement |
|---|---|---|
| Exactly-once | SQS FIFO, Kafka with EOS | Idempotency tests are nice-to-have |
| At-least-once | SQS Standard, RabbitMQ requeue, BullMQ retry, webhook redelivery | **Idempotency tests MANDATORY** |
| At-most-once | UDP, fire-and-forget | Idempotency irrelevant; data-loss tests instead |
Most production systems are at-least-once (or are at-least-once
in failure modes). Default to mandatory tests.
## Step 2 - Idempotency-key pattern
The canonical pattern (per Stripe):
1. Client generates a unique key per logical operation (UUID).
2. Client passes the ke