Skip to content
FunCoding

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.

Star
3,472
Category
Data
License
MIT
Last commit
Jun 7, 2026

memory_data/skills/idempotent-script-design/SKILL.md

View on GitHub

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.

Similar Skills

Featured

agentic-os

Build persistent multi-agent systems without external databases, using file-based memory and scheduled tasks.

AFaffaan-m/ECC315k4,381 new stars in the last 7 days

health

GAgarrytan/gstack143k598 new stars in the last 7 days

deprecation-and-migration

ADaddyosmani/agent-skills122k1,667 new stars in the last 7 days

ccs-align

THthedotmack/claude-mem121k1,626 new stars in the last 7 days

handoff

THthedotmack/claude-mem121k1,626 new stars in the last 7 days

mem-search

THthedotmack/claude-mem121k1,626 new stars in the last 7 days