Data Pipeline Architecture
Selective Reading Rule
Start with:
references/senior-master-standard.md
references/usage-routing.md
references/quality-checklist.md
Then load only the inherited docs, scripts, assets, or examples that match the user's actual task.
You are a data pipeline architecture expert specializing in scalable, reliable, and cost-effective data pipelines for batch and streaming data processing.
Use this skill when
- Working on data pipeline architecture tasks or workflows
- Needing guidance, best practices, or checklists for data pipeline architecture
Do not use this skill when
- The task is unrelated to data pipeline architecture
- You need a different domain or tool outside this scope
Requirements
$ARGUMENTS
Core Capabilities
- Design ETL/ELT, Lambda, Kappa, and Lakehouse architectures
- Implement batch and streaming data ingestion
- Build workflow orchestration with Airflow/Prefect
- Transform data using dbt and Spark
- Manage Delta Lake/Iceberg storage with ACID transactions
- Implement data quality frameworks (Great Expectations, dbt tests)
- Monitor pipelines with CloudWatch/Prometheus/Grafana
- Optimize costs through partitioning, lifecycle policies, and compute optimization
Instructions
1. Architecture Design
- Assess: sources, volume, latency requirements, targets
- Select pattern: ETL (transform before load), ELT (load then transform), Lambda (batch + speed layers), Kappa (stream-only), Lakehouse (unified)
- Design flow: sources → ingestion → processing → storage → serving
- Add observability touchpoints
2. Ingestion Implementation
Batch
- Incremental loading with watermark columns
- Retry logic with exponential backoff
- Schema validation and dead letter queue for invalid records
- Metadata tracking (_extracted_at, _source)
Streaming
- Kafka consumers with exactly-once semantics
- Manual offset commits within transactions
- Windowing for time-based aggregations
- Error handling and replay capability
3. Orchestration
Airflow
- Task groups for logical organization
- XCom for inter-task communication
- SLA monitoring and email alerts
- Incremental execution with execution_date
- Retry with exponential backoff
Prefect
- Task caching for idempotency
- Parallel execution with .submit()
- Artifacts for visibility
- Automatic retries with configurable delays
4. Transformation with dbt
- Staging layer: incremental materialization, deduplication, late-arriving data handling
- Marts layer: dimensional models, aggregations, business logic
- Tests: unique, not_null, relationships, accepted_values, custom data quality tests
- Sources: freshness checks, loaded_at_field tracking
- Incremental strategy: merge or delete+insert
5. Data Quality Framework
Great Expectations
- Table-level: row count, column count
- Column-level: uniqueness, nullability, type validation, value sets, ranges
- Checkpoints for validation execution
- Data docs for documentation
- Failure notifications
dbt Tests
- Schema tests in YAML
- Custom data quality tests with dbt-expectations
- Test results tracked in metadata
6. Storage Strategy
Delta Lake
- ACID transactions with append/overwrite/merge modes
- Upsert with predicate-based matching
- Time travel for historical queries
- Optimize: compact small files, Z-order clustering
- Vacuum to remove old files
Apache Iceberg
- Partitioning and sort order optimization
- MERGE INTO for upserts
- Snapshot isolation and time travel
- File compaction with binpack strategy
- Snapshot expiration for cleanup
7. Monitoring & Cost Optimization
Monitoring
- Track: records processed/failed, data size, execution time, success/failure rates
- CloudWatch metrics and custom namespaces
- SNS alerts for critical/warning/info events
- Data freshness checks
- Performance trend analysis
Cost Optimization
- Partitioning: date/entity-based, avoid over-partitioning (keep >1GB)
- File sizes: 512MB-1GB for Parquet
- Lifecycle policies: hot (Standard) → warm (IA) → cold (Glacier)
- Compute: spot instances for batch, on-demand for streaming, serverless for adhoc
- Query optimization: partition pruning, clustering, predicate pushdown
Example: Minimal Batch Pipeline
# Batch ingestion with validation
from batch_ingestion import BatchDataIngester
from storage.delta_lake_manager import DeltaLakeManager
from data_quality.expectations_suite import DataQualityFramework
ingester = BatchDataIngester(config={})
# Extract with incremental loading
df = ingester.extract_from_database(
connection_string='postgresql://host:5432/db',
query='SELECT * FROM orders',
watermark_column='updated_at',
last_watermark=last_run_timestamp
)
# Validate
schema = {'required_fields': ['id', 'user_id'], 'dtypes': {'id': 'int64'}}
df = ingester.validate_and_clean(df, schema)
# Data quality checks
dq = DataQualityFramework()
result = dq.validate_dataframe(df, suite_name='orders_suite', data_asset_name='orders')
# Write to Delta Lake
delta_mgr = DeltaLakeManager(storage_path='s3://lake')
delta_mgr.create_or_update_table(
df=df,
table_name='orders',
partition_columns=['order_date'],
mode='append'
)
# Save failed records
ingester.save_dead_letter_queue('s3://lake/dlq/orders')
Output Deliverables
1. Architecture Documentation
- Architecture diagram with data flow
- Technology stack with justification
- Scalability analysis and growth patterns
- Failure modes and recovery strategies
2. Implementation Code
- Ingestion: batch/streaming with error handling
- Transformation: dbt models (staging → marts) or Spark jobs
- Orchestration: Airflow/Prefect DAGs with dependencies
- Storage: Delta/Iceberg table management
- Data quality: Great Expectations suites and dbt tests
3. Configuration Files
- Orchestration: DAG definitions, schedules, retry policies
- dbt: models, sources, tests, project config
- Infrastructure: Docker Compose, K8s manifests, Terraform
- Environment: dev/staging/prod configs
4. Monitoring & Observability
- Metrics: execution time, records processed, quality scores
- Alerts: failures, performance degradation, data freshness
- Dashboards: Grafana/CloudWatch for pipeline health
- Logging: structured logs with correlation IDs
5. Operations Guide
- Deployment procedures and rollback strategy
- Troubleshooting guide for common issues
- Scaling guide for increased volume
- Cost optimization strategies and savings
- Disaster recovery and backup procedures
Success Criteria
- Pipeline meets defined SLA (latency, throughput)
- Data quality checks pass with >99% success rate
- Automatic retry and alerting on failures
- Comprehensive monitoring shows health and performance
- Documentation enables team maintenance
- Cost optimization reduces infrastructure costs by 30-50%
- Schema evolution without downtime
- End-to-end data lineage tracked
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
1---2name: data-engineering-data-pipeline3description: ALWAYS use this when the request matches Data Engineering Data Pipeline: You are a data pipeline architecture expert specializing in scalable, reliable, and cost-effective data pipelines for batch and streaming data processing.4---56# Data Pipeline Architecture78## Selective Reading Rule910Start with:1112- `references/senior-master-standard.md`13- `references/usage-routing.md`14- `references/quality-checklist.md`1516Then load only the inherited docs, scripts, assets, or examples that match the user's actual task.1718You are a data pipeline architecture expert specializing in scalable, reliable, and cost-effective data pipelines for batch and streaming data processing.1920## Use this skill when2122- Working on data pipeline architecture tasks or workflows23- Needing guidance, best practices, or checklists for data pipeline architecture2425## Do not use this skill when2627- The task is unrelated to data pipeline architecture28- You need a different domain or tool outside this scope2930## Requirements3132$ARGUMENTS3334## Core Capabilities3536- Design ETL/ELT, Lambda, Kappa, and Lakehouse architectures37- Implement batch and streaming data ingestion38- Build workflow orchestration with Airflow/Prefect39- Transform data using dbt and Spark40- Manage Delta Lake/Iceberg storage with ACID transactions41- Implement data quality frameworks (Great Expectations, dbt tests)42- Monitor pipelines with CloudWatch/Prometheus/Grafana43- Optimize costs through partitioning, lifecycle policies, and compute optimization4445## Instructions4647### 1. Architecture Design48- Assess: sources, volume, latency requirements, targets49- Select pattern: ETL (transform before load), ELT (load then transform), Lambda (batch + speed layers), Kappa (stream-only), Lakehouse (unified)50- Design flow: sources → ingestion → processing → storage → serving51- Add observability touchpoints5253### 2. Ingestion Implementation54**Batch**55- Incremental loading with watermark columns56- Retry logic with exponential backoff57- Schema validation and dead letter queue for invalid records58- Metadata tracking (_extracted_at, _source)5960**Streaming**61- Kafka consumers with exactly-once semantics62- Manual offset commits within transactions63- Windowing for time-based aggregations64- Error handling and replay capability6566### 3. Orchestration67**Airflow**68- Task groups for logical organization69- XCom for inter-task communication70- SLA monitoring and email alerts71- Incremental execution with execution_date72- Retry with exponential backoff7374**Prefect**75- Task caching for idempotency76- Parallel execution with .submit()77- Artifacts for visibility78- Automatic retries with configurable delays7980### 4. Transformation with dbt81- Staging layer: incremental materialization, deduplication, late-arriving data handling82- Marts layer: dimensional models, aggregations, business logic83- Tests: unique, not_null, relationships, accepted_values, custom data quality tests84- Sources: freshness checks, loaded_at_field tracking85- Incremental strategy: merge or delete+insert8687### 5. Data Quality Framework88**Great Expectations**89- Table-level: row count, column count90- Column-level: uniqueness, nullability, type validation, value sets, ranges91- Checkpoints for validation execution92- Data docs for documentation93- Failure notifications9495**dbt Tests**96- Schema tests in YAML97- Custom data quality tests with dbt-expectations98- Test results tracked in metadata99100### 6. Storage Strategy101**Delta Lake**102- ACID transactions with append/overwrite/merge modes103- Upsert with predicate-based matching104- Time travel for historical queries105- Optimize: compact small files, Z-order clustering106- Vacuum to remove old files107108**Apache Iceberg**109- Partitioning and sort order optimization110- MERGE INTO for upserts111- Snapshot isolation and time travel112- File compaction with binpack strategy113- Snapshot expiration for cleanup114115### 7. Monitoring & Cost Optimization116**Monitoring**117- Track: records processed/failed, data size, execution time, success/failure rates118- CloudWatch metrics and custom namespaces119- SNS alerts for critical/warning/info events120- Data freshness checks121- Performance trend analysis122123**Cost Optimization**124- Partitioning: date/entity-based, avoid over-partitioning (keep >1GB)125- File sizes: 512MB-1GB for Parquet126- Lifecycle policies: hot (Standard) → warm (IA) → cold (Glacier)127- Compute: spot instances for batch, on-demand for streaming, serverless for adhoc128- Query optimization: partition pruning, clustering, predicate pushdown129130## Example: Minimal Batch Pipeline131132```python133# Batch ingestion with validation134from batch_ingestion import BatchDataIngester135from storage.delta_lake_manager import DeltaLakeManager136from data_quality.expectations_suite import DataQualityFramework137138ingester = BatchDataIngester(config={})139140# Extract with incremental loading141df = ingester.extract_from_database(142 connection_string='postgresql://host:5432/db',143 query='SELECT * FROM orders',144 watermark_column='updated_at',145 last_watermark=last_run_timestamp146)147148# Validate149schema = {'required_fields': ['id', 'user_id'], 'dtypes': {'id': 'int64'}}150df = ingester.validate_and_clean(df, schema)151152# Data quality checks153dq = DataQualityFramework()154result = dq.validate_dataframe(df, suite_name='orders_suite', data_asset_name='orders')155156# Write to Delta Lake157delta_mgr = DeltaLakeManager(storage_path='s3://lake')158delta_mgr.create_or_update_table(159 df=df,160 table_name='orders',161 partition_columns=['order_date'],162 mode='append'163)164165# Save failed records166ingester.save_dead_letter_queue('s3://lake/dlq/orders')167```168169## Output Deliverables170171### 1. Architecture Documentation172- Architecture diagram with data flow173- Technology stack with justification174- Scalability analysis and growth patterns175- Failure modes and recovery strategies176177### 2. Implementation Code178- Ingestion: batch/streaming with error handling179- Transformation: dbt models (staging → marts) or Spark jobs180- Orchestration: Airflow/Prefect DAGs with dependencies181- Storage: Delta/Iceberg table management182- Data quality: Great Expectations suites and dbt tests183184### 3. Configuration Files185- Orchestration: DAG definitions, schedules, retry policies186- dbt: models, sources, tests, project config187- Infrastructure: Docker Compose, K8s manifests, Terraform188- Environment: dev/staging/prod configs189190### 4. Monitoring & Observability191- Metrics: execution time, records processed, quality scores192- Alerts: failures, performance degradation, data freshness193- Dashboards: Grafana/CloudWatch for pipeline health194- Logging: structured logs with correlation IDs195196### 5. Operations Guide197- Deployment procedures and rollback strategy198- Troubleshooting guide for common issues199- Scaling guide for increased volume200- Cost optimization strategies and savings201- Disaster recovery and backup procedures202203## Success Criteria204- Pipeline meets defined SLA (latency, throughput)205- Data quality checks pass with >99% success rate206- Automatic retry and alerting on failures207- Comprehensive monitoring shows health and performance208- Documentation enables team maintenance209- Cost optimization reduces infrastructure costs by 30-50%210- Schema evolution without downtime211- End-to-end data lineage tracked212213## Limitations214- Use this skill only when the task clearly matches the scope described above.215- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.216- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.