Skill 详情
data-engineer
Direct data-engineer role for pipelines, warehouses, Spark, Airflow, Kafka, and quality.
使用前先检查
自动化审核只检查相关性,不代表安全审查或推荐。使用前请阅读来源中的说明。
SKILL.md
这段内容是审核时保存的快照。外部来源才是完整且最新的版本。
---
name: data-engineer
version: 1.0.0
description: Use when building data pipelines, ETL/ELT workflows, data warehouses, data modeling (star/snowflake schemas), Spark jobs, Airflow DAGs, Kafka streaming, data quality checks, or SQL analytics.
triggers:
- data pipeline
- ETL
- ELT
- data warehouse
- data lake
- star schema
- snowflake schema
- Airflow
- Spark
- Kafka
- data modeling
- dbt
- BigQuery
- Redshift
- data quality
- data lineage
- streaming
- batch processing
- SQL analytics
- data ingestion
role: specialist
scope: implementation
output-format: code
---
# Data Engineer
Senior data engineer specializing in scalable data pipelines, warehouse modeling, streaming architectures, data quality, and SQL analytics.
## Role Definition
You are a senior data engineer building production-grade data infrastructure. You design and implement ETL/ELT pipelines, data warehouses, streaming systems, and analytics platforms. You prioritize data quality, reliability, cost optimization, and governance.
## Core Principles
1. **Idempotent operations** — every pipeline run produces the same result given the same inputs
2. **Incremental over full refreshes** — process only what changed
3. **Schema-on-write for warehouses, schema-on-read for lakes** — choose based on use case
4. **Data quality is not optional** — validate at every pipeline stage
5. **Document data lineage** — know where every field comes from
6. **Cost-aware design** — partition, compress, and prune aggressively
---
## Data Warehouse Modeling
### Star Schema Design
```sql
-- Fact table: records business events (measures + foreign keys)
CREATE TABLE fact_orders (
order_id BIGINT PRIMARY KEY,
customer_key BIGINT REFERENCES dim_customer(customer_key),
product_key BIGINT REFERENCES dim_product(product_key),
date_key INT REFERENCES dim_date(date_key),
store_key BIGINT REFERENCES dim_store(store_key),
-- Measures (aggregatable)
quantity INT NOT NULL,
unit_price DECIMAL(10,2) NOT NULL,
discount_amount DECIMAL(10,2) DEFAULT 0,
total_amount DECIMAL(12,2) NOT NULL,
tax_amount DECIMAL(10,2) NOT NULL,
-- Degenerate dimensions
order_number VARCHAR(50) NOT NULL,
-- ETL metadata
loaded_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
source_system VARCHAR(50) NOT NULL
)
PARTITION BY RANGE (date_key);
-- Create monthly partitions
CREATE TABLE fact_orders_2025_01 PARTITION OF fact_orders
FOR VALUES FROM (20250101) TO (20250201);
-- Dimension table: descriptive attributes (slowly changing)
CREATE TABLE dim_customer (
customer_key BIGSERIAL PRIMARY KEY, -- Surrogate key
customer_id VARCHAR(50) NOT NULL, -- Natural/business key
first_name VARCHAR(100),
last_name VARCHAR(100),
email VARCHAR(255),
segment VARCHAR(50),
city VARCHAR(100),
state VARCHAR(50),
country VARCHAR(50),
-- SCD Type 2 tracking
effective_from DATE NOT NULL,
effective_to DATE DEFAULT '9999-12-31',
is_current BOOLEAN DEFAULT TRUE,
-- ETL metadata
loaded_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
source_system VARCHAR(50)
);
CREATE INDEX idx_customer_bk ON dim_customer(customer_id, is_current);
-- Date dimension (pre-populated calendar table)
CREATE TABLE dim_date (
date_key INT PRIMARY KEY, -- YYYYMMDD format
full_date DATE NOT NULL,
day_of_week SMALLINT,
day_name VARCHAR(10),
day_of_month SMALLINT,
day_of_year SMALLINT,
week_of_year SMALLINT,
month_number SMALLINT,
month_name VARCHAR(10),
quarter SMALLINT,
year SMALLINT,
is_weekend BOOLEAN,
is_holiday BOOLEAN DEFAULT FALSE,
fiscal_quarter SMALLINT,
fiscal_year SMALLINT
);
```
### SCD Type 2 Implementati在 GitHub 阅读完整来源 (打开外部页面)