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 planning implementation steps, deciding commit format, or structuring development approach. Provides brainstorm-plan-implement flow with conventional commits. Triggers on 'how should I approach this', 'commit format'.
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
Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".
development
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.