agentsclimarketplace

Dbt

Skill bbrewington/software-data-and-ai-tools/skills/dbt

Use when building dbt models, adding tests, or designing data models. Covers dimensional modeling, model organization (staging/intermediate/marts), testing patterns, and warehouse-specific configurations.From its SKILL.md

Install
npx -y skills add bbrewington/software-data-and-ai-tools --skill dbt

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

3.8 KB, as published. Nobody here has run it

dbt

Patterns for dbt data transformation projects.

Skill Modules

This skill is organized into the following modules. Read the relevant module(s) based on the task:

ModuleFileUse When
Data Modelingreferences/data-modeling.mdDesigning dimensional models, defining grain, facts vs dimensions, SCDs
Model Layersreferences/model-layers.mdOrganizing staging/intermediate/marts, naming conventions, project structure
Package Testingreferences/testing-packages.mdIntegration tests for dbt package development

Quick Reference

Commands

dbt run                          # Run all models
dbt run --select +model_name     # Model + upstream
dbt run --select model_name+     # Model + downstream
dbt run --select tag:daily       # Models with tag
dbt test                         # Run all tests
dbt test --select "test_type:unit"      # Unit tests only
dbt test --select "test_type:data"      # Data tests only
dbt build                        # Run + test in DAG order
dbt build --select state:modified+      # Modified + downstream (CI)
dbt docs generate                # Generate documentation
dbt source freshness             # Check source freshness

Naming Conventions

LayerPatternExample
Stagingstg__<source>__<table>stg__stripe__customers
Intermediateint_<entity>__<transform>int_customers__enriched
Factfct_<event>fct_orders
Dimensiondim_<entity>dim_customers

Column Naming

TypeConventionExamples
IDs<entity>_idcustomer_id, order_id
Timestamps<event>_atcreated_at, updated_at, shipped_at
Dates<event>_dateorder_date, birth_date
Booleansis_<state> or has_<thing>is_active, has_subscription
Amounts<name>_<unit>amount_usd, quantity_units
Counts<thing>_countorder_count, item_count

Testing Pyramid

          Integration Tests  ← Package development only
              Unit Tests     ← Complex transformation logic
           Singular Tests    ← Business rules
           Generic Tests     ← Keys, constraints, patterns
         Source Freshness    ← Pipeline health
             Contracts       ← Schema enforcement

What to Test (Quick Guide)

AlwaysSometimesRarely
Primary keys (unique + not_null)Optional FKsEvery column not_null
Required foreign keysNumeric rangesColumns in contracts
Business-critical derived fieldsString patternsStaging columns
Status/enum columnsRow count boundsIntermediate models

Best Practices Summary

Things to do

  • DO Define grain for every model (what does one row represent?)
  • DO Use staging for renaming/casting only—no business logic
  • DO Test primary keys on every model (unique + not_null)
  • DO Use contracts for marts (enforce schema at build time)
  • DO Add tests when you find bugs (regression prevention)
  • DO Document models and columns in YAML
  • DO Use incremental models for large tables
  • DO Tag critical tests and run them more frequently

Don't

  • DON'T Skip the staging layer
  • DON'T Put business logic in staging models
  • DON'T Hardcode values (use {{ var() }} or {{ env_var() }})
  • DON'T Test every column (diminishing returns)
  • DON'T Ignore test warnings indefinitely
  • DON'T Forget source freshness checks
  • DON'T Create circular dependencies between models

Keep looking

Skills are one crate of 613,531. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.