← Explore all skills

DATA AND ANALYTICS / dbt Labs

Adding a dbt unit test

Writes a dbt unit test that mocks upstream inputs instead of querying production.

“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.”

01 / THE REASONING

Why this made the selection.

  • The description requires mocked upstream inputs and expected outputs.
  • A When not to use heading is present.

02 / THE REVIEW RECORD

What we actually inspected.

Source review has boundaries.
A clear record is more useful than a “safe” badge.

Material inspected

  • skills/dbt/skills/adding-dbt-unit-test/SKILL.md
  • README.md
  • LICENSE

Our findings

  • Headings include When not to use and Minimal unit test.
  • README documents npx skills add dbt-labs/dbt-agent-skills.
  • The definition explicitly warns about --empty data loss, permits subset-column fixtures and distinguishes static SQL logic tests from production data validation.
  • Unit tests must live in a YAML file under the model path, and an ephemeral parent input must use format sql.

Not established by this review

  • The skill was not executed inside a host agent.
  • Not executed: it was not installed or run.

The review applies to the material and revision named here. A newer upstream release can change its behavior.

03 / PUT IT TO WORK

Add a skill to your workflow.

Upstream setup instructions ↗

DOCUMENTED COMMAND

npx skills add dbt-labs/dbt-agent-skills/skills/dbt/skills/adding-dbt-unit-test --skill adding-dbt-unit-test

Run in your terminal to choose your AI tools, project or global scope, and installation method. This short command follows the current upstream version; the review covers the revision shown above.

Optional: install the reviewed revision

Keeps the original source and installer version where recorded, while leaving your AI tools and installation scope for you to choose.

npx skills@1.7.1 add https://github.com/dbt-labs/dbt-agent-skills/tree/168a2b0b92da59be88866257140907c206ff0e44/skills/dbt/skills/adding-dbt-unit-test --skill adding-dbt-unit-test
  1. Choose your AI tools and project or global installation scope in Skills CLI. The review applies to the source revision shown on this page.
  2. Retain all supporting files; separately configure companion skills, runtimes and service credentials named in the definition.
  3. Review the resulting diff and use an isolated target before any migration, deployment, load test or warehouse operation.

Before you start

  • A supported dbt/adapter version, the full reference directory and an isolated development warehouse schema with parent relations prepared.

04 / FOLLOW THE EVIDENCE

The source trail.

Our notes are separate from the original resource.
Check upstream before adopting a new version.

  1. Skill definition ↗Checked

    https://github.com/dbt-labs/dbt-agent-skills/blob/168a2b0b92da59be88866257140907c206ff0e44/skills/dbt/skills/adding-dbt-unit-test/SKILL.md

    Supports: Workflow and stated scope

  2. Repository licence ↗Checked

    https://github.com/dbt-labs/dbt-agent-skills/blob/168a2b0b92da59be88866257140907c206ff0e44/LICENSE

    Supports: Redistribution terms

  3. Install instructions ↗Checked

    https://github.com/dbt-labs/dbt-agent-skills/blob/168a2b0b92da59be88866257140907c206ff0e44/README.md

    Supports: Documented install path

  4. https://raw.githubusercontent.com/dbt-labs/dbt-agent-skills/168a2b0b92da59be88866257140907c206ff0e44/skills/dbt/skills/adding-dbt-unit-test/SKILL.md

    Supports: upstreamDescription, review.notTested, review.reviewedAt

Evidence & Ask