More on the topic…
dbt-doctor is a static analysis tool that scans dbt projects for maintainability problems before they hit production. It checks for missing documentation, weak test coverage, schema drift risks, stale models, naming convention violations, and governance gaps. You run it locally, in pre-commit hooks, or as a GitHub Actions quality gate. The tool assigns a health score (75+ is Great, 50–74 needs work, under 50 is Critical) based on how many unique rule violations it finds. Each rule fires once per project, so the score reflects breadth of issues rather than frequency. It requires Node.js 22+, a standard dbt project layout, and optionally SQLFluff for SQL linting.
The scoring formula is straightforward: 100 minus (unique error rules × 1.5) minus (unique warning rules × 0.75). You can configure dbt-doctor with a `.dbt-doctor` config file to choose from three presets (default, strict, enterprise), silence specific rules or file paths, and control which findings surface in CI, PR comments, or annotations. The tool has 122 rules total, but presets let you run a smaller subset. It integrates cleanly with GitHub Actions through a composite action that posts sticky PR comments with findings, and it respects `.gitignore` and inline disable directives so you're not fighting the tool on legacy code.
The CLI is flexible enough for different workflows. Use `--diff main` to check only changed files for regression gates, or `--staged` for pre-commit. You can suppress findings with `dbt-doctor-disable-next-line` comments in SQL and YAML. There's also a JavaScript API if you want to embed diagnostics in other tools. The project started as an adaptation of React Doctor (Million's linting tool) and is maintained by Northgrain Data under the MIT license. You install it with `npx dbt-doctor@latest` and can even install it as an AI agent skill for Cursor, Claude Code, and similar tools.
Questions about this article
No questions yet.