From dp
IL DataPlatformSnowflake dbt conventions: WELD_NORTH_TEST personal-target, SCD CTE chains, incremental ALTER, Snowchange migrations. Auto-loaded for dw_dbt/ changes.
How this skill is triggered — by the user, by Claude, or both
Slash command
/dp:dbt-fix-conventionsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
IL-specific conventions for editing dbt models in `ImagineLearning/DataPlatformSnowflake`. These rules are **not** generic dbt — they encode the personal-target sandbox workflow, the WNE_DIM_MODEL/STAGING quirks, and the SCD-chain pitfalls that have produced production incidents.
IL-specific conventions for editing dbt models in ImagineLearning/DataPlatformSnowflake. These rules are not generic dbt — they encode the personal-target sandbox workflow, the WNE_DIM_MODEL/STAGING quirks, and the SCD-chain pitfalls that have produced production incidents.
This skill is a reference, not a workflow. Code generation, branching, audits, and review are handled by /il:generate-code. Apply these rules when generating or modifying anything under dw_dbt/app/snowflake/.
WELD_NORTH_PROD. Never write to it. All dbt runs use the engineer's personal target (DBT_TARGET env var). The profiles.yml database is hardcoded to WELD_NORTH_TEST.Glob/Grep against $DPS_DBT_ROOT/models/ and verify columns via INFORMATION_SCHEMA.COLUMNS before referencing them. Do not invent column names.schema.yml descriptions, and any validation output (FERPA/COPPA).UPPER_SNAKE_CASE (tables, columns).lower_snake_case for CTEs, aliases, locally-bound names.{{ surrogate_key([...]) }} — never hand-roll MD5(CONCAT(...)).{{ source('schema', 'table') }}. Upstream models: {{ ref('model') }}.generate_schema_name per-model. The repo macro routes by directory.When adding or modifying a column, the matching schema.yml entry MUST be updated in the same change:
description (drives the Snowflake COMMENT, which /dp:investigate-data reads as the business definition).not_null on grain columns, unique on natural/surrogate keys, relationships to upstream dims, accepted_values for enums.PII, FERPA, COPPA) so downstream consumers can detect them.If the model directory has no schema.yml, create one — every model directory in this repo has one by convention.
| Schema target | dbt path | Materialization |
|---|---|---|
WNE_DIM_MODEL | models/core/dimension/, models/core/fact/ | table, incremental |
STAGING | models/staging/ | table, incremental |
SISENSE | models/standalone/ | table, view |
IL_EVENTS | models/il-events/ | incremental |
For incremental models, preserve the existing unique_key and strategy. Do not switch strategies as a side-effect of an unrelated change.
dbt does not auto-evolve schema on incremental targets unless on_schema_change is configured (most models in this repo aren't). When adding a column to an incremental model:
WELD_NORTH_TEST.<schema>.<table> manually before running dbt:
ALTER TABLE WELD_NORTH_TEST.<schema>.<table>
ADD COLUMN IF NOT EXISTS <new_col> <type>
COMMENT '<business definition>';
dbt run -t $DBT_TARGET -s <model>.--full-refresh on a >10M row incremental requires the engineer's explicit confirmation in the orchestrator.
class_dim and friendsSCD Type 2 models in this repo have a CTE chain that all must be updated when a column is added or renamed. For class_dim specifically:
new_class_events → new_class → new_and_updated_class → updated_class → new_class1 → updates_deletes → inserts → dummy_row
new_class1 is the one engineers most commonly miss. Generated edits to any SCD model must touch every CTE in the chain or the new column will silently drop on update rows.
Other SCD models follow the same pattern with different CTE names — search the model's existing structure with Grep before editing.
These apply when running dbt locally against WELD_NORTH_TEST via DBT_TARGET. They do not apply in CI/CD (the staging target).
WNE_DIM_MODEL, not STAGING. A staging model built locally lands in WELD_NORTH_TEST.WNE_DIM_MODEL.<name>_STAGING, but downstream models hardcode STAGING. To validate locally, query the WNE_DIM_MODEL copy directly.--threads 1 to prevent races: dbt run -s <staging_model> --threads 1 && dbt run -s <downstream> --threads 1.packages.yml blocks compile if dbt deps failed. Comment it out for local testing only — restore before commit.DATA_ENGINEER role cannot write to STAGING. Don't try to clone tables there for validation; use compiled SQL + the WNE_DIM_MODEL copy.$LASTEXITCODE alone.WELD_NORTH_DEV/QA before the dbt PR merges.Path: snowchange/sql/WELD_NORTH/V<version>__<desc>_dp_<TICKET>.sql
Standards:
ALTER TABLE ADD COLUMN IF NOT EXISTS <col> per statement (the multi-column form does not support IF NOT EXISTS).COMMENT on every new column.BEGIN; ... COMMIT;.UPDATEs use WHERE <col> IS NULL for idempotency, ROW_NUMBER() ... QUALIFY rn = 1 for dedup.sandbox.scratch.<table>_<env>_<ticket>_bkp (transient) before backfill. Any DDL like this clone step requires explicit user confirmation before execution — never auto-execute CREATE / ALTER from this skill.Reference: any recent V*.sql under DataPlatformSnowflake/snowchange/sql/WELD_NORTH/ that adds a column with backfill (sort by version desc).
After dbt run, verify the materialization landed and columns evolved:
SELECT TABLE_NAME, ROW_COUNT, LAST_ALTERED
FROM WELD_NORTH_TEST.INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME ILIKE '<model_name>';
SELECT COLUMN_NAME, DATA_TYPE, COMMENT
FROM WELD_NORTH_TEST.INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME ILIKE '<model_name>'
ORDER BY ORDINAL_POSITION;
For backfills, snapshot null-rate before and after the UPDATE — aggregates only, no PII.
| Need | Skill |
|---|---|
| Find a model, lineage, materialization | dp:explore-dbt-models |
| Run validation queries against WELD_NORTH_TEST | dp:query-snowflake |
| Investigate the data before fixing | /dp:investigate-data <TICKET> |
| Publish the fix summary | Skill dp:publish-ticket-confluence |
npx claudepluginhub imaginelearning/dp-claude-plugin --plugin dpProvides UI/UX resources: 50+ styles, color palettes, font pairings, guidelines, charts for web/mobile across React, Next.js, Vue, Svelte, Tailwind, React Native, Flutter. Aids planning, building, reviewing interfaces.
Searches MemPalace before answering questions about past work, people, projects, or prior decisions. Returns verbatim stored content instead of guessing from model memory.