idempotency-patterns

idempotency-patterns is a skill for Claude Code, Codex from rrezartprebreza/spring-boot-skills. It costs 46 tokens per session (766 once invoked), scanned A, original, MIT.

A design pattern for making retried HTTP requests or message handling safe when the same operation arrives more than once. It records an idempotency key and the result so a duplicate can replay the original outcome instead of repeating the business change.

In plain words
What is it for?
Use it to design Spring Boot and PostgreSQL request handling with tenant-scoped keys, request hashes, stored results, and transactional database writes.
Why use it?
Retries can happen after timeouts or network failures, and repeating a payment, order, or other write can cause duplicate effects. This pattern also defines how to handle conflicting payloads and simultaneous retries.

Skill for Claude CodeCodex

Written for Claude Code and Codex: shipped in a Claude Code plugin, but also agents/openai.yaml present.

Part of the spring-boot-3-skills plugin — 33 skills shipped together

Good fit Use it to design Spring Boot and PostgreSQL request handling with tenant-scoped keys, request hashes, stored results, and transactional database writes.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/rrezartprebreza/spring-boot-skills/idempotency-patterns
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add rrezartprebreza/spring-boot-skills --skill idempotency-patterns
Clone the repo
git clone --depth 1 https://github.com/rrezartprebreza/spring-boot-skills

Made for: Claude Code, Codex.

Or install spring-boot-3-skills, the plugin that ships this one along with the rest of its 33 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for idempotency-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/rrezartprebreza/spring-boot-skills/idempotency-patterns/github.svg)](https://agentmods.dev/skills/rrezartprebreza/spring-boot-skills/idempotency-patterns)
Your own site
<a href="https://agentmods.dev/skills/rrezartprebreza/spring-boot-skills/idempotency-patterns"><img src="https://agentmods.dev/badge/skills/rrezartprebreza/spring-boot-skills/idempotency-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for idempotency-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/rrezartprebreza/spring-boot-skills/idempotency-patterns"><img src="https://agentmods.dev/badge/skills/rrezartprebreza/spring-boot-skills/idempotency-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 46 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 766 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00046 $0.00766
Opus 5 $0.00023 $0.00383
Sonnet 5 $0.00009 $0.00153
Haiku 4.5 $0.00005 $0.00077

Measured today against content hash b7d4e0c79536, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

idempotency-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured today.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/spring-boot-3/idempotency-patterns/SKILL.md · 70 lines

How it starts

The opening of the file, as written. The whole thing — 70 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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.

Read the full file on GitHub · 70 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. today First seen · 70 lines · 46 tokens per session scan A b7d4e0c79536

Subscribe to this mod's changes

idempotency-patterns is a skill published in the GitHub repository rrezartprebreza/spring-boot-skills (260 stars, last pushed 2d ago), licensed MIT. It adds 46 tokens to every session and 766 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-08.