mcpbeat Sign in

Debugging Dbt Errors Agent Skill

| (1) Task mentions "fix", "error", "broken", "failing", "debug", "wrong", or "not working" (2) Compilation Error, Database Error, or test failures occur (3) Model produces incorrect output or unexpected results (4) Need to troubleshoot why a dbt command failed Reads full error, checks upstream first, runs dbt build (not just compile) to verify fix.

1k tokens
context cost
the whole folder, loaded on every use
1
files
instructions only
0
copies elsewhere
how many repositories repackaged it
115
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/AltimateAI/data-engineering-skills --skill debugging-dbt-errors

The instruction itself

18 sections, as written by the author

dbt Troubleshooting

Read the full error. Check upstream first. ALWAYS run dbt build after fixing.

Critical Rules

  • ALWAYS run dbt build after fixing - compile is NOT enough to verify the fix
  • If fix fails 3+ times, stop and reassess your entire approach
  • Verify data after build - build passing doesn't mean output is correct

Workflow

1. Get the Full Error

dbt compile --select <model_name>
# or
dbt build --select <model_name>

Read the COMPLETE error message. Note the file, line number, and specific error.

2. Inspect Actual Data (For Data Issues)

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.

3. Read Compiled SQL

cat target/compiled/<project>/<path>/<model_name>.sql

See the actual SQL that will run.

4. Analyze Error Type

| 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 |

5. Check Upstream Models

# 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.

6. Apply Fix

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 {% %} |

7. Rebuild (MANDATORY)

dbt build --select <model_name>

3-Failure Rule: If build fails 3+ times, STOP. Step back and:

  • Re-read the original error
  • Check if your entire approach is wrong
  • Consider alternative solutions

8. Verify Fix

# Preview the data
dbt show --select <model_name> --limit 10

# Run tests
dbt test --select <model_name>

9. Re-review Logic Against Requirements

After fixing, re-read the original request and verify:

  • Does the output match what the user asked for?
  • Are the column names exactly as requested?
  • Is the calculation logic correct per the requirements?
  • Did you solve the actual problem, not just make the error go away?

10. Check Downstream Impact

# Find downstream models
grep -r "ref('<model_name>')" models/ --include="*.sql"

# Rebuild downstream
dbt build --select <model_name>+

Error Categories

Compilation Errors

  • Check Jinja syntax: matching {{ }} and {% %}
  • Verify macro arguments
  • Check YAML indentation

Database Errors

  • Read compiled SQL in target/compiled/
  • Check column names against upstream
  • Verify data types

Test Failures

  • Read the test SQL to understand what it checks
  • Compare your model output to expected behavior
  • Check column names, data types, NULL handling

Anti-Patterns

  • Making random changes without understanding the error
  • Assuming the current model is wrong before checking upstream
  • Not reading the FULL error message
  • Declaring "fixed" without running build
  • Getting stuck making small tweaks instead of reassessing

Other skills for the same job

different authors, same section of the catalogue
Hypogenic Hypothesis Generation
by BioTender-max
×1

LLM-driven hypothesis generation/testing on tabular data. Three methods: HypoGeniC (data-driven), HypoRefine (literature+data), Union. Iterative refinement, Redis caching, multi-hypothesis inference. Manual: hypothesis-generation; ideation: scientific-brainstorming.

4k tokens
Sqlmap Database Pentesting
by ComeOnOliver
×1

This skill should be used when the user asks to \"automate SQL injection testing,\" \"enumerate database structure,\" \"extract database credentials using sqlmap,\" \"dump tables and columns...

6k tokens
Performance Optimization
by addyosmani

Optimizes application performance across frontend, backend, queries, and databases. Use when performance requirements exist, when you suspect performance regressions, when Core Web Vitals or load times need improvement, when N+1 query patterns need fixing, or when profiling reveals bottlenecks.

4k tokens
Bisect
by ClickHouse
vendor

Bisect a ClickHouse regression using pre-built master binaries from CI. Use when the user wants to find the commit that introduced a bug.

1k tokens
Validate Data
by anthropics
vendor

QA an analysis before sharing -- methodology, accuracy, and bias checks. Use when reviewing an analysis before a stakeholder presentation, spot-checking calculations and aggregation logic, verifying a SQL query's results look right, or assessing whether conclusions are actually supported by the data.

4k tokens
Errors API E2e
by triggerdotdev
vendor

End-to-end smoke test for the public Errors HTTP API (error groups). Seeds failed runs into ClickHouse so the error materialized views populate, then drives the real endpoints against the running webapp — list (with filters + pagination), retrieve, resolve/ignore/unresolve, the `filter[error]` runs filter, user attribution via the `trigger.dev mint-token` -> JWT exchange, and the 401/403/404 negatives. Use for "smoke test the errors API", "test the errors API e2e", "prove the errors endpoints work", or to re-verify after changes.

3k tokens
Strix•SQL 注入
by asdfgh1445

Strix SQL 注入测试手册,覆盖 union、blind、error-based 与 ORM 绕过技巧;触发名:strix-sql-injection

2k tokens
Analyzing Experiment Query Performance
by PostHog
vendor

> Pull and interpret production experiment query-performance data from the staff-only slowest experiment queries, precompute read/build health, and preaggregation cache footprint. and response field semantics (exception codes, exposure paths, precompute skip reasons, job states). Use when investigating slow or failing experiment queries, precompute regressions, 307/159/241 errors, preaggregation table growth, or when asked how experiment query performance or the precompute rollout is doing in production.

3k tokens

How to use it

Copy the folder

Take altimateai/debugging-dbt-errors from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.