---
title: "Adding a dbt unit test: review, setup & limitations · Undominated.ai"
canonical: https://undominated.ai/skills/dbt-labs-adding-dbt-unit-test/
description: "Writes a dbt unit test that mocks upstream inputs instead of querying production."
---

# Adding a dbt unit test: review, setup & limitations · Undominated.ai

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

[← Explore all skills](/skills/)

DATA AND ANALYTICS / dbt Labs

# Adding a dbt unit test

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

 [See setup guidance ↓](#setup)[Original source ↗](https://github.com/dbt-labs/dbt-agent-skills/tree/168a2b0b92da59be88866257140907c206ff0e44/skills/dbt/skills/adding-dbt-unit-test)

SOURCE REVIEW

 Reviewed 2026-10-15
 Evidence 4 linked sources
 Publisher dbt Labs
 Licence [Apache-2.0 ↗](https://github.com/dbt-labs/dbt-agent-skills/blob/168a2b0b92da59be88866257140907c206ff0e44/LICENSE)
 Revision 168a2b0b92da
 [Read what was—and wasn’t—checked ↓](#review)

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

 [dbt Labs · upstream description ↗](https://github.com/dbt-labs/dbt-agent-skills/blob/168a2b0b92da59be88866257140907c206ff0e44/skills/dbt/skills/adding-dbt-unit-test/SKILL.md) Our analysis follows below.

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.

### A good fit for

 - Adding a unit test to a dbt model
- Refusing a test that hits a live warehouse by accident
- Design sanitized input/output fixtures for transformation logic and edge cases

### Weigh up before choosing

 - Warehouse-specific type rules live in the skill references and were not executed here.
- A unit test does not prove a production build.
- The suggested --empty upstream build overwrites selected existing models with zero-row schema-only relations; never run it against data that must be preserved.
- Versioned models may run a test across multiple versions; explicitly inspect version coverage.

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 ↗](https://github.com/dbt-labs/dbt-agent-skills/blob/168a2b0b92da59be88866257140907c206ff0e44/README.md)

DOCUMENTED COMMAND

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

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 Copy reviewed-revision command ↗ - Choose your AI tools and project or global installation scope in Skills CLI. The review applies to the source revision shown on this page.
- Retain all supporting files; separately configure companion skills, runtimes and service credentials named in the definition.
- 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.

### Compatibility

Agent Skills-compatible hosts · dbt

### Local Markdown instructions

 - Read the installed skill files
- Write fixture/YAML files and run warehouse-backed unit tests; optional upstream setup creates or replaces relations.

### Cost model

Source is free to read under the stated licence. A host agent may charge for use.

04 / FOLLOW THE EVIDENCE

## The source trail.

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

 - [Skill definition ↗](https://github.com/dbt-labs/dbt-agent-skills/blob/168a2b0b92da59be88866257140907c206ff0e44/skills/dbt/skills/adding-dbt-unit-test/SKILL.md) Checked 2026-10-14 https://github.com/dbt-labs/dbt-agent-skills/blob/168a2b0b92da59be88866257140907c206ff0e44/skills/dbt/skills/adding-dbt-unit-test/SKILL.md Supports: Workflow and stated scope
- [Repository licence ↗](https://github.com/dbt-labs/dbt-agent-skills/blob/168a2b0b92da59be88866257140907c206ff0e44/LICENSE) Checked 2026-10-07 https://github.com/dbt-labs/dbt-agent-skills/blob/168a2b0b92da59be88866257140907c206ff0e44/LICENSE Supports: Redistribution terms
- [Install instructions ↗](https://github.com/dbt-labs/dbt-agent-skills/blob/168a2b0b92da59be88866257140907c206ff0e44/README.md) Checked 2026-10-07 https://github.com/dbt-labs/dbt-agent-skills/blob/168a2b0b92da59be88866257140907c206ff0e44/README.md Supports: Documented install path
- [2026-10-15 C2-W05 source re-review at the existing pin ↗](https://raw.githubusercontent.com/dbt-labs/dbt-agent-skills/168a2b0b92da59be88866257140907c206ff0e44/skills/dbt/skills/adding-dbt-unit-test/SKILL.md) Checked 2026-10-15 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

KEEP COMPARING

## Other approaches to consider.

Related by category or shared topics. These are alternatives to inspect, not a measured quality order.

 [### Upgrading dbt ↗ Plans a dbt v1 migration to 1.12 using adapter-specific issue bundles and a recorded verification gate.](/skills/dbt-labs-upgrading-dbt/)[### Querying the dbt information schema ↗ Answers from the project metadata, with two routes, instead of guessing the DAG.](/skills/dbt-labs-querying-the-dbt-information-schema/)[### Working with dbt Mesh ↗ Judges a dbt change by who consumes it, and states that cross-project refs require dbt Cloud Enterprise.](/skills/dbt-labs-working-with-dbt-mesh/)

 [AI Tools ↗](/tools/)[Skills ↗](/skills/)[Agents ↗](/agents/)[MCP Servers ↗](/mcp-servers/)[Workflows ↗](/workflows/)

## Continue your investigation

 - [Choose a toolkit](/tools/)
- [Inspect execution hosts](/agents/)
- [Check tool access](/mcp-servers/)
- [Check project dependencies](/check-repo/)
