adding-dbt-unit-test

adding-dbt-unit-test is a skill for Claude Code from dbt-labs/dbt-agent-skills. It costs 44 tokens per session (4,210 once invoked), scanned A, original, Apache-2.0.

A workflow for creating dbt unit tests that provide fixed upstream inputs and check the expected output of a SQL model. Unit tests check one piece of logic in isolation; TDD means writing those checks as part of development.

In plain words
What is it for?
Use it to add YAML unit-test definitions for models, including incremental models, ephemeral dependencies, versioned models, and warehouse-specific data types.
Why use it?
It catches modelling mistakes before the SQL model is built with production data and makes edge cases explicit.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter.

Part of the dbt plugin — 11 skills shipped together

Good fit Use it to add YAML unit-test definitions for models, including incremental models, ephemeral dependencies, versioned models, and warehouse-specific data types.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/dbt-labs/dbt-agent-skills/adding-dbt-unit-test
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add dbt-labs/dbt-agent-skills --skill adding-dbt-unit-test
Clone the repo
git clone --depth 1 https://github.com/dbt-labs/dbt-agent-skills

Made for: Claude Code.

Or install dbt, the plugin that ships this one along with the rest of its 11 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for adding-dbt-unit-test

README.md
[![agentmods](https://agentmods.dev/badge/skills/dbt-labs/dbt-agent-skills/adding-dbt-unit-test/github.svg)](https://agentmods.dev/skills/dbt-labs/dbt-agent-skills/adding-dbt-unit-test)
Your own site
<a href="https://agentmods.dev/skills/dbt-labs/dbt-agent-skills/adding-dbt-unit-test"><img src="https://agentmods.dev/badge/skills/dbt-labs/dbt-agent-skills/adding-dbt-unit-test/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for adding-dbt-unit-test

Your own site · 80×15
<a href="https://agentmods.dev/skills/dbt-labs/dbt-agent-skills/adding-dbt-unit-test"><img src="https://agentmods.dev/badge/skills/dbt-labs/dbt-agent-skills/adding-dbt-unit-test.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 44 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,210 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • Socket pass 23 Apr 2026
  • Snyk pass 23 Apr 2026
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00044 $0.04210
Opus 5 $0.00022 $0.02105
Sonnet 5 $0.00009 $0.00842
Haiku 4.5 $0.00004 $0.00421

Measured 9d ago against content hash b185a1ead747, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

adding-dbt-unit-test scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

skills/dbt/skills/adding-dbt-unit-test/SKILL.md · 402 lines

How it starts

The opening of the file, as written. The whole thing — 402 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Add unit test for a dbt model

Additional Resources

What are unit tests in dbt

dbt unit tests validate SQL modeling logic on static inputs before materializing in production. If any unit test for a model fails, dbt will not materialize that model.

When to use

You should unit test a model:

  • Adding Model-Input-Output scenarios for the intended functionality of the model as well as edge cases to prevent regressions if the model logic is changed at a later date.
  • Verifying that a bug fix solves a bug report for an existing dbt model.

More examples:

  • When your SQL contains complex logic:
    • Regex
    • Date math
    • Window functions
    • case when statements when there are many whens
    • Truncation
    • Complex joins (multiple joins, self-joins, or joins with non-trivial conditions)
  • When you're writing custom logic to process input data, similar to creating a function.
  • Logic for which you had bugs reported before.
  • Edge cases not yet seen in your actual data that you want to be confident you are handling properly.
  • Prior to refactoring the transformation logic (especially if the refactor is significant).
  • Models with high "criticality" (public, contracted models or models directly upstream of an exposure).

Read the full file on GitHub · 402 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 402 lines · 44 tokens per session scan A b185a1ead747

Subscribe to this mod's changes

adding-dbt-unit-test is a skill published in the GitHub repository dbt-labs/dbt-agent-skills (707 stars, last pushed 3d ago), licensed Apache-2.0. It adds 44 tokens to every session and 4,210 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.