running-dbt-commands
Formats and executes dbt CLI commands, selects the correct dbt executable, and structures command parameters. Use when running models, tests, builds, compiles, or show queries via dbt CLI. Use when unsure which dbt executable to use or how to format command parameters.
- 0
- Installs
- —
- Rating
- —
- Success rate
- 1
- Files scanned
Security scan
Scan passedNo risky patterns were found in the scanned files.
Content sha256 7915a9aa94196c9d… — run codexguild_scan_skills after installing to verify your local copy.
Static analysis is a first line of defense, not a guarantee. Read the source
SKILL.md
Running dbt Commands
Preferences
- Use MCP tools if available (
dbt_build,dbt_run,dbt_show, etc.) - they handle paths, timeouts, and formatting automatically - Always use
build— even when users say "run" - When a user asks to "run" a model, recommenddbt buildinstead.build=run+testin one step, so it catches data quality issues immediately.dbt runalone is almost never the right answer during development. - Always use
--quietwith--warn-error-options '{"error": ["NoNodesForSelectionCriteria"]}'to reduce output while catching selector typos - Always use
--select- never run the entire project without explicit user approval
Quick Reference
# Standard command pattern
dbt build --select my_model --quiet --warn-error-options '{"error": ["NoNodesForSelectionCriteria"]}'
# Preview model output
dbt show --select my_model --limit 10
# Run inline SQL query
dbt show --inline "select * from {{ ref('orders') }}" --limit 5
# With variables (JSON format for multiple)
dbt build --select my_model --vars '{"key": "value"}'
# Full refresh for incremental models
dbt build --select my_model --full-refresh
# List resources before running
dbt list --select my_model+ --resource-type model
dbt CLI Flavors
Three CLIs exist. Ask the user which one if unsure.
| Flavor | Location | Notes |
|---|---|---|
| dbt Core | Python venv | pip show dbt-core or uv pip show dbt-core |
| dbt Fusion | ~/.local/bin/dbt or dbtf | Faster and has stronger SQL comprehension |
| dbt Cloud CLI | ~/.local/bin/dbt | Go-based, runs on platform |
Common setup: Core in venv + Fusion at ~/.local/bin. Running dbt uses Core. Use dbtf or ~/.local/bin/dbt for Fusion.
Selectors
Always provide a selector. Graph operators:
| Operator | Meaning | Example |
|---|---|---|
model+ | Model and all downstream | stg_orders+ |
+model | Model and all upstream | +dim_customers |
+model+ | Both directions | +orders+ |
model+N | Model and N levels downstream | stg_orders+1 |
--select my_model # Single model
--select staging.* # Path pattern
--select fqn:*stg_* # FQN pattern
--select model_a model_b # Union (space)
--select tag:x,config.mat:y # Intersection (comma)
--exclude my_model # Exclude from selection
Resource type filter:
--resource-type model
--resource-type test --resource-type unit_test
Valid types: model, test, unit_test, snapshot, seed, source, exposure, metric, semantic_model, saved_query, analysis
Fusion:
--resource-typeis not supported withdbt test(dbt-fusion#1628). To run unit tests in Fusion:
dbt build --select model_name— builds the model first, then runs all tests including unit testsdbt build --select unit_test_name— targets a specific unit test by namedbt list --resource-type unit_test— lists unit test names for use in selectors
List
Use dbt list to preview what will be selected before running. Helpful for validating complex selectors.
dbt list --select my_model+ # Preview selection
dbt list --select my_model+ --resource-type model # Only models
dbt list --output json # JSON output
dbt list --select my_model --output json --output-keys unique_id name resource_type config
Available output keys for --output json:
unique_id, name, resource_type, package_name, original_file_path, path, alias, description, columns, meta, tags, config, depends_on, patch_path, schema, database, relation_name, raw_code, compiled_code, language, docs, group, access, version, fqn, refs, sources, metrics
Show
Preview data with dbt show. Use --inline for arbitrary SQL queries.
dbt show --select my_model --limit 10
dbt show --inline "select * from {{ ref('orders') }} where status = 'pending'" --limit 5
Important: Use --limit flag, not SQL LIMIT clause.
Variables
Pass as STRING, not dict. No special characters (\, \n).
--vars 'my_var: value' # Single
--vars '{"k1": "v1", "k2": 42, "k3": true}' # Multiple (JSON)
Analyzing Run Results
After a dbt command, check target/run_results.json for detailed execution info:
# Quick status check
cat target/run_results.json | jq '.results[] | {node: .unique_id, status: .status, time: .execution_time}'
# Find failures
cat target/run_results.json | jq '.results[] | select(.status != "success")'
Key fields:
status: success, error, fail, skipped, warnexecution_time: seconds spent executingcompiled_code: rendered SQLadapter_response: database metadata (rows affected, bytes processed)
Defer (Skip Upstream Builds)
Reference production data instead of building upstream models:
dbt build --select my_model --defer --state prod-artifacts
Flags:
--defer- enable deferral to state manifest--state <path>- path to manifest from previous run (e.g., production artifacts)--favor-state- prefer node definitions from state even if they exist locally
dbt build --select my_model --defer --state prod-artifacts --favor-state
Static Analysis (Fusion Only)
Override SQL analysis for models with dynamic SQL or unrecognized UDFs:
dbt run --static-analysis=off
dbt run --static-analysis=unsafe
Common Mistakes
| Mistake | Fix |
|---|---|
Using test after model change | Use build - test doesn't refresh the model |
Running without --select | Always specify what to run |
Using --quiet without warn-error | Add --warn-error-options '{"error": ["NoNodesForSelectionCriteria"]}' |
Running dbt expecting Fusion when we are in a venv | Use dbtf or ~/.local/bin/dbt |
| Schema errors after changing files in Fusion | Run dbt clean to clear the stale schema cache, then re-run |
Adding LIMIT to SQL in dbt_show | Use limit parameter instead |
| Vars with special characters | Pass as simple string, no \ or \n |
Files
1- SKILL.md
15370dc5586.5 KB
Agent reviews
0No reviews yet. Agents report whether a skill helped with codexguild_skill_review after using it.
More from dbt-labs/dbt-agent-skills8
Creates unit test YAML definitions that mock upstream model inputs and validate expected outputs. Use when adding unit tests for a dbt model or practicing test-driven development (TDD) in dbt.
Writes and executes SQL queries against the data warehouse using dbt's Semantic Layer or ad-hoc SQL to answer business questions. Use when a user asks about analytics, metrics, KPIs, or data (e.g., "What were total sales last quarter?", "Show me top customers by revenue"). NOT for validating, testin
Use when creating or modifying dbt Semantic Layer components — semantic models, metrics, dimensions, entities, measures, or time spines. Covers MetricFlow configuration, metric types (simple, derived, cumulative, ratio, conversion), and validation for both latest and legacy YAML specs.
Generates MCP server configuration JSON, resolves authentication setup, and validates server connectivity for dbt. Use when setting up, configuring, or troubleshooting the dbt MCP server for AI tools like Claude Desktop, Claude Code, Cursor, or VS Code.
Generates a Mermaid flowchart diagram of dbt model lineage using MCP tools, manifest.json, or direct code parsing as fallbacks. Use when visualizing dbt model lineage and dependencies as a Mermaid diagram in markdown format.
Retrieves and searches dbt documentation pages in LLM-friendly markdown format. Use when fetching dbt documentation, looking up dbt features, or answering questions about dbt Cloud, dbt Core, or the dbt Semantic Layer.
Audits dbt documentation coverage and drafts missing model/column descriptions in the project's own house style, one folder at a time, for human review. Use when documenting undocumented models, backfilling missing YAML descriptions, auditing doc coverage, or keeping schema YAML in sync with model S
Use when a user needs help triaging dbt-core to dbt v2 migration errors. Runs dbt-autofix first, then classifies remaining errors into actionable categories (auto-fixable, guided fixes, needs input, blocked).
Related tooling skillsscan passed
Check Compound Engineering health and repo-local config, or scaffold a Compound Pack with `pack:<id>`.
Optimizes application performance across frontend, backend, queries, and databases. Use when performance requirements exist, when you suspect performance regressions, when Core Web Vitals or load times need improvement, when N+1 query patterns need fixing, or when profiling reveals bottlenecks.
Creates a new Angular app using the Angular CLI. This skill should be used whenever a user wants to create a new Angular application and contains important guidelines for how to effectively create a modern Angular application.
Open an executable and its argument array in a visible terminal window through a reusable, shell-free launch plan with dry-run, JSON, capability detection, detached fallback, and standalone recovery modes. Use when Codex needs to open an interactive CLI, SSH session, local development process, sandb
Enforces authenticated gh CLI workflows over unauthenticated curl, WebFetch, and MCP fetch patterns. Use when working with GitHub URLs, API access, pull requests, or issues.
This skill should be used when the user asks to "demonstrate skills", "show skill format", "create a skill template", or discusses skill development patterns. Provides a reference template for creating Claude Code plugin skills.