← Back to skills
Data & Analytics · Made here

dbt Models

dbt-model-writer · tables → dbt project

Builds staging, intermediate and mart models with naming conventions, tests, documentation and incremental materializations.

Download SKILL.mdAdd to a recipe
Watch the demo0:55
Borrow a skill and use it0:55
In Claude (connector)install_skill("dbt-model-writer")
CLIlendskill install dbt-model-writer

Used in recipes: Raw data → Dashboard

SKILL.md

---
name: dbt-model-writer
description: Write dbt models from source tables — sources, staging, intermediate and mart layers, incremental models, tests (unique, not_null, relationships, accepted_values) and docs. Use for dbt projects, analytics engineering, modeling a warehouse or 'turn these tables into clean models'.
license: Proprietary — Lendskill original
---

# dbt Model Writer

## Layers and naming
- `sources.yml` declares raw tables (with freshness where timestamps exist).
- `stg_<source>__<entity>`: one per source table; rename to snake_case, cast types, no joins, no business logic.
- `int_<entity>_<verb>`: joins and reshaping reused by marts.
- `fct_<event>` / `dim_<entity>`: marts at a clear grain stated at the top of each model.

## Model rules
- Refer with `{{ ref() }}` / `{{ source() }}` only.
- One grain per model; write it in the model description ("one row per order line").
- CTEs: import CTEs at the top, then logical CTEs, final `select`.
- Large facts: `materialized='incremental'` with `unique_key` and an `is_incremental()` filter on an updated-at column.

## Tests and docs
Every primary key: `unique` + `not_null`. Foreign keys: `relationships`. Status columns: `accepted_values`. Describe every model and key column in `schema.yml`.

## Check
`dbt build --select <models>+` passes; row counts reasonable vs source; spot-check a few rows by hand. Deliver models, YAML and the lineage (`dbt docs generate`).

Supporting files (0)

  • None — SKILL.md only