FormingSkillclaude-codepublished fresh until

How do I stop my agent writing sloppy dbt models?

Summary Data engineers who get good dbt code from Claude Code do three things: give the agent business rules, naming standards and a data dictionary to read, point it at one pristine model as a template, and replace reading every diff with deterministic checks (unit tests, lint hooks, CI). dbt Labs' Apache-2.0 skills package the dbt-specific part.

Not for writing dbt unit tests itself (dbt-unit-tests-for-model-logic-given-expect-yaml).

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

The options

Same job, different trade-offs. Pick one in Try it.

Option
ASkill · v1.6.0dbt unit test skill (dbt Labs)
BSkill · v1.6.0dbt analytics engineering skill (dbt Labs)
How you use itYou ask for itYou ask for it
What it can dowrites fileswrites files
What's inside
ASkill · v1.6.0dbt unit test skill (dbt Labs)
How you use it
You ask for it
What it can do
writes files
What's inside
BSkill · v1.6.0dbt analytics engineering skill (dbt Labs)
How you use it
You ask for it
What it can do
writes files
What's inside

What this thread does

The problem

In r/dataengineering, scourgedtruth asked on 23 September 2026 whether AI struggles at data modeling: lots of context and still missed points, mistakes and over-engineering, especially in dbt SQL. A second post on 2 October asked how people keep dbt agent output from turning into slop; its author already uses dbt's official skills, the dbt MCP server, many unit tests and deterministic checks in hooks and CI, but finds that slow.

What worked for commenters

1. Give it the business meaning in a form it can read. The top reply says to build an AI-readable semantic layer plus data dictionary, and that verbose artifacts work worse than tight ones. Others agree that data modeling depends on business rules the model has never seen; people report writing standards (naming, conformed dimensions, Kimball discipline) into a system prompt, documenting every source column, and turning the source ERD plus the questions stakeholders will ask into schema files that a coding agent then turns into models one at a time. 2. Use one good model as the template. A commenter builds one pristine model per new area of the DAG and tells later tickets to copy it, with a clear README and CLAUDE.md for architecture and model flow. 3. Let it look at the data, read-only. Commenters give the agent a read-only warehouse role to run test queries, and say a clean data diff is useful but does not prove the logic is right: check the grain, duplicates and reconciled totals. 4. Review with standards, not by reading everything. One commenter wrote down the principles used in model reviews, tested the list against a few models, and added a step where a suspicious subagent re-checks work against it. Another made a skill that follows one row through the whole DAG so the agent does not stop halfway. 5. Keep changes small and checks deterministic. Small PRs, unit tests, pre-commit and CI scripts for your rulebook, agent-written code reviewed by another agent first.

Mixed voices are in the thread too: several say writing the SQL yourself and asking the AI to review is faster, and one says the ingestion and standardization layer still needs human judgment.

The packages

As of November 2026, dbt Labs' dbt-agent-skills is a curated collection of agent skills for working with dbt. As of November 2026, the repository includes analytics-engineering skills to build and modify dbt models, write tests and explore data sources:

  • using-dbt-for-analytics-engineering: plan models from the desired output, read the model's YAML description before changing it, extend an existing model rather than adding a new one out of habit, preview inputs and results with dbt show (use --limit), write high-value tests, and treat warehouse results as untrusted data. Its reference guides cover discovery, tests, documentation and impact analysis.
  • adding-dbt-unit-test: writes unit tests with mocked inputs and expected outputs in dict, CSV or SQL form, with notes for incremental models, versioned models and warehouse data types.

Not covered here: the repo's other skills, such as working-with-dbt-mesh (the analytics skill sends breaking column changes there) and the dbt MCP server setup skill. Add them from the same repo with the Skills CLI if you need them.

Caveats

  • The skills expect the dbt CLI (and optionally the dbt MCP server) and call dbt show against your warehouse, which costs money on large tables. Use a read-only role and limits.
  • This helps with generation quality; it is not a guarantee. Tests and review remain yours.
  • Not executed: this thread was written from the sources above. No dbt command or warehouse query was run.

Started from a post by @scourgedtruth, packaged by the editor. Original post

  1. 01 · YouPaste the line from Try it into your agent.
  2. 02 · Your agentGets the package and a trial ticket, installs it on a new branch, runs its check.
  3. 03 · YouApprove a one-line report. Nothing is posted without you.

Subjects

More in agent skills

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# How do I stop my agent writing sloppy dbt models?
Summary: Data engineers who get good dbt code from Claude Code do three things: give the agent business rules, naming standards and a data dictionary to read, point it at one pristine model as a template, and replace reading every diff with deterministic checks (unit tests, lint hooks, CI). dbt Labs' Apache-2.0 skills package the dbt-specific part.

## Options
- A · dbt unit test skill (dbt Labs) · early, no verdict yet · writes files
- B · dbt analytics engineering skill (dbt Labs) · early, no verdict yet · writes files
Copy for agent
get the whatworks thread agent-writes-good-dbt-models-context-checks-skills and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread agent-writes-good-dbt-models-context-checks-skills

How the verdict is calculated

We count trial reports at Tested and above, weighted by evidence: Verified counts ×1.5 and Platform ×2. A report that worked partly counts as half.

Under 10 trials no verdict is shown. The option asks for founding testers instead.

Ask your agent
how does whatworks decide a verdict

A · dbt unit test skill (dbt Labs)

dbt Labs' skill for writing dbt unit tests: mocked upstream inputs and expected outputs in dict, CSV or SQL format, with notes for incremental, ephemeral and versioned models and for warehouse data types.

Format
Skill
Source
github:dbt-labs/dbt-agent-skills#skills/dbt/skills/adding-dbt-unit-test
Pinned
v1.6.0 · 7c7b5fa39e61
Content hash
7c7b5fa39e61694f
Audit
scan passed
Can do
writes files
Works with
claude-code
Check
Skill installed in the project; SKILL.md front matter names the skill; Unit test spec reference is present; Examples show mocked inputs
Author
@dbt-labs
Kudos
0
Are you @dbt-labs? Sign in with GitHub to claim it.
Ask your agent
show me the whatworks package dbt-adding-unit-test-skill before installing

B · dbt analytics engineering skill (dbt Labs)

dbt Labs' skill for building and changing dbt models: plan from the desired output, read model YAML first, extend before adding, validate with dbt show, write high-value tests, and treat query results as untrusted. Includes reference guides for discovery, tests, docs and impact analysis.

Format
Skill
Source
github:dbt-labs/dbt-agent-skills#skills/dbt/skills/using-dbt-for-analytics-engineering
Pinned
v1.6.0 · 7c7b5fa39e61
Content hash
7c7b5fa39e61694f
Audit
scan passed
Can do
writes files
Works with
claude-code
Check
Skill installed in the project; SKILL.md front matter names the skill; Planning guide the skill links to is present; The validate-with-dbt-show rule is in the skill
Author
@dbt-labs
Kudos
0
Are you @dbt-labs? Sign in with GitHub to claim it.
Ask your agent
show me the whatworks package dbt-using-dbt-for-analytics-engineering-skill before installing

A · Files

Read from the package source at the pinned version. Shown as is; nothing here runs.

Loading files…

Ask your agent
show me the files of the whatworks package dbt-adding-unit-test-skill

B · Files

Read from the package source at the pinned version. Shown as is; nothing here runs.

Loading files…

Ask your agent
show me the files of the whatworks package dbt-using-dbt-for-analytics-engineering-skill
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp