dbt-testing

Define dbt model unit tests in YAML with given and expect blocks.

475|25|Updated Mar 31, 2026
One-click install
npx skills add https://github.com/SignalPilot-Labs/SignalPilot --skill dbt-testing-signalpilot-labs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dbt-testing
Source: https://github.com/SignalPilot-Labs/SignalPilot/tree/main/benchmark/signalpilot-plugin/skills/dbt-testing
Command: npx skills add https://github.com/SignalPilot-Labs/SignalPilot --skill dbt-testing-signalpilot-labs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Unit testing dbt models can be tricky without a standard structure; this skill provides a clear approach to writing unit tests using the unit_tests YAML format, including given/expect blocks, edge-case coverage, and guidance on distinguishing unit tests from schema tests.

Core Features & Use Cases

  • Introduces a top-level unit_tests key (not inside models:) and shows how to place the YAML file next to the model.
  • Explains how to test transformation logic with input refs and expected output, covering common edge cases and failure modes.
  • Provides a safe, non-invasive workflow that validates logic without rewriting model SQL.

Quick Start

Create a unit_tests YAML next to the model and define given/expect blocks to validate your dbt transformation outputs.

Frequently Asked Questions about dbt-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write unit tests for dbt models using YAML?

To write unit tests for dbt models, create a YAML file next to your model using a top-level unit_tests key with given and expect blocks to validate transformation logic and verify expected outputs.

What is the difference between dbt unit tests and schema tests?

dbt unit tests validate transformation logic and edge-case handling using input refs and expected outputs, whereas schema tests validate data properties and constraints without checking the model's internal processing logic.

How do I test edge cases in dbt transformations?

You test edge cases in dbt transformations by defining specific input conditions and failure modes within the given block of your unit_tests YAML and asserting the expected output in the expect block.

Where should the unit_tests YAML file be placed in a dbt project?

The unit_tests YAML file should be placed next to the dbt model it validates, using a top-level unit_tests key rather than nesting the configuration inside the models directory block.

Can I validate dbt model logic without rewriting the SQL?

Yes, you can validate dbt model logic without rewriting SQL by using a non-invasive unit_tests YAML workflow that mocks inputs in the given block and checks results in the expect block.

How do I verify multiple inputs in a dbt unit test?

You verify multiple inputs in a dbt unit test by defining multiple input refs within the given block of the unit_tests YAML structure and asserting their combined transformation output in the expect block.