adding-dbt-unit-test

Scaffold dbt unit tests with inputs and expected outputs.

1|Updated Mar 25, 2025
One-click install
npx skills add https://github.com/ramtinJ95/dotfiles --skill adding-dbt-unit-test
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: adding-dbt-unit-test
Source: https://github.com/ramtinJ95/dotfiles/tree/main/arch-config/arch-dotfiles/agents/.agents/skills/adding-dbt-unit-test
Command: npx skills add https://github.com/ramtinJ95/dotfiles --skill adding-dbt-unit-test

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps dbt developers add robust unit tests to their models, enabling test-driven development and preventing regressions.

Core Features & Use Cases

  • Unit-test scaffolding: Create a clear template for testing a dbt model, including model, given inputs, and expected outputs.
  • Edge-case coverage: Guidance on testing complex SQL logic, incremental or ephemeral models, and dependencies.
  • Real-world workflow: When you modify a dbt model, use unit tests to ensure new logic passes before deployment.

Quick Start

To begin, navigate to the skill directory and follow the examples to scaffold a new dbt unit test for your 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 add dbt unit tests to my data models?

To add dbt unit tests, you can scaffold inputs and expected outputs directly within your model files. This approach creates a structured template that ensures compliance with dbt's unit testing framework.

What is the best way to unit test ephemeral models in dbt?

Unit testing ephemeral models in dbt involves scaffolding dependencies and defining expected outputs. The process supports standard dbt structures, allowing you to validate complex SQL logic without creating physical tables.

Can I use dict, csv, or sql fixtures for dbt unit tests?

Yes, dbt unit tests can utilize dict, csv, and sql fixtures to define inputs and expected outputs. This flexibility allows you to simulate various data scenarios and edge cases for your models.

Does dbt unit testing support incremental models?

Yes, dbt unit testing supports incremental models by documenting their dependencies and scaffolding appropriate inputs. This ensures your incremental logic is validated against expected outcomes before deployment.

How does test-driven development work with dbt models?

Test-driven development with dbt models involves scaffolding unit tests with predefined inputs and expected outputs before modifying logic. This prevents regressions by ensuring new code passes established test scenarios.