# Principle make operations idempotent

> Principle make operations idempotent is an open-source agent skill for developer tools. Makes agents design state-changing steps that converge safely after crashes and retries. It is available on Claude Code.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code
- **Website:** https://github.com/michael-denyer/pstack-claude/tree/main/plugins/pstack/skills/principle-make-operations-idempotent
- **Repository:** https://github.com/michael-denyer/pstack-claude
- **GitHub stars:** 5,057
- **License:** MIT
- **Skill name:** principle-make-operations-idempotent
- **Collection:** https://github.com/michael-denyer/pstack-claude
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-01

## About

This skill guides an agent to structure commands, lifecycle steps and processing loops so that running them again, or after a crash partway through, still lands on the correct end state. The core method is to read the current state, compare it with the goal, and apply only the missing difference rather than replaying what a previous run intended to do.

It also covers leftovers from interrupted runs such as locks, temporary files, half-written records and claimed jobs. The guidance asks that each leftover be recognizable as stale by a later run no matter where the earlier run stopped, and suggests writing to a temporary path and renaming it into place. When the outcome of a rerun depends on what was left behind, the skill tells the agent to add a reconciliation step.

The skill is instruction-only: it has no scripts and no tool requirements, and it is meant to shape how the agent writes code and designs workflows. It is user-invocable false, so it is loaded automatically when the task matches.

## When your agent uses it

> 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.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/michael-denyer/pstack-claude/tree/HEAD/plugins/pstack/skills/principle-make-operations-idempotent)
- [License: MIT](https://github.com/michael-denyer/pstack-claude/tree/HEAD/plugins/pstack/skills/principle-make-operations-idempotent)

## Features

- **Current-state reconciliation:** Compares the existing state with the goal and applies only the difference on each run.
- **Crash-point analysis:** Asks what happens if a run stops at every possible point and whether a rerun is safe.
- **Stale artifact detection:** Makes locks, temp files and claimed jobs identifiable as stale by later runs.
- **Atomic write pattern:** Recommends writing to a temporary path and renaming it into place.
- **Reconciliation step guidance:** Directs adding a reconciliation step when outcomes depend on leftover state.

## Good for

- Make a database migration script safe to rerun after it fails midway
- Design a job-processing loop that recovers claimed jobs after a worker crashes
- Write a deploy command that can be retried without duplicating resources
- Review a lifecycle setup routine for behavior under restarts

## Install

### Claude Code

This skill ships in the `pstack` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add michael-denyer/pstack-claude
/plugin install pstack@pstack-claude
```

Or copy only this skill to `~/.claude/skills/principle-make-operations-idempotent`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/principle-make-operations-idempotent &&
cp -R "$tmp/plugins/pstack/skills/principle-make-operations-idempotent" ~/.claude/skills/principle-make-operations-idempotent &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/principle-make-operations-idempotent` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/principle-make-operations-idempotent` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/principle-make-operations-idempotent &&
cp -R "$tmp/plugins/pstack/skills/principle-make-operations-idempotent" ~/.agents/skills/principle-make-operations-idempotent &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/principle-make-operations-idempotent` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/principle-make-operations-idempotent` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/principle-make-operations-idempotent &&
cp -R "$tmp/plugins/pstack/skills/principle-make-operations-idempotent" ~/.cursor/skills/principle-make-operations-idempotent &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/principle-make-operations-idempotent` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/michael-denyer/pstack-claude.git --path plugins/pstack/skills/principle-make-operations-idempotent
```

Or copy the folder to `~/.gemini/skills/principle-make-operations-idempotent` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/principle-make-operations-idempotent`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/principle-make-operations-idempotent &&
cp -R "$tmp/plugins/pstack/skills/principle-make-operations-idempotent" ~/.copilot/skills/principle-make-operations-idempotent &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/principle-make-operations-idempotent` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git
```

Then copy `pstack-claude/plugins/pstack/skills/principle-make-operations-idempotent` into your agent's skills folder as `principle-make-operations-idempotent`. Agents that support SKILL.md read one folder per skill.

## FAQ

### When does Principle make operations idempotent apply?

It applies when designing commands, lifecycle steps or processing loops that may run amid crashes, restarts and retries.

### Does Principle make operations idempotent need scripts or special tools?

No. It has no scripts and does not set allowed tools; it is a set of design guidelines.

### What does Principle make operations idempotent tell the agent to do about leftover files or locks?

Leftovers should be recognizable as stale by the next run, and writes should go to a temporary path before being renamed into place.

### How do I install Principle make operations idempotent in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/principle-make-operations-idempotent to use it in all your projects, or to .claude/skills/principle-make-operations-idempotent in one project. Or install the pstack plugin, which includes it: /plugin marketplace add michael-denyer/pstack-claude, then /plugin install pstack@pstack-claude.

### Does Principle make operations idempotent run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Principle make operations idempotent?

Claude Code. It reads skills in the SKILL.md format; the install steps on this page show where to put the folder.

### What are the best alternatives to Principle make operations idempotent?

The closest alternatives to Principle make operations idempotent are Principle outcome oriented execution, Principle never block on the human, Agent introspection debugging, Principle foundational thinking and Principle prove it works.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Principle outcome oriented execution](https://ai-powered.com/skills/principle-outcome-oriented-execution): Principle outcome oriented execution is an open-source agent skill for developer tools.
- [Principle never block on the human](https://ai-powered.com/skills/principle-never-block-on-the-human): Principle never block on the human is an open-source agent skill for developer tools.
- [Agent introspection debugging](https://ai-powered.com/skills/agent-introspection-debugging): Agent introspection debugging is an open-source agent skill for developer tools.
- [Principle foundational thinking](https://ai-powered.com/skills/principle-foundational-thinking): Principle foundational thinking is an open-source agent skill for developer tools.
- [Principle prove it works](https://ai-powered.com/skills/principle-prove-it-works): Principle prove it works is an open-source agent skill for developer tools.
- [Principle fix root causes](https://ai-powered.com/skills/principle-fix-root-causes): Principle fix root causes is an open-source agent skill for developer tools.
- [Correct](https://ai-powered.com/skills/correct): Correct is an open-source agent skill for developer tools.
- [Principle separate before serializing shared state](https://ai-powered.com/skills/principle-separate-before-serializing-shared-state): Principle separate before serializing shared state is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/principle-make-operations-idempotent
