Community研究與資料分析github.com

偵錯資料管線

系統性地根因分析資料管線故障與資料事故——包含任務錯誤、資料錯誤、遺失、重複以及新鮮度不足——透過向上追溯血緣、隔離故障階段、與來源進行比對,並規劃安全修復與回填。在管線失敗、數字異常、資料遺失或重複、儀表板過時,或利害關係人回報資料不一致時使用。

偵錯資料管線 是什麼?

此技能專為開發者與 AI 代理設計,提供一套系統化方法來偵錯資料管線中的資料正確性問題,而非單純的執行階段錯誤。它引導使用者精確定義症狀,例如具體的資料表、欄位、資料列與時間範圍,接著透過對有向無環圖(DAG)進行二元搜尋來向上追溯血緣,找出第一個出現異常的階段。技能強調「比對」的關鍵步驟,要求使用者將可疑階段的資料(如計數、總和)與其上游輸入進行 SQL 比對,以精確定位資料差異是來自於遺失、重複還是邏輯錯誤。最後,它建議在修復根本原因後,規劃冪等的回填流程,並加入資料品質檢查以防止問題重複發生。此技能適用於多種平台,如開發者本機環境、CI/CD 管線或協作代理中,特別聚焦於資料工程領域的 dbt、Airflow 等工具。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Unknown-333/awesome-data-engineering-skills/tree/main/skills/debugging-data-pipelines

Installed? Explore more 研究與資料分析 skills: affaan-m/uspto-database, affaan-m/scholar-evaluation, affaan-m/literature-review · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

偵錯資料管線 是做什麼的?

使用時機

  • 管線任務失敗,或輸出資料錯誤/遺失/重複。
  • 儀表板過時,或某個指標與來源不一致。
  • 利害關係人回報差異,必須找出原因。
  • 請勿用於已由 debugging-dbt-runs / debugging-airflow-pipelines 處理的工具特定執行錯誤(應先使用那些技能,若屬資料正確性事故再使用本技能)。

工作流程

- [ ] 精確定義症狀(哪個資料表、欄位、資料列、時間區間)
- [ ] 向上追溯血緣,找出資料首次出現錯誤的階段
- [ ] 隔離原因:是程式碼錯誤、錯誤輸入、資料延遲,還是執行失敗?
- [ ] 比對可疑階段與其來源(計數/總和)
- [ ] 修復根本原因,然後規劃受影響區間的冪等回填
- [ ] 增加檢查,確保問題不會悄悄重現
  1. 釘選症狀。「2026-01-15 的營收在 fct_orders 中低了約 30%」是可偵錯的;「數字看起來不對」則不是。取得資料表、欄位、資料列與時間區間。
  2. 向上追溯血緣。 從錯誤輸出向後逐步檢查模型/任務,找到第一個資料已經錯誤的階段。對有向無環圖進行二元搜尋,而不是逐一檢查每個階段。
  3. 分類原因: 程式碼變更、錯誤/延遲的來源資料、失敗/部分執行,或非冪等的重複。
  4. 比對可疑階段與其輸入(資料列數、鍵值計數、總和),以確認差異出現在何處。
  5. 修復 + 回填受影響區間,確保冪等性(參見 designing-backfills-and-replays)。
  6. 防止重複發生,加入有針對性的資料品質檢查。

常見模式

血緣二元搜尋 — 檢查有向無環圖中一半位置的階段:如果其資料正確,則錯誤在下游;如果錯誤,則繼續向上搜尋。重複此過程。

比對來源與目標(針對受影響的區間):

-- 在錯誤區間內,該階段與其輸入的計數/總和是否一致?
SELECT 'source' AS layer, COUNT(*) n, SUM(amount) total
FROM staging.orders WHERE order_date = DATE '2026-01-15'
UNION ALL
SELECT 'target', COUNT(*), SUM(amount)
FROM marts.fct_orders WHERE order_date = DATE '2026-01-15';

計數差異 → 資料列被篩選/丟棄,或部分載入失敗。計數相同但總和不同 → 轉換/邏輯錯誤。目標計數較高 → 重複(非冪等載入)。

時間線檢查 — 將事故時間區間與部署、來源結構變更及執行歷程關聯起來;大多數事故都始於某次變更。

常見陷阱

  • 在下游修補症狀 — 當錯誤在暫存層時,只修復市集層會導致問題重現;應修復第一個錯誤的階段。
  • 對生產資料進行一次性手動修復 — 無法稽核且不可重複;應修復程式碼並以冪等方式重新執行。
  • 線性閱讀整個有向無環圖 — 應改用二元搜尋血緣的方式。
  • 跳過比對步驟 — 憑猜測判斷資料在哪裡分歧只會浪費時間;應測量每個階段的計數與總和。
  • 修復後未加入預防性檢查 — 同類錯誤會悄悄再次出現。

Individual skills in this repo

This repo contains 9 individual skills — each has its own dedicated page.

Unknown-333/authoring-airflow-dags

Write 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.

Unknown-333/building-dagster-assets

Build 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.

Unknown-333/building-dbt-models

Build 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.

Unknown-333/building-feature-pipelines

Build 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.

Unknown-333/building-iceberg-tables

Design 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.

Unknown-333/building-ingestion-pipelines

Build 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.

Unknown-333/building-kafka-consumers

Build reliable Apache Kafka consumers and producers — consumer groups and partition assignment, offset commit strategy, at-least-once vs exactly-once, idempotent/transactional producers, rebalancing, and dead-letter handling. Use when writing Kafka consumers/producers, configuring offset commits or consumer groups, tuning throughput, or handling rebalances and poison messages.

Unknown-333/designing-backfills-and-replays

Plan and run safe data backfills and replays — idempotent reprocessing of historical windows, partition-by-partition execution, isolating backfill compute from production, verifying results, and avoiding double-counting or changed history. Use when backfilling a new or fixed model, reprocessing after a bug, replaying events, or loading history for a new pipeline without corrupting existing data.

Unknown-333/designing-data-contracts

Define and enforce data contracts between producers and consumers — explicit schema, semantics, ownership, SLAs, and versioning — to prevent silent upstream changes from breaking downstream pipelines. Use when a producer schema change could break consumers, defining an interface between teams/services and the warehouse, or adding schema enforcement at ingestion.

相關技能