← LeaderboardThe Skill Leaderboard

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.

Published by backnotprop ↗backnotprop/pstack

Try your first task

Make a toy theme import safe to retry

Start a fresh conversation.

Design a local theme import that can resume after a crash between validating and saving. Use a stable key, explain how an already-completed import is detected and show that a second run leaves the same final records.

    User-approved starter prompt based on a pinned source version; check current skill requirements before running. Task evidence ↗

    SKILL.md

    name: principle-make-operations-idempotentdescription: "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."disable-model-invocation: true

    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.

    principle-make-operations-idempotent by backnotprop · The Skill Leaderboard