principle-make-operations-idempotent
できること
このスキルは、クラッシュ後に安全に再試行できる操作を作るための規則を、アシスタントに与えます。コマンド、ジョブ、処理ループを書くエンジニア向けです。
使う場面
- ✓失敗後に再実行されるかもしれないコマンドやジョブを設計するとき。
- ✓再起動、再試行、クラッシュで部分的な状態が残りうるとき。
- ✓途中から安全に再開できる処理ループが必要なとき。
スキルのリンク
https://github.com/cursor/plugins/blob/main/harness/pstack/claude-code/skills/principle-make-operations-idempotent/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“データのインポートのジョブが、クラッシュ後に、レコードを重複させずに安全に再実行できるようにしてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
アシスタントは、各ステップを現在の状態から導き、不足している差分だけを適用します。ロックや一時ファイルなどの残骸が古いものだと分かるようにし、各地点で二度実行したりクラッシュしたりした場合に何が起きるかを確認します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
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:
- What happens if this runs twice in a row?
- What happens if the previous run crashed at every possible point?
- Does re-execution converge to the same end state?
If any answer is "it depends on what state was left behind," the operation needs a reconciliation step.
よくある質問
重要なテストは何ですか?
その操作を続けて2回実行したら何が起きるか、そして前回の実行が各時点でクラッシュしたら何が起きるかを問うことです。
残ったロックはどう扱いますか?
前回の実行がどこで止まっていても成り立つ証拠によって、古いと判断しなければなりません。
一時ファイルに書くのは役立ちますか?
はい。一時的なパスに書いてから所定の場所にリネームすると、書きかけの結果を避けられます。
詳細
作者による元の説明
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.
repo: cursor/plugins
人気
- GitHubのスター
- 15k
- ランキング
- #10979
- ライセンス
- —
- 更新日
- 2026/10/31
コメント
- …
このリポジトリの他のスキル
advisor
15k重要な判断の前や、エラーで行き詰まったときなど、要所でより強力な第二のモデルに相談させます。機能をオンにしている場合のみ動きます。
check-agent-compatibility
15kAIコーディングエージェントがリポジトリを起動し、検証し、文書化できるかを包括的に確認し、主な問題とともに1つの互換性スコアを返します。
cli-for-agents
15kAIエージェントがプロンプトなしで実行でき、わかりやすいヘルプ文と例を備えるように、コマンドラインツールを設計または確認する方法をエージェントに教えます。
continual-learning
15k過去のチャットを確認する作業を専用のメモリ更新エージェントに任せることで、AGENTS.mdのメモを最新に保ちます。
似ているスキル
api-connector-builder
280kエージェントが既存のパターンに従って、新しいAPI連携を構築します。新しい方式を作らずに、もう一つ連携を追加したいときに使います。
api-design
280kエージェントがベストプラクティスに沿ってREST APIを設計できるようにします。APIの通信方法、エラーの表示方法、データの整理方法を決めるのに役立ちます。
backend-patterns
280kエージェントのサーバーサイドのアーキテクチャパターンとデータベースの最適化を支援します。サーバー上で動くコードを作成またはレビューするときに役立ちます。