Install Idempotency Patterns
Pick your agent. Every command is ready to paste.
npx skills add rrezartprebreza/spring-boot-skills --skill idempotency-patternsThe open skills CLI detects your agents (Claude Code, Cursor, Codex and 70+ more) and installs to the right folder. Add -g to install globally.
01
Install it
Run the command above, or upload the folder in Claude.
02
Ask naturally
Describe the task. Your agent loads idempotency-patterns when the request matches its description.
03
Name it if needed
If it does not trigger, say “use the idempotency-patterns skill”. In Codex, type $idempotency-patterns.
Idempotency Patterns
Spring Boot 3 baseline
The examples use Java 17 and Jakarta APIs supported by this Boot version. Keep dependencies managed by the project's Boot BOM.
Define the contract
Identify the authenticated tenant/principal, operation, idempotency key, canonical request hash, retention window and replayable result. Scope uniqueness by principal/tenant and operation; a raw client key must never allow reading another user's result. Authenticate and authorize before both initial execution and replay. Bound key length and stored response size. Document what same-key/different-payload and still-in-progress requests return.
Database-local effects
For PostgreSQL, the schema and claim example uses a composite primary key and INSERT ON CONFLICT DO NOTHING RETURNING. In a single database transaction: claim the key, apply the business write, store the resulting status/body/selected headers, then commit. Roll back the claim with the business mutation on failure.
If the insert returns no row, load the existing result in a subsequent statement under READ COMMITTED, compare the canonical hash and replay only when it matches. A concurrent insert waits on the uniqueness constraint; bound lock waits and return a documented retryable outcome on timeout. With snapshot isolation, serialization failures require retrying the whole transaction. Do not catch a unique-constraint violation and continue in an already-aborted transaction.
A result row and business write must use the same transaction manager and database. Return the stored result rather than reconstructing it from mutable current entity state. Keep replay headers allowlisted; do not persist cookies, bearer tokens or hop-by-hop headers.
External effects and messages
A database transaction cannot atomically include an HTTP payment or email. Write an outbox record with the business mutation and let a retryable worker perform the external effect using the provider's idempotency support. Reconcile uncertain outcomes before retrying irreversible effects. For messages, record a unique consumer/event pair and apply the projection in one transaction; acknowledge only after commit. Retry failed transactions and route poison messages deliberately.
Define retention from the real client retry window. Deleting a key permits a later repeat to execute again; do not present TTL as an exactly-once guarantee. Protect stored responses as application data and delete them according to the project's retention policy.
Verification
Test simultaneous identical requests, conflicting payloads, tenant separation, rollback after claim, response replay after a lost connection and retries following a worker crash. Use the production database engine for lock and isolation tests, not H2 compatibility mode. The bad example illustrates the check-then-act race.
Gotchas
- Agent checks existence then inserts - enforce uniqueness in the database.
- Agent uses a JVM map or Redis TTL as the only business guard - coordinate with the actual write transaction.
- Agent replays another tenant's result - scope the key and re-authorize.
- Agent retries an external effect after a timeout blindly - reconcile or use provider idempotency.
- Agent deletes keys too early - document the retry window and expiry semantics.
Official sources
Tips for Idempotency Patterns
- • Start a fresh session after installing so your agent picks up the new skill.
- • It bundles reference files. The agent reads them only when needed, so they cost no context until then.
- • It is part of a pack with 30 skills. Install only the ones you need with --skill to keep triggers precise.
- • If two skills overlap, mention the one you want by name.
Questions about Idempotency Patterns
What does the Idempotency Patterns skill do?
Use when making retried HTTP commands or message processing safe against duplicate effects, including database-backed request keys, payload conflicts and concurrent retries. Do not apply caching as a substitute for business idempotency.
How do I install Idempotency Patterns?
Run "npx skills add rrezartprebreza/spring-boot-skills --skill idempotency-patterns" in your project. The skills CLI installs it for Claude Code, Cursor, Codex and 70+ other agents. In Claude on the web, upload the skill folder as a ZIP under Customize > Skills.
Does Idempotency Patterns work in Cursor and Codex?
Yes. Idempotency Patterns uses the open SKILL.md format, so it works in Claude Code, Claude, Cursor, OpenAI Codex, Gemini CLI, GitHub Copilot and other agents that support agent skills.
Is Idempotency Patterns free?
Idempotency Patterns is open source on GitHub under the MIT license. It is free to install; check the license before commercial use.
Who made Idempotency Patterns?
Idempotency Patterns is published by rrezartprebreza in the rrezartprebreza/spring-boot-skills repository, together with 29 other skills.


