/data-engineering-skills:writing-idempotent-transformationsfrom data-engineering-skills
Guides writing data transformations that produce identical results on every run using MERGE/upsert, partition overwrites, deduplication, and stable keys. Essential for retry-safe pipelines, backfills, and exactly-once data loads.
Ships in data-engineering-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Failures are normal. Retries, backfills, and replays run the same logic again. If a job is idempotent, running it once or five times yields the same final state — so recovery is safe and boring. If not, retries duplicate rows and backfills silently change history. This is the single most reported source of data incidents.
- [ ] Define the unit of work and its natural key
- [ ] Make writes overwrite-by-key or overwrite-by-partition (never blind append)
- [ ] Remove dependence on wall-clock time / autoincrement / random order
- [ ] Verify: running twice == running once (row counts and checksums match)
INSERT-append with MERGE/upsert keyed on that key, or with a
full partition overwrite for the window being processed.now(), sequence values, or
unordered row_number(); derive timestamps from the data/event, not the run.Delete-insert by partition — the simplest idempotent load for a time window: delete the target partition, then insert its freshly computed rows in one transaction. Re-running reprocesses only that window and cannot duplicate.
BEGIN;
DELETE FROM fct_orders WHERE order_date = DATE '2026-01-15';
INSERT INTO fct_orders
SELECT ... FROM staging WHERE order_date = DATE '2026-01-15';
COMMIT;
MERGE/upsert by key — when rows update in place:
MERGE INTO fct_orders t
USING staging s ON t.order_id = s.order_id
WHEN MATCHED THEN UPDATE SET amount = s.amount, status = s.status
WHEN NOT MATCHED THEN INSERT (order_id, amount, status)
VALUES (s.order_id, s.amount, s.status);
Deduplicate deterministically — keep the latest version per key with a stable tiebreaker, so the result never depends on scan order:
SELECT * FROM (
SELECT *, ROW_NUMBER() OVER (
PARTITION BY order_id ORDER BY updated_at DESC, source_file DESC
) AS rn
FROM staging
) WHERE rn = 1;
dbt incremental — use a unique_key and merge strategy so re-runs upsert
rather than append; use insert_overwrite on partitioned warehouses.
INSERT ... SELECT in a retried task — the classic duplicate source.current_timestamp/uuid() — makes every run produce new rows.ROW_NUMBER() without a tiebreaker — nondeterministic when timestamps tie.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub unknown-333/awesome-data-engineering-skills --plugin data-engineering-skills36 skills in this plugin
/authoring-airflow-dagsWrite production-grade Apache Airflow DAGs using the TaskFlow API — idempotent tasks, correct scheduling and catchup, retries/SLAs, connections/variables, and avoiding top-level code. Use when creating or reviewing Airflow DAGs, scheduling pipelines, wiring task dependencies, configuring retries/backfills, or fixing non-idempotent tasks./building-dagster-assetsBuild Dagster pipelines using software-defined assets — asset dependencies, partitions, resources and IO managers, asset checks, and schedules/sensors. Use when creating Dagster assets or jobs, modeling data as assets, adding partitions or backfills, wiring resources/IO managers, or migrating from task-based orchestration to assets./building-dbt-modelsBuild well-structured dbt models — staging/intermediate/marts layers, ref() and source(), materializations, and incremental models with the right strategy. Use when creating or refactoring dbt models, choosing table vs view vs incremental, structuring a dbt project, or writing incremental logic./building-feature-pipelinesBuild ML feature pipelines and feature stores — point-in-time-correct joins to avoid label leakage, offline/online parity, feature freshness and backfills, and materialization with tools like Feast. Use when engineering features for ML, preventing train/serve skew or data leakage, building a feature store, or backfilling historical features for training./building-iceberg-tablesDesign and operate Apache Iceberg tables — partitioning and hidden partitioning, partition/schema evolution, snapshots and time travel, compaction and small-file cleanup, and MERGE/upsert for lakehouse tables on Spark, Flink, Trino, or Snowflake. Use when creating or maintaining Iceberg tables, choosing partitioning, evolving schema/partitions, or fixing small-file and metadata bloat./building-ingestion-pipelinesBuild batch and incremental data ingestion (extract-load) pipelines — full vs incremental extraction, change data capture (CDC), watermarks and high-water marks, API pagination and rate limits, and choosing managed EL tools (Fivetran, Airbyte) vs custom code. Use when ingesting data from databases, APIs, files, or SaaS into a warehouse/lake, or designing incremental extraction and CDC.Other plugins' skills for the same job