Documentation debt is the most universal failure in analytics engineering: hundreds of dbt models, thousands of columns, and a description: field that is blank on 80% of them. AI is unusually good at this task because the raw material — model SQL, column names, upstream descriptions, sample values — already exists as metadata.
Tier: Foundation · Workflow area: Docs, lineage & governance
This playbook turns an undocumented dbt project into one with reviewable draft descriptions for every model and column, plus a CI check that keeps coverage from decaying again.
flg_x_2 means.Skip AI drafting for the 10–20 truly business-critical columns (revenue definitions, regulatory fields) — write those by hand first, because they become the examples the AI mimics.
Measure the gap first. Generate a coverage report so you know the before/after. In a dbt project:
dbt docs generate
python -c "
import json
cat = json.load(open('target/manifest.json'))
models = [n for n in cat['nodes'].values() if n['resource_type']=='model']
undoc = [m['name'] for m in models if not m.get('description')]
print(f'{len(undoc)}/{len(models)} models undocumented')
"
Give the assistant real metadata, not just names. Column names alone produce generic filler. Feed it the model SQL, upstream model descriptions, and (where policy allows) a few sample values per column. With dbt Copilot this context is automatic; with a repo-scale assistant like Claude Code or Cursor, point it at the project. Prompt:
Draft dbt YAML documentation for the model models/marts/fct_orders.sql.
Context you must use:
- The model SQL (read it — derive column meaning from the transformations, not the names).
- Upstream descriptions in models/staging/stg_orders.yml — inherit and refine, do not contradict.
- Our house style: one sentence per column, start with a noun phrase, name the grain
in the model description, spell out abbreviations on first use.
Rules:
- If a column's meaning cannot be inferred from the SQL, write "TODO: confirm with owner"
instead of guessing.
- Do not invent business rules (thresholds, SLA definitions, currency assumptions).
- Output only the schema.yml block, no commentary.
Expected output: a models: YAML block with a grain-stating model description and one line per column, with explicit TODOs where inference failed. The TODO rule is the important part — it converts hallucination risk into a visible worklist.
Batch across the project, one layer at a time. Document staging models first, then marts, so downstream drafts can inherit upstream descriptions. In an agentic tool: "Repeat this for every model under models/staging/ missing a description; commit one file per model."
Run the human meaning-pass. AI can describe what the SQL does; only a human knows what the business means by it. Review every draft in a PR, and route domain-specific models to their owners. Budget roughly one minute per model — you are editing, not authoring, which is where the 10x comes from.
Enforce coverage in CI. Add a check so the debt cannot silently return:
# e.g. dbt-checkpoint / dbt_meta_testing style hook
check-model-has-description --manifest target/manifest.json --fail-under 0.95
Expected outcome: PRs adding undocumented models fail until a description is added — which is now cheap, because the assistant drafts it in the same PR.
The AI's job is coverage, the human's job is meaning. Ship the two-step (draft everything, review for business truth) rather than letting either side do the whole job.
grep -nE '[0-9]+ (days|hours|%)' models/**/*.yml).For services-company delivery teams working in a client's project: check the client's AI policy before pointing any assistant at their repo. If public tools are prohibited, run the same workflow with an approved or self-hosted model, and never include sample data rows in prompts — metadata (model SQL and column names) is usually acceptable where data values are not, but confirm in writing. Strip client names and internal system identifiers from any prompt sent to an external API, and keep the generated YAML in the client's repo rather than your own notes. The CI coverage gate is client-friendly evidence of value: "documentation coverage went from 20% to 96%" is a reportable deliverable.