---
name: "dbt-expectations-schema-unit-testing"
description: "Assert data quality, column statistical distributions, and regex patterns inside dbt models."
metadata:
  author: "Calogica"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "install dbt-expectations"
  - "test column regex dbt"
  - "write dbt unit test mock"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# dbt-expectations & Schema Unit Testing

Extends dbt tests using dbt-expectations: testing column values against regex patterns, verifying median and standard deviation ranges, checking row count matches across tables, and defining dbt 1.8 unit tests.

## When to Invoke
Invoke this skill whenever you need to:
- install dbt-expectations
- test column regex dbt
- write dbt unit test mock

## Execution SOP & Rules
1. Add calogica/dbt_expectations package to packages.yml and run dbt deps.
2. Add test to schema.yml: dbt_expectations.expect_column_values_to_match_regex with pattern regex.
3. Use expect_table_row_count_to_equal_other_table to verify zero loss across staging transformations.
4. Run dbt test --select test_name to validate assertions against database warehouse tables.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
