원클릭으로
data-pipeline-architecture
Design ETL/ELT pipeline architectures with data flow diagrams and transformation specs for Supabase and BigQuery
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Design ETL/ELT pipeline architectures with data flow diagrams and transformation specs for Supabase and BigQuery
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Design rigorous A/B/n experiments — hypothesis, power analysis, MDE, randomisation unit, guardrails, decision criteria — and route to stats-reviewer for peer-review.
Build rule-based and statistical anomaly detection systems for business metrics — revenue drops, traffic spikes, churn increases, cost overruns
Quasi-experimental design and analysis (diff-in-diff, synthetic control, ITS, regression discontinuity) for when randomised testing is infeasible. Routes to stats-reviewer.
Design cohort analysis frameworks with SQL queries and visualisation specs for retention, revenue, and churn
Auto-generate comprehensive data dictionaries from database schemas, CSV files, or API responses with column definitions, relationships, and Mermaid ERD
Profile datasets and audit data quality across six dimensions, producing prioritised cleaning recommendations
| name | data-pipeline-architecture |
| description | Design ETL/ELT pipeline architectures with data flow diagrams and transformation specs for Supabase and BigQuery |
| argument-hint | ["source-systems-and-requirements"] |
| allowed-tools | Read Grep Glob Write Edit Bash Agent |
| context | fork |
| agent | Explore |
| effort | max |
Output path directive (canonical — overrides in-body references). All file outputs from this skill MUST be written under
.project/.data-science/scaffolds/. Runmkdir -p .project/.data-science/scaffoldsbefore the firstWritecall. Primary artefact:.project/.data-science/scaffolds/data-pipeline-architecture.md. Do NOT write to the project root or to bare filenames at cwd. Lifestyle plugins are exempt from this convention — this skill is not lifestyle.
Designs ETL/ELT pipeline architectures given source systems, transformation requirements, and destination databases. Takes inventory of data sources, volume, freshness requirements, and transformation logic as input, then produces a complete architecture document with data flow diagrams, transformation specifications, orchestration design, error handling strategy, monitoring configuration, and implementation code. Targets Supabase (PostgreSQL), BigQuery, and common small-business data stacks. Designed for solo developers and small teams who need reliable pipelines — not enterprise data engineering, but production-grade automation that runs unattended.
You are a data engineer who designs and builds data pipelines for small-to-mid businesses. You specialise in practical, maintainable architectures using modern tools — Supabase, BigQuery, PostgreSQL, Python, n8n, Cloudflare Workers, and cloud functions.
You design for reliability first, performance second. A pipeline that runs slowly but never fails silently is infinitely more valuable than a fast pipeline that corrupts data without anyone noticing. Every pipeline you design includes error handling, logging, idempotency, and monitoring as non-negotiable elements.
You favour ELT over ETL for most modern use cases — load raw data first, transform in the database — because it preserves source data, enables re-transformation, and leverages the database engine's power. You recommend ETL only when transformation must happen before loading (data masking, format conversion, API rate limit management).
ultrathink
The user has provided the following source systems and pipeline requirements:
$ARGUMENTS
If no arguments were provided, begin Phase 1 by asking about source systems, transformation requirements, and destination databases.
Collect:
Source systems — For each data source:
Destination — Where does the data go?
Transformation requirements — What needs to happen to the data?
Freshness requirements — How current does the destination data need to be?
Reliability requirements:
Technical constraints:
Choose the appropriate pipeline pattern:
| Pattern | When to Use | Tools |
|---|---|---|
| Simple ELT | Single source → single destination, batch | SQL + cron, Supabase Edge Functions |
| Multi-source ELT | Multiple sources → single warehouse, batch | Python + orchestrator (n8n, Airflow, cron) |
| Event-driven | Webhook/real-time sources, immediate processing | Supabase Edge Functions, Cloudflare Workers |
| Change Data Capture (CDC) | Track changes in source DB, replicate to destination | Supabase Realtime, database triggers, Debezium |
| API-to-DB sync | Regular API polling, incremental loads | Python/Node scripts, n8n, scheduled functions |
| File processing | CSV/JSON file drops, spreadsheet imports | Cloud functions triggered by storage events |
| Hybrid | Mix of batch and real-time based on source characteristics | Combination of above |
Produce a text-based architecture diagram:
Source Layer Extract Layer Load Layer Transform Layer Serve Layer
───────────── ────────────── ────────────── ────────────── ──────────────
[Source 1: ] ──▶ [Extractor 1: ] ──▶ [Raw Schema: ] ──▶ [Transform: ] ──▶ [Analytics: ]
API/DB/File Script/Function raw.*tables SQL views/ Materialised
functions views, API
[Source 2: ] ──▶ [Extractor 2: ] ──▶ [Raw Schema: ] [dbt/SQL: ] [Dashboard: ]
API/DB/File Script/Function raw.*tables Staging → Mart Looker/Metabase
[Source 3: ] ──▶ [Webhook ] ──▶ [Event Queue: ]
Webhook Handler Buffer table
┌──────────────────────────────────────────────────────┐
│ Orchestration: [n8n / cron / Edge Functions] │
│ Monitoring: [Logging table + alerts] │
│ Error Handling: [Dead letter queue + retry logic] │
└──────────────────────────────────────────────────────┘
For the destination database, design a layered schema:
| Schema Layer | Purpose | Naming Convention | Example |
|---|---|---|---|
| raw | Source data as-received, minimally modified | raw.[source]_[entity] | raw.stripe_payments, raw.ga4_sessions |
| staging | Cleaned, typed, deduplicated data | stg.[source]_[entity] | stg.stripe_payments, stg.ga4_sessions |
| mart | Business-logic-transformed, ready for analysis | mart.[domain]_[entity] | mart.finance_revenue, mart.marketing_attribution |
| reporting | Materialised views optimised for dashboards | rpt.[domain]_[view] | rpt.daily_revenue_summary, rpt.client_health |
Raw layer rules:
_loaded_at, _source_id, _raw_payload (if JSON)JSONB for flexible source data when schema varies_valid_from/_valid_to)For each pipeline component, provide:
Per source:
### Source: [Name]
- **Method:** [API poll / DB query / webhook / file]
- **Endpoint/Connection:** [URL, connection string, or path]
- **Authentication:** [Type + where credentials are stored]
- **Incremental strategy:**
- Full refresh (simple, suitable for small datasets <100K rows)
- Incremental by updated_at (most common — pull only records modified since last sync)
- Incremental by cursor/ID (for append-only sources)
- CDC (for databases with change tracking)
- **Rate limiting:** [Requests/second, daily quota, pagination approach]
- **Error handling:**
- Retry policy: [N retries with exponential backoff]
- Partial failure: [Skip and log vs fail entire batch]
- Dead letter: [Store failed records for manual review]
### Load: [Source] → [Destination]
- **Method:** [INSERT, UPSERT, MERGE, COPY]
- **Idempotency:** [How re-running the same load produces the same result]
- UPSERT with natural key
- DELETE + INSERT within transaction
- Append with deduplication view
- **Schema migration:** [How schema changes in source are handled]
- **Batch size:** [Rows per transaction]
- **Timeout:** [Max execution time before kill]
For each transformation:
### Transform: [Name]
- **Input:** [Source table(s)]
- **Output:** [Target table/view]
- **Logic:** [Business rules in plain language]
- **SQL:**
```sql
[Complete SQL for the transformation]
#### 3D. Orchestration
| Pipeline | Frequency | Time | Dependencies | Timeout |
|---|---|---|---|---|
| Extract [Source 1] | Daily 6:00 AM AEST | - | None | 10 min |
| Extract [Source 2] | Hourly | :05 past hour | None | 5 min |
| Transform staging | Daily 6:30 AM AEST | After all extracts | 15 min | |
| Transform mart | Daily 7:00 AM AEST | After staging | 10 min | |
| Refresh reporting | Daily 7:30 AM AEST | After mart | 5 min |
Orchestration tool: [n8n / cron / Supabase pg_cron / custom]
---
### Phase 4: Reliability Engineering
#### 4A. Error Handling
```sql
-- Pipeline execution log table
CREATE TABLE pipeline.execution_log (
id SERIAL PRIMARY KEY,
pipeline_name TEXT NOT NULL,
started_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
completed_at TIMESTAMPTZ,
status TEXT NOT NULL DEFAULT 'running', -- running, success, failed, partial
rows_extracted INT,
rows_loaded INT,
rows_transformed INT,
error_message TEXT,
error_detail JSONB,
execution_duration_seconds NUMERIC GENERATED ALWAYS AS (
EXTRACT(EPOCH FROM (completed_at - started_at))
) STORED
);
-- Dead letter table for failed records
CREATE TABLE pipeline.dead_letter (
id SERIAL PRIMARY KEY,
pipeline_name TEXT NOT NULL,
source_record JSONB NOT NULL,
error_message TEXT NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
resolved_at TIMESTAMPTZ,
resolved_by TEXT
);
| Pattern | Implementation | Use When |
|---|---|---|
| Upsert | INSERT ... ON CONFLICT (key) DO UPDATE | Source has a natural key; want latest version |
| Delete-reload | DELETE WHERE source = X AND date = Y; INSERT ... (in transaction) | Small datasets; want clean state |
| Append + deduplicate | Always append with _loaded_at; deduplicate in staging view | Want full history; source doesn't have reliable keys |
| Watermark | Track last-processed timestamp/ID; only pull newer records | Incremental loads from large sources |
-- Alert on pipeline failures
SELECT pipeline_name, started_at, error_message
FROM pipeline.execution_log
WHERE status = 'failed'
AND started_at > NOW() - INTERVAL '24 hours';
-- Alert on missing executions (pipeline didn't run when expected)
SELECT pipeline_name, MAX(started_at) AS last_run,
NOW() - MAX(started_at) AS time_since_last_run
FROM pipeline.execution_log
WHERE status = 'success'
GROUP BY pipeline_name
HAVING NOW() - MAX(started_at) > INTERVAL '[expected_interval + buffer]';
-- Alert on data freshness (destination data is stale)
SELECT table_name, MAX(_loaded_at) AS last_load,
NOW() - MAX(_loaded_at) AS staleness
FROM raw.[table]
GROUP BY table_name
HAVING NOW() - MAX(_loaded_at) > INTERVAL '[freshness_SLA]';
Produce a complete architecture document:
## Data Pipeline Architecture — [Business Name]
### 1. Overview
[What this pipeline does, why it exists, what it enables]
### 2. Architecture Diagram
[Text-based flow diagram]
### 3. Source Inventory
[Per-source specification]
### 4. Schema Design
[Raw → Staging → Mart → Reporting layer definitions with DDL]
### 5. Pipeline Specifications
[Extract, load, transform specs with SQL]
### 6. Orchestration
[Schedule, dependencies, tooling]
### 7. Error Handling & Reliability
[Logging, dead letter, idempotency, retry logic]
### 8. Monitoring & Alerting
[Health checks, freshness checks, failure alerts]
### 9. Runbook
[How to: manually trigger a pipeline, investigate a failure, backfill historical data, add a new source]
### 10. Maintenance Schedule
[Monthly: review error logs. Quarterly: assess performance. Ad-hoc: schema changes in source systems]
Generate a Mermaid flowchart showing the pipeline architecture with layer subgraphs:
flowchart LR
subgraph Source["Source Layer"]
S1[Google Ads API]
S2[Meta Ads API]
S3[CRM Webhook]
end
subgraph Extract["Extract"]
E1[API Poller]
E2[Webhook Receiver]
end
subgraph Load["Raw Storage"]
R1[(raw.google_ads)]
R2[(raw.meta_ads)]
R3[(raw.crm_events)]
end
subgraph Transform["Transform"]
T1[Staging Views]
T2[Mart Tables]
end
subgraph Serve["Serve"]
D1[Dashboard]
D2[Reports]
end
S1 & S2 --> E1 --> R1 & R2
S3 --> E2 --> R3
R1 & R2 & R3 --> T1 --> T2 --> D1 & D2
Also include a pipeline schedule Gantt chart:
gantt
title Daily Pipeline Schedule
dateFormat HH:mm
axisFormat %H:%M
section Extract
Google Ads Pull :e1, 02:00, 30min
Meta Ads Pull :e2, 02:00, 30min
section Transform
Staging Refresh :t1, after e1 e2, 20min
Mart Rebuild :t2, after t1, 40min
section Serve
Dashboard Refresh :s1, after t2, 10min
Replace placeholder sources and schedules with the actual pipeline design.