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.

Informações da origem

Repositório
aiming-lab/MetaClaw
Última atividade na origem
10 de março de 2026 às 18:04
Idioma detectado do SKILL.md
inglês
Estrelas
3.456
Forks
450

Opções de instalação

Por padrão, está selecionado o prompt que primeiro revisa a origem. Você pode mudar para um comando direto ou baixar uma cópia local.

Revise os arquivos de origem

Leia o SKILL.md e os arquivos complementares exibidos pelo SkillsMP antes de decidir se vai instalar.

Exibindo SKILL.md

SKILL.md
Instruções da origem · Visualização somente leitura
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.
Ver no GitHub