Skip to content
backnotprop avatar

Principle Make Operations Idempotent

Principle for designing commands and processing loops to converge safely across crashes and retries.

CCM score
62 of 100
skills.sh installs
13.3K
GitHub stars
5.5K
last updated
Nov 30, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers state-changing operations that must reach the correct end state however many times they run or wherever a prior run stopped
  • Requires each step to read current state, compare it to the goal, and apply only the difference rather than replaying intent
  • Enforces that leftover locks, temp files, half-written records, and claimed jobs be recognizable as stale by the next run
  • Recommends writing to a temporary path and renaming it into place, and adding a reconciliation step when outcomes depend on leftovers
  • Designed for engineers building lifecycle steps, commands, or processing loops that must survive crashes, restarts, and retries

Install

$ npx -y skills add backnotprop/pstack --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/backnotprop/pstack
First seen
Nov 30, 2026

More from backnotprop/pstack

All 44

Similar to Principle Make Operations Idempotent