Audit a dbt project for what an AI agent will get wrong if you point it at the data today: wrong metric, wrong table, missed rows, broken joins. Produces one evidence-backed report with blockers, verification queries, and a safe starting perimeter.
90%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Full-depth inventory for priority models (those with 3+ inbound refs). This is the high-value analysis: grain detection, doc() resolution, full SQL column extraction, phantom column detection.
You only process the priority models you are given. Do not scan the full project.
You receive:
project_path: absolute path to the dbt project rootmodel_paths: directories containing models (from dbt_project.yml)priority_models: list of model names to process (these have 3+ inbound refs)global_configs: severity settings, vars, etc.Your entire response must be a single raw JSON object. Start with { and end with }. No text before the opening brace. No text after the closing brace. No markdown code fences.
Return EXACTLY this JSON structure:
{
"layer_scope": "priority-deep",
"models": [
{
"name": "model_name",
"sql_path": "/absolute/path/to/model.sql",
"yaml_path": "/absolute/path/to/schema.yml or null",
"layer": "staging|intermediate|core|reference|other",
"has_description": true,
"description_quality": "good|placeholder|restates_name|empty|none",
"description_text": "first 200 chars of description or null",
"grain_declared": false,
"grain_statement": "string or null",
"column_count_yaml": 0,
"column_count_sql": 0,
"columns_with_descriptions": 0,
"has_pk_test": true,
"pk_column": "column_name or null",
"inbound_refs": -1,
"outbound_refs": ["model_a", "model_b"],
"has_semantic_model": false,
"materialization": "view|table|incremental|ephemeral|unknown"
}
],
"columns": [
{
"model": "model_name",
"column": "column_name",
"has_description": true,
"description_text": "first 200 chars or null",
"tests": ["unique", "not_null", "relationships:other_model.col", "accepted_values:a,b,c"]
}
],
"sources": [
{
"source_name": "string",
"table_name": "string",
"has_description": true,
"has_freshness": false,
"yaml_path": "/absolute/path"
}
],
"semantic_layer": {
"semantic_models": [
{
"name": "string",
"model_ref": "model_name",
"has_description": true,
"entities": [
{"name": "string", "type": "primary|foreign|unique|natural", "expr": "string or null"}
],
"measures": [
{"name": "string", "agg": "sum|count|avg|min|max|count_distinct|etc", "expr": "string or null", "has_description": true, "description_text": "first 200 chars or null"}
],
"dimensions": [
{"name": "string", "type": "categorical|time|etc", "expr": "string or null"}
]
}
],
"metrics": [
{"name": "string", "type": "simple|derived|ratio|cumulative", "measure_refs": ["measure_name"], "has_description": true, "has_filter": false}
],
"saved_queries": [
{"name": "string", "metric_refs": ["metric_name"]}
]
},
"issues": {
"phantom_columns": [{"model": "string", "column": "string", "yaml_path": "string", "reason": "in YAML but not in SQL output"}],
"duplicate_yaml_columns": [{"model": "string", "column": "string", "descriptions_differ": true}],
"copy_paste_descriptions": [{"model": "string", "items": ["col_a", "col_b"], "shared_description": "string", "why_wrong": "string"}],
"source_via_ref": [{"model": "string", "target": "string", "reason": "uses ref() to reach raw source instead of source()"}]
},
"seeds": [
{"name": "string", "path": "string", "appears_to_define": "string"}
],
"exposures": [
{"name": "string", "depends_on": ["model_a", "model_b"]}
]
}Note: inbound_refs is set to -1 (unknown). The orchestrator computes this after merging with the scan inventory.
Work through these steps sequentially. Read every file for every priority model. Report exact counts.
First, use Glob to find all **/*.yml and **/*.yaml under model paths (exclude dbt_packages/, target/). Also search for YAML files at the project root that may define semantic models, metrics, or exposures.
Glob fallback: If Glob returns 0 results for a pattern under a model directory, retry with Bash: find {dir} -name '*.yml' -not -path '*/dbt_packages/*' -not -path '*/target/*'. Use the Bash output.
Read each YAML file. For each model that matches a name in priority_models, extract:
models: entries → name, description, columns (name, description, tests)semantic_models: entries → name, model ref, entities, measures, dimensionsmetrics: entries → name, type, measure refs, description, filterssaved_queries: entries → name, metric refssources: entries → name, tables, freshness config (if any source definitions live alongside priority models)exposures: entries → name, depends_onHandle {{ doc() }} references: When a description uses {{ doc("block_name") }}, find the referenced doc block. Search for files named docs.md, docs/*.md, or files containing {% docs block_name %}. Read the doc block content. Use the doc block content as the actual description for quality assessment. Do NOT flag doc() references as missing descriptions.
Description quality classification:
good: provides meaningful context (>10 chars, not just the column name restated)placeholder: contains "doc pour", "TODO", "TBD", or similar placeholder textrestates_name: description is essentially the column name with spaces (e.g., order_id → "Order ID")empty: description key exists but value is empty or whitespacenone: no description key at allGrain detection: Check model descriptions for grain statements: "one row per", "one record per", "one entry per", "grain:", "each record represents", "unique on". If found, set grain_declared: true and record the statement.
For each priority model's SQL file:
ref() calls → outbound_refssource() calls → note which models use sourcescolumn_count_sql to the count. This is critical for phantom column detection.
SELECT * FROM cte, trace back through CTEs to find actual columnscolumn_count_sql must be >0 for every model that has a readable SQL file. If you cannot determine the count, set it to -1 (not 0) so downstream phases know parsing failed vs was skipped.Self-check: After processing all SQL files, count how many priority models have column_count_sql = 0. If more than 20% have 0, something went wrong. Re-read the top 5 models (by name from the priority list) and retry SQL column extraction for those.
Check for ref() vs source() misuse: If a model uses ref() to reach what appears to be a raw/source table (table name matches a source definition), flag it.
For each priority model:
column_count_sql > 0. When column_count_sql = -1 (macro-heavy, parsing failed), skip phantom detection for that model and note: "Phantom column detection skipped: SQL column extraction failed (macro-heavy model)." Never report phantom columns for a model where you couldn't parse the SQL.Copy-paste detection: For each model, check if multiple columns share identical descriptions when they shouldn't (different expr or different column names implying different concepts). Also check across measures in semantic models.
Use Glob to find seeds/**/*.csv and any YAML files defining exposures. Catalog seeds and exposures.
Build the JSON. Double-check:
columns exists in modelssemantic_layer semantic models exists in modelscolumn_count_sql is not 0 for any model (must be >0 or -1)Return the JSON.
.claude-plugin
.cursor-plugin
.tessl-plugin
examples
phases
scripts
test-fixtures
docs-context
fan-out-joins
manifest-forloop
target
messy-jaffle-shop
sql-edge-cases