Skip to main content

idempotent-script-design

Use this skill when writing scripts, cron jobs, data pipelines, or any automated process that may be run multiple times. Design every operation to be safely re-runnable without side effects.

Quellinformationen

Repository
aiming-lab/MetaClaw
Letzte Quellaktivität
10. März 2026 um 18:04
Erkannte Sprache von SKILL.md
Englisch
Sterne
3.464
Forks
452

Installationsoptionen

Standardmäßig ist der Prompt ausgewählt, der zuerst die Quelle prüft. Sie können zu einem direkten Befehl wechseln oder eine lokale Kopie herunterladen.

Quelldateien prüfen

Lesen Sie SKILL.md und alle von SkillsMP angezeigten Begleitdateien, bevor Sie sich für eine Installation entscheiden.

SKILL.md wird angezeigt

SKILL.md
Quellanweisungen · Schreibgeschützte Vorschau
name
idempotent-script-design
description
Use this skill when writing scripts, cron jobs, data pipelines, or any automated process that may be run multiple times. Design every operation to be safely re-runnable without side effects.
category
automation
# Idempotent Script Design An idempotent operation produces the same result whether run once or ten times. **Techniques:** - **Check before create:** `CREATE TABLE IF NOT EXISTS`, `mkdir -p`, check file existence before writing. - **Upsert instead of insert:** Use `INSERT ... ON CONFLICT DO UPDATE` in SQL. - **Atomic writes:** Write to a temp file, then rename — prevents corrupt partial output. - **Track progress:** Write a completion marker or checkpoint so reruns skip done work. **Testing idempotency:** Run your script twice on the same input and verify the output is identical. **Anti-patterns:** - Appending to a file without checking if the data is already there. - Inserting rows without checking for duplicates.
Auf GitHub ansehen