idempotency
Skill2 starsChanged 4 months agoMITView on GitHub
Make a write endpoint or operation safe to retry by adding idempotency keys — so a duplicate request (from a client retry, double-click, or network timeout) produces one effect, not two. Use when the user says "add idempotency", "make this endpoint idempotent", "prevent duplicate charges", "add an idempotency key", "deduplicate requests", "handle double submits", or "this can be called twice and double-writes".
4 other projects use a version of this.
Adopted by
Most recently taken up by
- okfriansyah-moh/agentic-workflowtheir own version, first seen Oct 25, 2026
- jars-demo/jars-skillstheir own version, first seen Oct 25, 2026
- oa2p-solutions/ecommerce-foundationstheir own version, first seen Oct 11, 2026
- MatanElbaz/backend-skillstheir own version, first seen Oct 2, 2026
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- MatanElbaz/backend-skills★ 1same name
- jars-demo/jars-skills★ 0same name
- oa2p-solutions/ecommerce-foundations★ 0same name
- okfriansyah-moh/agentic-workflow★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository68 other files it gives its agents.
- a11ySkill
- api-docsSkill
- audit-logSkill
- benchmarkSkill
- bisectSkill
- cacheSkill
- changelogSkill
- cherry-pickSkill
- ci-setupSkill
- codeownersSkill
- commit-messageSkill
- connection-poolSkill
- contributingSkill
- coverageSkill
- db-migrateSkill
- dead-codeSkill
- debugSkill
- depsSkill
- diagramSkill
- dockerizeSkill
- docstringSkill
- e2eSkill
- env-exampleSkill
- error-handlingSkill
- explainSkill
- feature-flagSkill
- flaky-testSkill
- gitignoreSkill
- graceful-shutdownSkill
- graphqlSkill
- healthcheckSkill
- i18nSkill
- licenseSkill
- lint-fixSkill
- loggingSkill
- migrateSkill
- mockSkill
- onboardSkill
- optimizeSkill
- paginationSkill
- pr-descriptionSkill
- pre-commitSkill
- profileSkill
- prune-branchesSkill
- rate-limitSkill
- readmeSkill
- rebaseSkill
- refactorSkill
- regexSkill
- releaseSkill
- resolve-conflictsSkill
- retrySkill
- review-diffSkill
- scaffoldSkill
- secrets-scanSkill
- security-headersSkill
- seedSkill
- soft-deleteSkill
- sqlSkill
- squashSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 20
Accept a client-supplied key: Read an Idempotency-Key header (or a body field for internal callers).
- Very specific: line 26
Bound retention: Keep keys long enough to cover realistic client retry windows (commonly 24h–7d) and expire them (TTL in Redis, or a …
- Distinctive: line 27
Verify: Add/adjust a test that fires the same request twice with one key and asserts a single side effect plus identical responses, and a …
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Framework, store & existing idempotency signals
!grep -rilE "idempoten|Idempotency-Key|dedup|express|fastify|nestjs|flask|fastapi|django|redis|prisma|sequelize|sqlalchemy|typeorm" --include='*.*' package.json pyproject.toml go.mod Gemfile 2>/dev/null | grep -vE 'node_modules|\.git|dist|build' | head -8
Instructions
Make the operation in $ARGUMENTS safe to execute more than once with the same input, so retries and double-submits don't create duplicate side effects (a second charge, a second order, a second email). Reuse the project's existing web framework and datastore rather than introducing new infrastructure.
Method
- Decide whether a key is even needed. Naturally idempotent operations (GET, PUT/DELETE by id, upserts keyed on a unique column) may already be safe — a
UNIQUEconstraint on a natural key is often the simplest fix. Reach for an idempotency key when the operation is a non-idempotent POST with real side effects (payments, orders, sends). - Accept a client-supplied key. Read an
Idempotency-Keyheader (or a body field for internal callers). The client generates a stable UUID per logical operation and reuses it across retries. Validate it's present and well-formed for the endpoints that require it. - Persist request → response, atomically. On first request, insert the key with a status of
in-progressinside the same transaction as the side effect (or use an atomicINSERT ... ON CONFLICT DO NOTHING/SETNX). Store the eventual response (status + body) against the key so a replay can return it verbatim. - Handle the replay paths:
- Completed key → return the stored response with the original status code; do not re-run the side effect.
- In-progress key (concurrent duplicate still running) → return
409 Conflictor have the client back off, rather than racing a second execution. - Same key, different request body → reject with
422; a key must map to exactly one request payload, or a client bug could mask a real second operation.
- Bound retention. Keep keys long enough to cover realistic client retry windows (commonly 24h–7d) and expire them (TTL in Redis, or a
created_at+ sweep for SQL). Say what window you chose and why. - Verify. Add/adjust a test that fires the same request twice with one key and asserts a single side effect plus identical responses, and a test that a different body under the same key is rejected.
Rules
- The side effect and the key record must commit together — never write the effect first and the key second, or a crash between them defeats the guarantee. Use one transaction or an atomic insert.
- A replay of a completed key must return the stored response and must not re-execute the side effect; an in-progress duplicate must not run concurrently.
- Bind a key to its request payload — reject a reused key with a different body rather than silently returning the old response.
- Reuse the project's datastore for key storage and set a TTL/retention window; don't let the key table grow unbounded.
- End by summarizing which operations are now idempotent, the header/field used, the store and retention window, and the replay behavior for completed / in-progress / mismatched requests. Cross-reference the
retryskill, since safe client retries depend on this.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

