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
Analyze join paths, detect missing relationships, unused joins, and entry point ambiguity.
You receive:
deep_pass_scope: list of model names to assessinventory_json: the canonical inventory (use models, relationships, columns)Your entire response must be a single raw JSON object. No markdown code fences, no commentary before or after.
Return EXACTLY this JSON structure:
{
"entry_points": [
{
"model": "model_name",
"classification": "entry_point|building_block|ambiguous",
"signals": ["in marts/ directory", "zero inbound refs", "has exposure"]
}
],
"model_overlap": [
{
"models": ["orders", "orders_kpis"],
"overlapping_question": "what is our total revenue?",
"disambiguated": false,
"explanation": "both contain revenue columns at different grains, descriptions don't clarify which to use"
}
],
"unused_joins": [
{
"model": "model_name",
"joined_model": "joined_model_name",
"sql_path": "/path/to/model.sql",
"explanation": "table is joined but no columns from it appear in SELECT, WHERE, or GROUP BY"
}
],
"missing_pk_tests": [
{
"model": "model_name",
"inbound_refs": 5,
"likely_pk": "column_name",
"has_unique": false,
"has_not_null": false
}
],
"undeclared_relationships": [
{
"from_model": "string",
"from_column": "string",
"to_model": "string",
"to_column": "string",
"evidence": "ref() dependency exists but no relationship test or entity FK"
}
]
}For each model in scope, classify as:
Entry point (agent should query directly):
marts/, reference/, reporting/, presentation/, core/ directorydim_ or fact_ (canonical query targets in most dbt projects)Building block (agent should not query directly):
staging/, intermediate/, prep/, utils/stg_, int_, prep_, base_Ambiguous (no clear signal):
dim_/fact_ prefixes or in recognized layer directories should classify as entry point or building block, not ambiguousIf >30% of models in scope are genuinely ambiguous (after applying prefix heuristics), flag: "An agent has no way to distinguish queryable models from internal building blocks."
Find groups of models that could answer the same business question. Check if their descriptions disambiguate them. Only flag overlaps where descriptions don't make the distinction clear.
For each model in scope, read the SQL. Identify all JOIN clauses. For each joined table:
For each model with inbound_refs > 0 (from inventory), check if it has a column with both unique and not_null tests. If not, flag it: silent fan-out risk for every model that joins to it.
From the inventory's relationships.implicit list, highlight the highest-risk ones: FK columns between core/reference models with no declared relationship.
Per-ref() mapping: For each model in scope, read its SQL and list every ref() call. For each ref() target, check whether a relationships test exists for that specific join. Include each unmapped ref()-to-relationship pair in the undeclared_relationships array. Do not just report "zero relationship tests" globally; the synthesis step needs per-model, per-ref() data.
FK target resolution: When identifying implicit FK targets for an _id column, prefer the model referenced via ref() in the SQL over name-based guessing. Example: if int_order_payments.sql contains ref('stg_payments'), then int_order_payments.order_id likely joins to stg_payments, not to stg_orders, even though stg_orders also has an order_id column.
Compute from inventory outbound_refs: for each model in scope, count the longest chain of refs back to a source or model with zero outbound refs. This is a pure computation over the inventory data (no file reads needed).
Flag models that are >6 refs deep from any source. An agent tracing data lineage through 7+ files loses context rapidly.
Add to the output JSON:
"lineage_depth": [
{
"model": "model_name",
"max_depth": 8,
"deepest_path": ["source_a", "stg_x", "int_y", "int_z", "dim_w", "fact_v", "ref_u", "model_name"]
}
]Only include models with depth > 6. If none exceed 6, return an empty array.
.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