Principle Make Operations Idempotent

Apply when designing commands, lifecycle steps, or processing loops that run amid crashes, restarts, and retries. Converge to the same end state regardless of partial prior runs.

107 stars 21 forksOther

Install

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add Dimon94/skills --skill principle-make-operations-idempotent
Manual install
git clone --depth 1 https://github.com/Dimon94/skills.git /tmp/skills
mkdir -p ~/.claude/skills
cp -r /tmp/skills/skills/principle-make-operations-idempotent ~/.claude/skills/principle-make-operations-idempotent

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# Make Operations Idempotent

Design operations so they converge to the correct state regardless of how many times they run or where the previous run stopped. Every state-mutating operation should answer: "What happens if this runs twice? What happens if the previous run crashed halfway?"

**Why:** Commands, lifecycle operations, and processing loops run where crashes, restarts, and retries are normal. If partial state changes the next run's outcome, every restart becomes a debugging session.

**The idea:** 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. A step written this way is safe to repeat, because a repeat finds nothing left to do.

Anything a run leaves behind, such as a lock, a temporary file, a half-written record, or a claimed job, must be recognizable as stale by the next run. Judge staleness by evidence that stays true wherever the previous run could have stopped, not only in the common case. A marker that the next run cannot judge turns every crash into manual cleanup. For example, write to a temporary path and rename it into place, or compare artifacts by content instead of by creation order.

**The test:**
1. What happens if this runs twice in a row?
2. What happens if the previous run crashed at every possible point?
3. Does re-execution converge to the same end state?
Read the full skill on GitHub

Details

Skill name
principle-make-operations-idempotent
Repository
Dimon94/skills
Path
skills/principle-make-operations-idempotent/SKILL.md
Repo updated
18 November 2026
Copies
Found in 3 GitHub repos

FAQ

What does the Principle Make Operations Idempotent skill do?

Apply when designing commands, lifecycle steps, or processing loops that run amid crashes, restarts, and retries. Converge to the same end state regardless of partial prior runs.

How do I install the Principle Make Operations Idempotent skill?

skills CLI (Claude Code, Cursor, Codex and more): npx skills add Dimon94/skills --skill principle-make-operations-idempotent. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Principle Make Operations Idempotent popular?

It lives in Dimon94/skills, which has 107 GitHub stars and 21 forks, and is included in 2 curated skill lists.

Related skills

Maintain Verification Skill

107

Dimon94/skills

Periodic pass that keeps a project's verification skill and feature map honest: parallel source readers per feature, one live session driving every feature, at most one PR of proven corrections. Use for /maintain-verification-skill or "audit the verify skill".

Git & Code ReviewIn 2 lists21

Create Verification Skill

107

Dimon94/skills

Generate a project-local verification skill that drives your app the way a user does — any language, framework, or platform. Use for /create-verification-skill, "make a control skill for this repo", or when a project has no scripted way to prove UI/CLI/service behavior.

Software DevelopmentIn 2 lists21

How

107

Dimon94/skills

Use for "how does X work", code walkthroughs before changing something, and placement / ownership / layering questions ("where should this live", "which package owns this", "is this the right layer"). Explains subsystem architecture, runtime flow, onboarding mental models. Use why for motivation.

Software DevelopmentIn 2 lists21

Principle Sequence Verifiable Units

107

Dimon94/skills

Apply to multi-step work (sweeps, migrations, runs of similar edits) and to how you stack commits and PRs. Break work into small units that each end in a verifiable state, check each before the next, and order delivery so the sequence proves itself to a reviewer.

OtherIn 2 lists21

Zig Comptime

293

mohitmishra786/low-level-dev-skills

Zig comptime skill for compile-time evaluation and metaprogramming. Use when using comptime parameters, comptime types, generics via anytype, comptime reflection with @typeInfo, or metaprogramming patterns that replace C++ templates. Activates on queries about Zig comptime, compile-time evaluation, Zig generics, anytype, @typeInfo, comptime types, or Zig metaprogramming.

Other36

Aop Product Planner

260

cafe3310/public-agent-skills

面向切面 (AOP) 的智能产品策划与需求拆解范式。用于从目标叙事、AOP 切面分层、乱序 Idea 收集、功能边界界定到需求依赖拓扑与优先级的全流程产品工程规划。

Other30

Browse the most popular Claude skills, all other skills, or write your own with the skills generator.