testing-dbt-models

Solid

Adds schema tests and data quality validation to dbt models. Use when working with dbt tests for: (1) Adding or modifying tests in schema.yml files (2) Task mentions "test", "validate", "data quality", "unique", "not_null", or "accepted_values" (3) Ensuring data integrity - primary keys, foreign keys, relationships (4) Debugging test failures or understanding why dbt test failed Matches existing project test patterns and YAML style before adding new tests.

Testing & QA 113 stars 8 forks Updated 1 weeks ago MIT

Install

View on GitHub

Quality Score: 85/100

Stars 20%
68
Recency 20%
90
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# dbt Testing **Every model deserves at least one test. Primary keys need unique + not_null.** ## Workflow ### 1. Study Existing Test Patterns **CRITICAL: Match the project's existing testing style before adding new tests.** ```bash # Find all schema.yml files with tests find . -name "schema.yml" -exec grep -l "tests:" {} \; # Read existing tests to learn patterns cat models/staging/schema.yml | head -100 cat models/marts/schema.yml | head -100 # Check for custom tests or dbt packages ls tests/ cat packages.yml 2>/dev/null ``` **Extract from existing tests:** - YAML formatting style (indentation, spacing) - Test coverage depth (all columns vs key columns only) - Use of custom tests (dbt_utils, dbt_expectations, custom macros) - Description style (brief vs detailed) - Severity levels used (warn vs error) ### 2. Read Model SQL ```bash cat models/<path>/<model_name>.sql ``` Identify: primary keys, foreign keys, categorical columns, date columns, business-critical fields. ### 3. Check Existing Tests for This Model ```bash cat models/<path>/schema.yml | grep -A 50 "<model_name>" # or find . -name "schema.yml" -exec grep -l "<model_name>" {} \; ``` ### 4. Identify Testable Columns | Column Type | Recommended Tests | |-------------|-------------------| | Primary key | `unique`, `not_null` | | Foreign key | `not_null`, `relationships` | | Categorical | `accepted_values` (ask user for valid values) | | Required field | `not_null` | | Date/timestamp | `not_null` | | Bool...

Details

Author
AltimateAI
Repository
AltimateAI/data-engineering-skills
Created
6 months ago
Last Updated
1 weeks ago
Language
N/A
License
MIT

Similar Skills

Semantically similar based on skill content — not just same category

Data & Documents Listed

data-quality

Write systematic data quality checks — validation rules, Great Expectations suites, dbt tests, anomaly detection, null/type/range/referential integrity assertions, and monitoring patterns for production pipelines. Use this skill whenever the user is dealing with bad data in a pipeline, setting up validation before or after a load step, adding tests to dbt models, writing Great Expectations expectations, or trying to detect when upstream data has changed shape. Also trigger when stakeholders keep finding incorrect numbers, when a pipeline silently loads garbage, or when the user asks "how do I make sure my data is correct". Prevention is cheaper than debugging.

1 Updated 1 weeks ago
Methasit-Pun
AI & Automation Solid

creating-dbt-models

Creates dbt models following project conventions. Use when working with dbt models for: (1) Creating new models (any layer - discovers project's naming conventions first) (2) Task mentions "create", "build", "add", "write", "new", or "implement" with model, table, or SQL (3) Modifying existing model logic, columns, joins, or transformations (4) Implementing a model from schema.yml specs or expected output requirements Discovers project conventions before writing. Runs dbt build (not just compile) to verify.

113 Updated 1 weeks ago
AltimateAI
Data & Documents Solid

documenting-dbt-models

Documents dbt models and columns in schema.yml. Use when working with dbt documentation for: (1) Adding model descriptions or column definitions to schema.yml (2) Task mentions "document", "describe", "description", "dbt docs", or "schema.yml" (3) Explaining business context, grain, meaning of data, or business rules (4) Preparing dbt docs generate or improving model discoverability Matches existing project documentation style and conventions before writing.

113 Updated 1 weeks ago
AltimateAI