cursor avatar

Principle Make Operations Idempotent

Design state-changing operations to converge to the correct state across crashes, restarts, and retries.

CCM score
58 of 100
skills.sh installs
5.7K
GitHub stars
19.4K
last updated
Nov 25, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers each step deriving its actions from current state, comparing it to the goal, and applying only the difference
  • Requires leftovers like locks, temp files, half-written records, and claimed jobs to be recognizable as stale by the next run
  • Enforces writing to a temporary path and renaming it into place, plus a reconciliation step when outcomes depend on leftover state
  • Designed for commands, lifecycle steps, and processing loops that run amid crashes and retries

Install

$ npx -y skills add cursor/plugins --skill principle-make-operations-idempotent -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Make Operations Idempotent

Design every state-changing operation to converge to the correct state however many times it runs and wherever the previous run stopped.

Derive each step from the state that exists, not from what the previous run meant to do. Read the current state, compare it to the goal, and apply only the difference.

Anything a run leaves behind (a lock, a temporary file, a half-written record, a claimed job) must be recognizable as stale by the next run, by evidence that holds wherever the previous run could have stopped. Write to a temporary path and rename it into place.

The test: what happens if this runs twice? What if the previous run crashed at every possible point? If the answer depends on what was left behind, add a reconciliation step.

Details

Repository
github.com/cursor/plugins
First seen
Nov 25, 2026

More from cursor/plugins

All 93

Similar to Principle Make Operations Idempotent