From altimateai-data-engineering-skills
Debugs dbt errors systematically by reading full errors, checking upstream models, and running dbt build to verify fixes. Handles compilation, database, and dependency errors.
How this skill is triggered — by the user, by Claude, or both
Slash command
/altimateai-data-engineering-skills:debugging-dbt-errorsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
**Read the full error. Check upstream first. ALWAYS run `dbt build` after fixing.**
Read the full error. Check upstream first. ALWAYS run dbt build after fixing.
dbt build after fixing - compile is NOT enough to verify the fixdbt compile --select <model_name>
# or
dbt build --select <model_name>
Read the COMPLETE error message. Note the file, line number, and specific error.
Before fixing "wrong output" or "incorrect results", query the actual data:
# Preview current output
dbt show --select <model_name> --limit 20
# Check specific values with inline query
dbt show --inline "select * from {{ ref('model_name') }} where <condition>" --limit 10
# Compare with expected - look for patterns
dbt show --inline "select column, count(*) from {{ ref('model_name') }} group by 1 order by 2 desc" --limit 10
Understand what's wrong before attempting to fix it.
cat target/compiled/<project>/<path>/<model_name>.sql
See the actual SQL that will run.
| Error Type | Look For |
|---|---|
| Compilation Error | Jinja syntax, missing refs, YAML issues |
| Database Error | Column not found, type mismatch, SQL syntax |
| Dependency Error | Missing model, circular reference |
# Find what this model references
grep -E "ref\(|source\(" models/<path>/<model_name>.sql
# Read upstream model to verify columns
cat models/<path>/<upstream_model>.sql
Many errors come from upstream changes, not the current model.
Common fixes:
| Error | Fix |
|---|---|
| Column not found | Check upstream model's output columns |
| Ambiguous column | Add table alias: table.column |
| Type mismatch | Add explicit CAST() |
| Division by zero | Use NULLIF(divisor, 0) |
| Jinja error | Check matching {{ }} and {% %} |
dbt build --select <model_name>
3-Failure Rule: If build fails 3+ times, STOP. Step back and:
# Preview the data
dbt show --select <model_name> --limit 10
# Run tests
dbt test --select <model_name>
After fixing, re-read the original request and verify:
# Find downstream models
grep -r "ref('<model_name>')" models/ --include="*.sql"
# Rebuild downstream
dbt build --select <model_name>+
{{ }} and {% %}target/compiled/npx claudepluginhub altimateai/data-engineering-skillsCreates dbt models following project conventions, discovers naming patterns, runs dbt build to verify, and checks output correctness.
Builds and modifies dbt models with SQL transformations using ref() and source(), creates tests, validates results with dbt show. For dbt projects: modeling, debugging errors, data exploration, testing, change evaluation.
Provides patterns for building dbt models, adding tests, and designing data models including dimensional modeling, staging/intermediate/marts organization, naming conventions, and testing strategies.