skills/dbt-skill/SKILL.md
Use when working with dbt (data build tool) - creating models, writing tests, CI/CD pipelines, materializations, sources, staging/intermediate/marts layers, Snowflake/BigQuery warehouse configuration, incremental strategies, Jinja macros, data quality, semantic layer, or making analytics engineering decisions
npx skillsauth add dtsong/my-claude-setup dbt-skillInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Comprehensive dbt guidance: project structure, modeling, testing, CI/CD, production patterns. Targets Snowflake and BigQuery. Beginner-friendly with progressive scaling.
Activate when: creating/modifying dbt models, choosing materializations, structuring layers, setting up tests, implementing CI/CD, configuring sources/freshness, writing Jinja macros, reviewing dbt projects, making analytics engineering decisions.
Skip when: basic SQL syntax, warehouse admin, raw pipeline config (Fivetran/Airbyte), BI tool config.
dbt run twice produces identical resultsdbt_project/
├── dbt_project.yml
├── packages.yml
├── profiles.yml # local only, not committed
├── models/
│ ├── staging/ # 1:1 with source tables
│ │ └── <source>/
│ │ ├── _<source>__models.yml
│ │ ├── _<source>__sources.yml
│ │ └── stg_<source>__<entity>.sql
│ ├── intermediate/ # business logic, joins, pivots
│ │ └── <domain>/
│ └── marts/ # business-facing tables
│ └── <domain>/
│ ├── _<domain>__models.yml
│ ├── fct_<entity>.sql
│ └── dim_<entity>.sql
├── macros/
├── tests/
│ └── generic/
├── seeds/
├── snapshots/
└── analyses/
| Layer | Materialization | Purpose | Naming | Tests |
|-------|----------------|---------|--------|-------|
| Staging | view | Clean/rename raw data, 1:1 with source | stg_<source>__<entity> | not_null, unique on PK |
| Intermediate | ephemeral | Business logic, joins, pivots | int_<entity>_<verb>ed | Tested via downstream |
| Marts | table/incremental | Business-facing facts and dimensions | fct_<entity>, dim_<entity> | Full coverage |
| Situation | Materialization | Why |
|-----------|----------------|-----|
| Staging models | view | Always fresh, minimal storage |
| Intermediate logic | ephemeral | Zero cost, inlined as CTE |
| Marts < 100M rows | table | Simple, fast reads |
| Marts > 100M rows | incremental | Process only new/changed data |
| SCD Type 2 | snapshot | Track historical changes |
source() only in staging -- staging is the sole gateway to raw dataref() everywhere elseselect *), final CTE named finalDefine sources in _<source>__sources.yml with loaded_at_field and freshness thresholds. Configure warn_after and error_after per table.
| Concept | Snowflake | BigQuery | |---------|-----------|----------| | Top-level container | Database | Project | | Schema grouping | Schema | Dataset |
| Config | Snowflake | BigQuery |
|--------|-----------|----------|
| Profile type | snowflake | bigquery |
| Auth | User/password or key-pair | OAuth or service account |
| Schema gen | database.schema.model | project.dataset.model |
| Incremental default | merge | merge |
| Partitioning | Automatic micro-partitions | partition_by required for large tables |
| Clustering | cluster_by (automatic) | cluster_by (manual) |
| Cost model | Credits (compute time) | Bytes scanned / Slots |
| Command | Purpose |
|---------|---------|
| dbt build | Run + test in DAG order (recommended) |
| dbt build --select +model | Build model and all ancestors |
| dbt build --select model+ | Build model and all descendants |
| dbt build --select tag:finance | All models tagged finance |
| dbt build --select state:modified+ | Modified + descendants (Slim CI) |
| dbt source freshness | Check source freshness |
| dbt deps | Install packages |
| dbt docs generate && dbt docs serve | Documentation site |
ref() only in staging-and-above, source() only in staging — using source() in marts bypasses the staging contract and breaks lineageunique_key silently duplicate rows on re-runs — always set unique_key for merge strategyephemeral models can't be tested directly or selected with dbt test --select — test via downstream consumersdbt run doesn't run tests — always use dbt build to get run + test in DAG order--full-refresh on a large incremental model can blow warehouse credits — scope with --select first{%- -%} vs {% %} — trailing whitespace breaks compile output silentlypackages.yml version ranges (>=1.0,<2.0) can pull breaking changes — pin exact versions in production-- WRONG: source() in marts (skips staging layer)
SELECT * FROM {{ source('stripe', 'payments') }}
-- RIGHT: ref staging model
SELECT * FROM {{ ref('stg_stripe__payments') }}
-- WRONG: incremental without unique_key (duplicates on re-run)
{{ config(materialized='incremental') }}
-- RIGHT: always specify unique_key
{{ config(materialized='incremental', unique_key='payment_id') }}
Load on demand when detailed guidance is needed:
| Reference | Topics | |-----------|--------| | Testing & Quality | Schema/generic/singular/unit tests, dbt-expectations, layer strategy | | CI/CD & Deployment | Slim CI, GitHub Actions, dbt Cloud, environments, blue/green, SQLFluff | | Jinja, Macros & Packages | Jinja fundamentals, custom macros, packages, debugging | | Incremental & Performance | Microbatch, merge, delete+insert, insert_overwrite, warehouse tuning | | Data Quality & Observability | Source freshness, Elementary, anomaly detection, alerting, incidents | | Semantic Layer & Governance | MetricFlow, contracts, versions, access controls, dbt Mesh |
Apache License 2.0. See LICENSE file for full terms.
Copyright 2026 Daniel Song
development
Use when the council needs to surface organizational knowledge buried across multiple internal sources (wikis, design docs, ADRs, past tickets, postmortems, chat archives, code repos). Plans where to look, what to cross-reference, and how to synthesize findings into evidence the council can act on. Do not use for external market research (use competitive-analysis), library evaluation (use library-evaluation), or technology trend assessment (use technology-radar).
testing
Use to convert a Word .docx file to PDF and/or verify its page count. Triggers on: converting docx to pdf, rendering a document, checking how many pages a docx produces, or asserting a page-count constraint (e.g. a resume must stay 2 pages). Wraps LibreOffice headless conversion.
development
Security audit checklist for web applications. Use when reviewing, auditing, or hardening a web app's security posture. Covers rate limiting, auth headers, IP blocking, CORS, security middleware, input validation, file upload limits, ORM usage, and password hashing. Triggers on requests like "review security", "harden this app", "security audit", "check for vulnerabilities", or when building/reviewing API endpoints.
development
Interactive wizard to craft effective prompts using Claude Code best practices