adding-dbt-unit-test

Generate dbt unit test YAML definitions that mock inputs and assert outputs.

11|3|Updated Mar 9, 2026
One-click install
npx skills add https://github.com/kyle-chalmers/dbt-agentic-development --skill adding-dbt-unit-test-kyle-chalmers
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: adding-dbt-unit-test
Source: https://github.com/kyle-chalmers/dbt-agentic-development/tree/main/.agents/skills/adding-dbt-unit-test
Command: npx skills add https://github.com/kyle-chalmers/dbt-agentic-development --skill adding-dbt-unit-test-kyle-chalmers

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

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.

Core Features & Use Cases

  • Generates dbt unit_test YAML blocks including model, given, and expect sections
  • Supports multiple formats (dict, csv, sql) and fixture-based inputs/outputs
  • Handles advanced scenarios like versioning, overrides, and ephemeral dependencies

Quick Start

Create a new YAML unit test for a specified dbt model by defining inputs, expected outputs, and configuration under models/schema.yml

Frequently Asked Questions about adding-dbt-unit-test

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

FAQPage Schema
How do I write dbt unit tests for model development?

dbt unit tests are written as YAML definitions that mock upstream model inputs and assert expected outputs. You define the model name, given inputs, and expect sections within your schema.yml to validate logic during development.

What data formats can I use for dbt unit test fixtures?

dbt unit test fixtures support dict, csv, and sql formats for mocking input data. You can provide fixture-based data inline in the YAML or reference external files to cover complex input scenarios.

Does dbt unit testing work with model versions and ephemeral dependencies?

Yes, dbt unit testing handles advanced scenarios including model versioning, overrides, and ephemeral dependencies. The YAML schema supports versions and config keys to target specific model iterations correctly.

What is the standard YAML schema for a dbt unit test?

The standard dbt unit test YAML schema enforces keys such as model, given, expect, versions, overrides, and config. This structure ensures upstream inputs are mocked and expected outputs are validated consistently.

Can I practice test-driven development in dbt using YAML specs?

Yes, you can practice test-driven development in dbt by generating YAML unit test specs before building model logic. Define the given inputs and expected outputs first, then develop the model to pass the assertions.

When should I use dbt unit tests instead of other data quality tests?

Use dbt unit tests during model development to mock upstream inputs and validate complex transformation logic locally. They are ideal for TDD and edge-case validation, whereas generic data quality tests check existing table properties.