Warehouse Modeling
ASecurityImplement and maintain transformation layers in a data warehouse or lakehouse with the project's tools, such as dbt, SQLMesh, stored procedures, Spark SQL or Delta/Iceberg tables. Use when building staging, intermediate and mart models; writing incremental models and merge logic; implementing slowly changing dimensions (SCD type 2) and snapshots; choosing partitioning, clustering and materialization; adding schema tests (unique, not null, relationships, accepted values) and source freshness; ...
- 19 stars
- 0 votes
- 0 copies
- 1 view
- Added November 29, 2026
Security analysis
100/100Pro scans all 2 files and shows the line behind each finding
npx -y skills add khoavd18/skills --skill warehouse-modeling --agent claude-codeAre you the author of Warehouse Modeling?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/khoavd18-warehouse-modeling)---
name: warehouse-modeling
description: Implement and maintain transformation layers in a data warehouse or lakehouse with the project's tools, such as dbt, SQLMesh, stored procedures, Spark SQL or Delta/Iceberg tables. Use when building staging, intermediate and mart models; writing incremental models and merge logic; implementing slowly changing dimensions (SCD type 2) and snapshots; choosing partitioning, clustering and materialization; adding schema tests (unique, not null, relationships, accepted values) and source freshness; managing model dependencies and lineage; or refactoring slow or duplicated transformations. Not for deciding the grain and star schema of a business question (use analytics-architect), ad-hoc analytical SQL (use sql-analytics-expert) or scheduling (use pipeline-orchestration).
---
# Warehouse Modeling
Turns raw sources into tested, incremental, documented tables that downstream users can trust and the warehouse can afford.
## Inputs
- Source tables or files with their grain, keys, update behaviour (append, upsert, full snapshot) and arrival schedule.
- The target model design (grain, dimensions, facts) from **analytics-architect** or the project docs. Business rules not documented there are `UNKNOWN`.
## Procedure
1. **Detect the stack**: warehouse and SQL dialect, transformation tool and version (`dbt_project.yml`, `sqlmesh` config, procedures), naming conventions, environments (dev/prod targets). Follow them.
2. **Layer the models**: staging (one per source table: rename, cast, deduplicate; no joins), intermediate (reusable joins and logic), marts (facts and dimensions at a stated grain). See [modeling-layers.md](references/modeling-layers.md).
3. **State the grain and key of every model** in its docs and test it (`unique` + `not_null` on the key).
4. **Choose materialization**: view, table, incremental or snapshot, by size, freshness and cost.
5. **Incremental logic**: a reliable change column or partition, a lookback window for late data, `merge`/`delete+insert` on the unique key, and a tested full-refresh path.
6. **History**: SCD type 2 (or tool snapshots) when consumers need values as of a past date; validity columns `valid_from`/`valid_to`/`is_current` with no gaps or overlaps.
7. **Tests**: schema tests on every mart key and foreign key, accepted values for statuses, source freshness, and row-count reconciliation for high-risk models (**data-quality-auditor**).
8. **Performance**: partition and cluster on filter columns, prune early, avoid repeated heavy CTEs; check the query plan before and after (**sql-analytics-expert**).
9. **Document and review**: model descriptions, column descriptions for business fields, lineage, and a changelog entry for breaking changes.
## Rules
- Never change a mart's grain, key or column meaning silently; treat it as a breaking change for consumers.
- Never run full refreshes, `DROP` or backfills on production targets without confirmation; develop against a dev target.
- No `SELECT DISTINCT` to hide duplicates from a bad join; fix the join or the key.
- Keep credentials in profiles or a secret store, never in model files.
- Apply the [pipeline reliability contract](../pipeline-orchestration/references/pipeline-reliability-contract.md).
## Outputs
Model SQL and configs in the project's tool, tests and docs for each model, an incremental/full-refresh strategy, and a list of assumptions and open business rules.
## Hand-offs
Grain and star-schema design → **analytics-architect**. KPI definitions → **kpi-metrics-engineer**. Query tuning → **sql-analytics-expert**. Scheduling → **pipeline-orchestration**.
Files in this skill
- SKILL.md
- references/modeling-layers.md
Attribution
Related skills
View all in ai-agents →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.