Install
$ agentstack add skill-zakelfassi-skills-driven-development-pipeline-stage ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
About
Pipeline Stage
Create a new transform stage with idempotency guarantees, a schema contract, and tests.
Inputs
- Stage name (snake_case, e.g.,
customer_ltv) - Input tables/models (list of upstream stage names or raw tables)
- Output table name (usually matches stage name)
- Grain (the primary key or unique key, e.g.,
customer_id,(order_id, date)) - Layer (
staging,intermediate,marts)
Steps
- Create the transform file
For dbt: `` models/{layer}/{stage_name}.sql ` ``sql {{ config( materialized='table', unique_key='{grain}' ) }}
select {grain}, -- TODO: add business logic currenttimestamp as updatedat from {{ ref('{input_table}') }} ```
For pandas ETL: `` pipelines/transforms/{stage_name}/transform.py ` `python def run(df: pd.DataFrame) -> pd.DataFrame: """Transform {input_table} → {stage_name}.""" # TODO: add business logic return df ``
- Define the schema contract
Create models/{layer}/schema/{stage_name}.yaml (dbt) or pipelines/transforms/{stage_name}/schema.py: ```yaml
- name: {stage_name}
columns:
- name: {grain}
tests:
- unique
- not_null
`` Every non-nullable column must have not_null test; every unique key must have unique` test.
- Add idempotency logic
- For
materialized='table': dbt handles full replacement — no extra work. - For incremental models: use
is_incremental()filter onupdated_ator an event timestamp. - For pandas: the output must be deterministic given the same input; add a dedup step on
{grain}.
- Write tests
`` tests/transforms/test_{stage_name}.py `` Required tests:
- Input fixture → expected output shape (column names, row count)
- Idempotency: running twice produces identical output
- Null check: no nulls in required columns after transform
- Register in the pipeline DAG
Add the stage after its upstream dependencies: ``python # dags/pipeline.py {stage_name}_task = DbtRunOperator( task_id="{stage_name}", models="{stage_name}", ) {upstream_task} >> {stage_name}_task ``
- Run locally
``bash dbt run --select {stage_name} dbt test --select {stage_name} # or for pandas: python -m pytest tests/transforms/test_{stage_name}.py -v ``
Conventions
- Layer hierarchy:
raw→staging→intermediate→marts - Never skip a layer (e.g., don't read from
rawin amartsmodel) - All stages have at least one
unique+not_nulltest on the grain column - Incremental models use
updated_atas the watermark; add it to every model
Edge Cases
- Fan-out (multiple downstream consumers): Create the stage at the
intermediatelayer; let downstreammartsmodels reference it. - Slowly changing dimension (SCD): Use dbt's
snapshotmaterialization or addvalid_from/valid_tocolumns manually. - Cross-database join: Materialize both inputs to the same database first, then join; cross-database SQL is not portable.
- Very wide table (>200 columns): Split into a core model plus an extension model; document the split in the schema YAML.
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: zakelfassi
- Source: zakelfassi/skills-driven-development
- License: MIT
- Homepage: https://zakelfassi.github.io/skills-driven-development/
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.