staff-engineering-skills-idempotency
Installation
SKILL.md
Idempotency Trap
The request was sent twice. The customer was charged twice. Before writing any operation that mutates state, ask: what happens if this runs again with the same input?
The Three Sources of Duplicates
Every system faces these as normal operation, not edge cases. You cannot prevent them -- only make operations safe when they happen.
- User retries -- double-click, refresh, back-button-and-resubmit. Client sends the same request twice intentionally.
- Network retries -- the operation succeeded but the response was lost (timeout, TCP reset, LB cut). Client retries, not knowing the first attempt worked.
- Infrastructure redelivery -- webhook providers retry on timeout, message queues deliver "at least once," cron jobs overlap. Infrastructure sends the same work twice.