Backend · apply by default

/backend-idempotency

Prevent duplicate effects from retries and repeated requests

Use to make repeated operations produce the intended single effect; backend-concurrency covers broader interleavings, api-webhooks owns signature verification and receipt, and arch-event-flow designs delivery, ordering and dead-letter policy across producers and consumers.

Make it your own.

In Claude Code, use the slash command and add your context. In Codex, select backend-idempotency from the just-vibe skill picker, then send the same brief.

Version 0.11.0 also supports /jv backend-idempotency, /just-vibe backend-idempotency and /jv:backend-idempotency in Claude. See shortcut setup and context examples.

Example · apply
/just-vibe:backend-idempotency Prevent duplicate payment credits from concurrent and reordered webhooks.
edge · apply
/just-vibe:backend-idempotency Make payment creation safe when two equal requests arrive simultaneously.
blocked · inspect
/just-vibe:backend-idempotency Design idempotency without provider deduplication support; identify reconciliation requirements.

What the agent does

  1. Define the business operation, key namespace, payload equivalence, validity/retention window and replay response. Include tenant and operation where they distinguish effects; specify how equal keys with different payloads or pending work are handled.
  2. Validate the payload without permissive coercion where the contract requires exact types or bounds. Check ownership, funds/capacity and numeric limits at the boundary that protects against concurrent change.
  3. When the effect and deduplication record share a database, make their success/failure atomic using the engine-supported transaction and uniqueness mechanism. Define transaction ownership and make identical concurrent requests converge on the original stored result.
  4. For an external effect, walk the crash before send, timeout after possible success and failure before local recording. Use supported provider idempotency or durable reconciliation; a local key alone cannot prove exactly-once external execution.
  5. Test equal replay, conflicting payload, separate tenants, simultaneous claims and failure after each durable step. Assert state, stored result and hook/provider call count; verify a retry after rollback can succeed without repeating a completed effect.

Inputs

  • retried operation, effect boundary, request identity, and deduplication lifetime.

Optional context: scope, references, constraints, successCriteria, environment, mode, budget.

Scope

Reads
Prevent duplicate effects for the specified operation, including concurrent duplicates.
Writes
Apply: only the requested local changes and relevant isolated verification. Inspect/plan requests remain inspection/planning. External actions require their exact action and target in session authorization.
Mode
Apply; retried operation, effect boundary, request identity, and deduplication lifetime.
Prerequisites
Service source, data/interface contracts, framework/runtime versions, and test environment. Default apply operations target local code and isolated tests; live infrastructure/data mutations require their own requested scope.

Expected output

  • Operation/key/payload contract, durable ownership and retention policy, failure-window table, and replay/conflict/concurrency/interruption evidence.

How the work is checked

  • Equal replay performs no new effect; a conflicting payload cannot inherit an unrelated result. Local rollback removes both partial effects and the claim when the contract permits retry; uncertain external outcomes remain explicitly unresolved.

When to stop or clarify

  • Do not claim exactly-once external delivery without provider support or reconciliation. Cache-only deduplication needs durability justification.

Handling missing context

Infer
Trace service callers, request contracts, authorization, transactions, retries and existing test infrastructure.
Assume
Use the existing persistence and framework; isolate local tests from live services.
Ask
Resolve ambiguous durability, duplication or consistency requirements before encoding them; absent production access does not prevent local implementation.

Technical guidance

Evidence
Identify key scope, normalized payload, unique storage constraint, external provider support and retention.
Method
Atomically bind a key to payload and result; distinguish completed, in-progress and uncertain external outcomes with reconciliation.
Pitfall
An in-memory map fails across processes; deleting a pending key after a timeout can permit a second charge.
Check
Send concurrent equal requests and same-key different-payload requests, then interrupt after external success before local recording.

Situational decisions

When the same key arrives with a different payload or while pending: Return explicit conflict/pending behavior; do not execute another effect or replay an unrelated result.

The coding agent follows this workflow using its available tools. Installation does not grant service access or guarantee an outcome. Read the compatibility notes.

Keep exploring