auditing-skills
Use when checking skills for security or quality issues, reviewing audit results from skills.sh or Tessl, or remediating findings…
Creates unit test YAML definitions that mock upstream model inputs and validate expected outputs. Use when adding unit tests for a dbt model or practicing test-driven development (TDD) in dbt.
Claude Code
$ npx -y skills add dbt-labs/dbt-agent-skills --skill adding-dbt-unit-test --agent claude-code
Codex
$ npx skills add dbt-labs/dbt-agent-skills --skill adding-dbt-unit-test -a codex -y
Cursor
$ npx skills add dbt-labs/dbt-agent-skills --skill adding-dbt-unit-test -a cursor -y
Gemini CLI
$ npx skills add dbt-labs/dbt-agent-skills --skill adding-dbt-unit-test -a gemini-cli -y
GitHub Copilot
$ npx skills add dbt-labs/dbt-agent-skills --skill adding-dbt-unit-test -a github-copilot -y
OpenCode
$ npx skills add dbt-labs/dbt-agent-skills --skill adding-dbt-unit-test -a opencode -y
Windsurf
$ npx skills add dbt-labs/dbt-agent-skills --skill adding-dbt-unit-test -a windsurf -y
name: adding-dbt-unit-test description: Creates unit test YAML definitions that mock upstream model inputs and validate expected outputs. Use when adding unit tests for a dbt model or practicing test-driven development (TDD) in dbt. user-invocable: false metadata: author: dbt-labs
dbt unit tests validate SQL modeling logic on static inputs before materializing in production. If any unit test for a model fails, dbt will not materialize that model.
You should unit test a model:
More examples:
Cases we don't recommend creating unit tests for:
dbt unit test uses a trio of the model, given inputs, and expected outputs (Model-Inputs-Outputs):
1. `model` - when building this model 2. `given` inputs - given a set of source, seeds, and models as preconditions 3. `expect` output - then expect this row content of the model as a postcondition
Self explanatory -- the title says it all!
**Tip:** Use `dbt show` to explore existing data from upstream models or sources. This helps you understand realistic input structures. However, always sanitize the sample data to remove any sensitive or PII information before using it in your unit test fixtures.
# Preview upstream model data dbt show --select upstream_model --limit 5
**Unit tests require direct parent models to exist in the warehouse.** Before running unit tests standalone (`dbt test`), verify that upstream models already exist first:
# Check if upstream models exist in the warehouse dbt list --select +my_model --exclude my_model --resource-type model # Then verify the tables/views actually exist in the warehouse via dbt show or your SQL client dbt show --select upstream_model --limit 1
If upstream models **do not exist**, or **exist but have been modified and not yet refreshed**, build them using `--empty` to create schema-only versions:
# Build upstream models cheaply (schema only, no data read) dbt run --select +my_model --exclude my_model --empty
> **Warning:** `--empty` overwrites existing models with schema-only (zero-row) versions. Only use it when models don't exist yet, or when schema changes need to be applied. Do not use it if upstream models contain data you want to preserve — it will wipe that data.
Skip this step if using `dbt build --select my_model` (recommended) — it handles the full pipeline including unit tests.
Suppose you have this model:
-- model
A curated collection of Agent Skills for working with dbt. These skills help AI agents understand and execute dbt workflows more effectively.
Use when checking skills for security or quality issues, reviewing audit results from skills.sh or Tessl, or remediating findings…
Generates a Mermaid flowchart diagram of dbt model lineage using MCP tools, manifest.json, or direct code parsing as fallbacks.…
Use when a user needs help triaging dbt-core to dbt v2 migration errors. Runs dbt-autofix first, then classifies remaining errors…
Use when migrating a dbt project from one data platform or data warehouse to another (e.g., Snowflake to Databricks, Databricks…
Use when a user wants to upgrade, update, or migrate a dbt project to the latest version — e.g. "upgrade my dbt project,"…
Writes and executes SQL queries against the data warehouse using dbt's Semantic Layer or ad-hoc SQL to answer business questions.…
Use this skill to extract structured Markdown/JSON from PDFs and document images—tables with cell-level precision, formulas as…
Estimates intracellular metabolic fluxes from steady-state carbon-13 isotope-tracing measurements using validated atom maps,…