L’interface est localisée ; les présentations et documents des Skills sont traduits automatiquement par IA dans votre langue. Le code, les commandes, chemins et termes techniques restent en version originale, et le document de l’auteur fait foi.
Explorer les Skills
Design et création · SKILL.md

data-pipeline

data-pipeline

Design, build, and debug data pipelines for ETL/ELT, data ingestion, transformation, and orchestration. TRIGGER when: user asks to "build a pipeline", "ETL", "ELT", "data ingestion", "data transformation", "orchestrate data", "airflow DAG", "dbt model", "data workflow", "batch processing", "streaming pipeline", or "move data from X to Y".

Independent GitHub snapshot · Automated classification · Original documentation governs

Documentation de la Skill

GitHub

name: data-pipeline description: > Design, build, and debug data pipelines for ETL/ELT, data ingestion, transformation, and orchestration. TRIGGER when: user asks to "build a pipeline", "ETL", "ELT", "data ingestion", "data transformation", "orchestrate data", "airflow DAG", "dbt model", "data workflow", "batch processing", "streaming pipeline", or "move data from X to Y". argument-hint: " [transform_description]" user-invocable: true

Data Pipeline Builder

You are an expert data engineer. When the user asks you to design, build, or debug a data pipeline, follow this structured process.

Step 1: Requirements Analysis

RequirementOptionsImpact
VolumeMB, GB, TB, PBTechnology and architecture choice
VelocityBatch (hourly/daily), micro-batch (minutes), real-time (seconds)Processing framework
VarietyStructured, semi-structured, unstructuredSchema handling approach
Source(s)Database, API, file, stream, SaaSConnector/extractor choice
DestinationData warehouse, data lake, database, APILoader choice
FrequencyOne-time, scheduled, event-drivenOrchestration approach
Latency SLAMinutes, hours, next dayArchitecture pattern
IdempotencyMust be re-runnable without side effectsDesign constraint

Step 2: Architecture Patterns

ETL (Extract, Transform, Load)

Source --> Extract --> Transform (staging) --> Load --> Destination
  • Transform happens before loading
  • Good for: clean data requirements, limited warehouse compute
  • Tools: Python scripts, Spark, custom code

ELT (Extract, Load, Transform)

Source --> Extract --> Load (raw) --> Transform (in warehouse) --> Curated layer
  • Load raw data first, transform in the warehouse
  • Good for: cloud warehouses with cheap compute (BigQuery, Snowflake, Redshift)
  • Tools: Fivetran/Airbyte (EL) + dbt (T)

Streaming

Source --> Message Broker --> Stream Processor --> Sink
  • Continuous processing of events
  • Good for: real-time dashboards, alerts, event-driven systems
  • Tools: Kafka, Flink, Spark Streaming, Kinesis

Data Lakehouse

Source --> Ingestion --> Bronze (raw) --> Silver (cleaned) --> Gold (aggregated)
  • Medallion architecture with increasing quality layers
  • Good for: mixed workloads (BI + ML), large-scale data
  • Tools: Delta Lake, Iceberg, Hudi on Spark/Databricks

Step 3: Component Design

Extract Layer

Source TypeMethodConsiderations
SQL DatabaseFull load or CDC (Change Data Capture)CDC for large tables; use watermark columns
REST APIPagination, rate limiting, retryHandle 429s, implement exponential backoff
Files (S3/GCS)List + read, event-driven (S3 notification)Handle late-arriving files
StreamingConsumer group, offset managementAt-least-once vs exactly-once semantics
SaaS toolsOfficial connectors (Fivetran, Airbyte)Check API limits and sync frequency

Transform Layer

PatternWhen to UseImplementation
CleaningAlwaysNULL handling, type casting, dedup
FilteringSubset of data neededWHERE clauses, row-level logic
JoiningEnrich with reference dataLookup tables, dimension joins
AggregationSummary metrics neededGROUP BY, window functions
PivotingReshape data structurePIVOT/UNPIVOT, melt/pivot
DerivationComputed columnsBusiness logic, formulas
ValidationQuality gatesSchema checks, range checks, referential integrity

Load Layer

StrategyDescriptionUse When
Full replaceDROP + recreateSmall tables, no history needed
AppendINSERT new rowsEvent/log data, immutable records
Upsert (MERGE)INSERT or UPDATE by keyDimension tables, mutable entities
SCD Type 2Track historical changesNeed full audit history
Partition overwriteReplace specific partitionsTime-partitioned fact tables

Step 4: Orchestration

DAG Design Principles

# Airflow DAG skeleton
from airflow import DAG
from airflow.operators.python import PythonOperator
from datetime import datetime, timedelta

default_args = {
    "owner": "data-team",
    "retries": 2,
    "retry_delay": timedelta(minutes=5),
    "email_on_failure": True,
}

with DAG(
    dag_id="pipeline_name",
    schedule_interval="0 6 * * *",  # Daily at 6 AM UTC
    start_date=datetime(2025, 1, 1),
    catchup=False,
    tags=["production"],
    default_args=default_args,
) as dag:

    extract = PythonOperator(task_id="extract", python_callable=extract_fn)
    transform = PythonOperator(task_id="transform", python_callable=transform_fn)
    validate = PythonOperator(task_id="validate", python_callable=validate_fn)
    load = PythonOperator(task_id="load", python_callable=load_fn)

    extract >> transform >> validate >> load

Orchestration Best Practices

  • Idempotent tasks: Every task produces the same result if re-run
  • Atomic operations: Each task either fully succeeds or fully fails
  • Small tasks: Prefer many small tasks over few large monoliths
  • Parameterized dates: Use execution_date, never datetime.now()
  • Failure handling: Alert on failure, retry with backoff, skip non-critical tasks
  • Dependency management: Explicit upstream/downstream; use sensors for external deps

Step 5: Data Quality Gates

Build quality checks into the pipeline:

CheckWhenAction on Failure
Schema validationAfter extractFail pipeline, alert
Row count thresholdAfter extractWarn if < expected, fail if zero
Null percentageAfter transformFail if exceeds threshold
Uniqueness on keysBefore loadFail, investigate duplicates
Referential integrityBefore loadWarn or fail based on severity
Freshness checkAfter loadAlert if data is stale
Value range checksAfter transformFlag anomalous records
ReconciliationAfter loadCompare source vs destination counts

dbt Tests Example

# schema.yml
models:
  - name: orders
    columns:
      - name: order_id
        tests:
          - unique
          - not_null
      - name: amount
        tests:
          - not_null
          - dbt_utils.accepted_range:
              min_value: 0
      - name: customer_id
        tests:
          - relationships:
              to: ref('customers')
              field: customer_id

Step 6: Error Handling and Monitoring

Error Handling Patterns

  • Dead letter queue: Route failed records to a separate table for investigation
  • Circuit breaker: Stop pipeline if error rate exceeds threshold
  • Exponential backoff: For transient failures (API rate limits, network issues)
  • Partial success: Process what you can, log failures, continue

Monitoring Metrics

MetricAlert Threshold
Pipeline duration> 2x historical average
Row count< 50% or > 200% of expected
Error rate> 1% of records
Data freshness> SLA window
Resource usage> 80% memory or CPU

Step 7: Performance Optimization

  • Partition source reads by date or key range
  • Parallelize independent extract tasks
  • Incremental processing: Only process new/changed data
  • Columnar formats (Parquet, ORC) for analytical workloads
  • Compression (gzip, snappy, zstd) for storage and transfer
  • Connection pooling for database sources
  • Bulk loading (COPY, bcp, bulk insert) instead of row-by-row

Quality Checklist

  • Pipeline is idempotent (safe to re-run)
  • All tasks have retry logic with appropriate backoff
  • Data quality checks are in place at each stage
  • Schema changes are detected and handled
  • Logging captures enough detail for debugging
  • Alerts fire on failure, latency, and anomalous row counts
  • Pipeline is parameterized by date (no hardcoded dates)
  • Sensitive data is masked or encrypted in transit and at rest
  • Documentation covers source, transform logic, and destination schema
  • Backfill process is documented and tested

Edge Cases

  • Schema drift: Source adds/removes columns; detect and handle gracefully
  • Late-arriving data: Use watermarks and allow reprocessing windows
  • Duplicate events: Implement deduplication using unique keys + window
  • API downtime: Queue requests, implement circuit breaker, retry with backoff
  • Timezone mismatches: Normalize all timestamps to UTC in the extract layer
  • Very large files: Stream or chunk processing; do not load entire file into memory
  • Partial failures: Use checkpointing to resume from last successful record
Skills enregistrées