AGENT SKILL

data-pipeline-design

Design batch and streaming data pipelines — ELT into a warehouse/lakehouse, dbt and analytics engineering (staging/intermediate/marts layers), orchestration with Airflow or Dagster, idempotent loads, incremental models, backfills, CDC ingestion. Triggers: data pipeline, ELT, ETL, dbt models, data warehouse, Snowflake, BigQuery, ingest into the warehouse, Airflow DAG, Dagster, Kafka streaming, backfill, incremental load, nightly job duplicates rows. ML training/feature pipelines → ml-pipeline-design; validating the data → data-quality.

License 许可
MIT
最近更新
2026-11-12
Stars
★ 1
Forks
1

01 前言 Front Matter

name
data-pipeline-design
description
Design batch and streaming data pipelines — ELT into a warehouse/lakehouse, dbt and analytics engineering (staging/intermediate/marts layers), orchestration with Airflow or Dagster, idempotent loads, incremental models, backfills, CDC ingestion. Triggers: data pipeline, ELT, ETL, dbt models, data warehouse, Snowflake, BigQuery, ingest into the warehouse, Airflow DAG, Dagster, Kafka streaming, backfill, incremental load, nightly job duplicates rows. ML training/feature pipelines → ml-pipeline-design; validating the data → data-quality.

02 资源文件 2

03 SKILL.md 正文

Data Pipeline Design

Design pipelines that move and transform data for analytics — and stay correct when they fail, rerun, and backfill, because they will. The two design properties that separate a pipeline from a script: idempotency (any run can be repeated safely) and parameterization (any time window can be processed by the same code). Boundaries: pipelines feeding model training (features, point-in-time correctness) belong to ml-pipeline-design; validating the data this pipeline moves belongs to data-quality.

Workflow

Step 1: Map Sources, Consumers, and Freshness

List each source (databases, SaaS APIs, event streams), each consumer (dashboards, reverse ETL, downstream teams), and the freshness each consumer actually needs. Freshness drives everything: daily batch is an order of magnitude cheaper to build and operate than streaming — don't buy streaming because "real-time" sounds better; buy it when a consumer decision genuinely changes within minutes.

If the ask arrives with a bill attached, separate the two questions. Changing what work runs each night — full refreshes to incremental, narrower scans, fewer rebuilds — is this skill's, and the steps below do it. What that work is charged at, and how much of the invoice this job even accounts for, is finops-cost-optimization's. Find out this job's share of the spend before promising a number: a rewrite that halves a job responsible for a fifth of the bill moves the total by a tenth.

Step 2: Choose ELT (and Say Why)

For a cloud warehouse (Snowflake, BigQuery, Redshift, Databricks), default to ELT: land raw data unchanged, transform inside the warehouse with SQL/dbt. The reasons are operational, not fashionable — raw history means transform bugs are fixed by re-running transforms, not re-extracting from sources; the warehouse scales the compute; transformations become versioned, testable SQL. Classic ETL survives where data must be cleaned/redacted before it may land (PII, compliance) or the target isn't a warehouse.

Step 3: Don't Hand-Roll Extraction

Ingestion is undifferentiated heavy lifting with long tail of pain (API pagination, rate limits, schema changes, backpressure):

  • SaaS/DB sources: managed or open connectors first — Fivetran/Airbyte/dlt. Hand-write only when no connector exists or volume/cost forces it.
  • Operational DBs at scale: CDC (Debezium or the warehouse-native equivalent) instead of daily full dumps or fragile updated_at queries.
  • Events: land the stream (Kafka → object storage/warehouse) raw; process micro-batch unless Step 1 proved sub-minute freshness is needed.

Step 4: Layer the Transforms (dbt)

  • Staging — 1:1 with sources: rename, cast, deduplicate. No business logic.
  • Intermediate — joins and business logic, composable, not exposed to BI.
  • Marts — consumer-facing facts/dimensions, one per business domain.

Each layer only reads from the one below; BI tools read only marts. This is SRP for SQL: when a number is wrong, the layer tells you where to look. Schema design for the marts themselves is data-modeling's domain.

Step 5: Make Every Run Idempotent

The Iron Rule of pipelines: a rerun must produce the same result as one run. Append-only loads fail this and produce the classic duplicate-rows- after-retry incident. Choose a write pattern per table:

  • Delete + insert by partition (or INSERT OVERWRITE): simplest, right default for date-partitioned facts.
  • Merge/upsert on a unique key: for mutable entities and late updates — requires a true unique key (enforce it via data-quality tests).
  • Full refresh: fine while small; flip to incremental on cost, not pride.

In dbt: incremental materialization with unique_key set — and always define the full-refresh path (--full-refresh must work, or you can't recover from a logic bug).

Step 6: Parameterize Time — Backfill Is a First-Class Case

Every run processes an explicit logical window passed in by the orchestrator (WHERE event_date = {{ ds }}) — never CURRENT_DATE - 1 inside the SQL, which makes yesterday's failure unreproducible today. Then backfill is not a special script: it's the same job over a range, natively supported by the orchestrator (Airflow backfill, Dagster partitioned assets). If backfilling means hand-editing dates, Steps 5–6 were skipped.

Handle late-arriving data explicitly: reprocess a trailing lookback window (e.g. the last 3 days) each run, or track a watermark — pick per source based on how late its data actually arrives.

Step 7: Orchestrate and Operate

Pick one orchestrator and make a recommendation, not a brochure: Dagster for a dbt-centric greenfield stack (asset/partition model matches warehouse thinking, first-class dbt integration); Airflow where the org already runs it or needs its ecosystem breadth (comparison and managed options: references/orchestration.md). Then wire in operations: retries, and an alert on final failure that names who receives it — a load that fails silently is the failure this step exists to prevent, so the alert is part of the pipeline design, not a monitoring afterthought. (SLOs, error budgets and instrumentation depth are observability-design's; deciding that a failed run pages someone is not.) Alongside it, quality checks between layers (data-quality), and cost visibility per model — warehouses make it very easy to spend quietly.

Principles Applied

  • KISS: batch over streaming, connectors over custom extractors, SQL over a framework — until a measured requirement says otherwise.
  • DRY: one parameterized job for daily runs and backfills; logic lives once, in the transform layer, not copied into extraction scripts.
  • YAGNI: no lakehouse/streaming/metadata-platform buildout for a stack whose consumers refresh dashboards daily.

Cross-Skill References

  • finops-cost-optimization — warehouse sizing, spend attribution, and whether this job is actually driving the bill
  • data-quality — tests, contracts, and freshness checks between the layers
  • data-modeling — the schema design of the marts this pipeline produces
  • ml-pipeline-design — when the consumer is model training, not BI
  • observability-design — pipeline SLOs, alerting, run-level monitoring
  • architecture-design — ADRs for the costly-to-reverse platform choices

04 同仓库更多 Skills

SWEStash
SWEStash/swe-workflow-skills

writing-skills

Use when authoring, editing, or reviewing a skill in this library — a new SKILL.md, one that under-triggers, or hardening an existing one. Covers description and listing-budget rules, frontmatter, progressive disclosure, the 3-eval rule, and pressure-testing against rationalizations.

★ 1
SWEStash
SWEStash/swe-workflow-skills

working-agreement

Define and validate how a multi-session project is run — where plans, status and decisions live, session routines, new work, milestone close. README/CONTRIBUTING → project-documentation.

★ 1
SWEStash
SWEStash/swe-workflow-skills

verification-before-completion

Evidence gate before any claim that work is done, fixed, passing, or deployed. Route here when a message declares the work finished or asks to commit, push, merge, ship, or close it out, including a brief sign-off, and before git-workflow or release-management act on it. Writing the commit message or PR text itself → git-workflow.

★ 1
SWEStash
SWEStash/swe-workflow-skills

ui-ux-design

Design user experiences from an engineer's perspective — user flows, wireframes, interaction patterns, responsive strategy, navigation, loading/error/empty states. Triggers: design the UI, user flow, wireframe, how should this screen look, loading state, error state, empty state, responsive design, navigation, page layout, form design, mockup.

★ 1
SWEStash
SWEStash/swe-workflow-skills

threat-modeling

Design-time security analysis of a system or feature before it's built — trust boundaries, attack surface, STRIDE per element, abuse cases, prioritized mitigations that become security requirements. Triggers: threat model, STRIDE, trust boundary, attack surface, what could go wrong security-wise, security design review, abuse case, secure this design, security requirements. Reviewing EXISTING code/config for vulnerabilities → security-audit; use this skill while the design is still on the whiteboard.

★ 1
SWEStash
SWEStash/swe-workflow-skills

test-suite-design

Design comprehensive test suites for existing code — strategy across unit/integration/e2e, fixtures, factories, helpers. Triggers: add tests, write tests for, increase coverage, test this module, testing strategy, test plan, what tests do I need, test infrastructure, test helpers, this has no tests. Not for TDD — use tdd-workflow.

★ 1