adding-dbt-unit-test

Create dbt unit tests with mock inputs and expected outputs.

Updated Jul 3, 2025
One-click install
npx skills add https://github.com/memadore/snowflake-dbt-demo --skill adding-dbt-unit-test-memadore
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: adding-dbt-unit-test
Source: https://github.com/memadore/snowflake-dbt-demo/tree/main/.agents/skills/adding-dbt-unit-test
Command: npx skills add https://github.com/memadore/snowflake-dbt-demo --skill adding-dbt-unit-test-memadore

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you write effective unit tests for your dbt models, ensuring data quality and enabling test-driven development.

Core Features & Use Cases

  • Model Validation: Define expected inputs and outputs to verify dbt SQL logic.
  • Regression Prevention: Catch bugs early by testing complex transformations and edge cases.
  • Use Case: When refactoring a complex dbt model, use this Skill to write unit tests that confirm the new logic produces the same results as the old logic for known scenarios.

Quick Start

Use the adding-dbt-unit-test skill to write a unit test for the 'my_model' dbt model.

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 SQL models?

You write dbt unit tests by defining mock inputs and expected outputs to verify SQL model logic and ensure data integrity. This Skill supports dict, csv, and sql data formats for specifying test data.

When do I need unit tests for dbt data modeling?

You need dbt unit tests when refactoring complex transformations or practicing test-driven development. They prevent regressions by catching bugs early and verifying new logic produces identical results for known scenarios.

Can I test incremental and ephemeral dbt models?

Yes, you can test incremental and ephemeral dbt models. This Skill handles these special cases, allowing you to define mock inputs and validate their SQL transformations alongside standard dbt models.

What data formats can I use for dbt unit test mock inputs?

You can use dict, csv, and sql data formats to define mock inputs for dbt unit tests. This flexibility allows you to specify expected input data and outputs to validate your SQL model logic.

What's the best way to prevent regression when refactoring dbt models?

The best way to prevent regression when refactoring dbt models is writing unit tests that compare expected outputs against mock inputs. This validates complex transformations and confirms new logic matches old results for known scenarios.