AGENT SKILL

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.

License 许可
MIT
最近更新
2026-10-29
Stars
★ 1
Forks
0

01 前言 Front Matter

name
principle-make-operations-idempotent
description
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

03 SKILL.md 正文

Make Operations Idempotent

Design operations so they converge to the correct state regardless of how many times they run or where they start from. 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 pattern:

  • Convergent startup: scan for existing state, clean stale artifacts, adopt live sessions
  • Content-based cleanup: compare by content equivalence, not creation order
  • Self-healing locks: use PID-based stale lock detection
  • Idempotent scheduling: failed work respawns cleanly, fresh input regenerated after each cycle

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?

If any answer is "it depends on what state was left behind," the operation needs a reconciliation step.

04 同仓库更多 Skills

SenCha930511
SenCha930511/omp-desktop

gui-automation

Use when you need to visually interact with a GUI — test buttons, fill forms, verify visual layouts, fuzz web pages, automate user flows, take screenshots, or perform end-to-end QA on any application. Works on cloud VMs, Docker containers, local machines, and sandboxes. Install: pip install cua.

★ 1
SenCha930511
SenCha930511/omp-desktop

gooeypi-computer-use

Drive native applications on macOS, Windows, or Linux through the separately installed TryCUA driver CLI.

★ 1
SenCha930511
SenCha930511/omp-desktop

verify-omp-desktop

Launch and drive the OMP Desktop desktop (Electron) app to prove user-facing behavior — sidebar navigation, Settings, and Capabilities — capturing screenshots and ARIA snapshots. Reach for this when verifying a OMP Desktop UI change or confirming the app still works end to end.

★ 1
SenCha930511
SenCha930511/omp-desktop

review-pr-viability

Review a pull request or issue for value, implementation quality, maintainability, regression risk, and reliance on upstream changes.

★ 1
SenCha930511
SenCha930511/omp-desktop

why

Use for 'why does X work this way', 'why we picked Y', design rationale, regressions, postmortems, or data-backed thresholds. Discovers available MCPs and queries each evidence category (source control, issue tracker, long-form docs, real-time chat, infrastructure observability, error tracking, product analytics warehouse) in parallel, then returns a cited read on decisions and tradeoffs. Use how for runtime behavior.

★ 1
SenCha930511
SenCha930511/omp-desktop

unslop

Cut AI tells from any writing. Must always apply.

★ 1