answering-natural-language-questions-with-dbt_skill

This skill answers natural language business questions by querying dbt semantic layer, then explores models or manifests if needed to provide an accurate
  • Python

152

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill dbt-labs/dbt-agent-skills --skill answering-natural-language-questions-with-dbt

  • SKILL.md7.4 KB

Overview

This skill answers business questions by querying dbt-managed data using a prioritized, safe workflow: semantic layer first, then modified compiled SQL, then model discovery, and finally manifest/catalog analysis. It is intended for responding to user data requests (e.g., total sales last quarter) and not for developing, testing, or running dbt models. The skill always exhausts options before returning that a question cannot be answered.

How this skill works

First check for a semantic layer and attempt to resolve the metric via list_metrics, get_dimensions, and query_metrics. If the semantic layer needs minor changes, retrieve compiled SQL (get_metrics_compiled_sql), adjust the raw SQL, and execute it. If no semantic layer is available, discover mart models with get_mart_models and get_model_details and build SQL referencing models. As a last resort, inspect target/manifest.json and target/catalog.json (filtered) to infer schema and craft warehouse SQL.

When to use it

  • Answering business questions that require querying the warehouse (sales, active users, revenue by dimension).
  • When a semantic layer is available and you want a metric-first approach.
  • When a metric exists but needs a small SQL modification (extra dimension, custom filter, different aggregation).
  • When no semantic layer exists but model discovery tools are available.
  • When in a dbt project without a server and you can read manifest/catalog artifacts.

Best practices

  • Always prefer the semantic layer for correctness and reuse before writing raw SQL.
  • If you modify compiled SQL, work with the resolved SQL (no Jinja) and suggest adding the change to the semantic model.
  • Prefer mart models over staging when discovering models; marts contain business logic.
  • Filter manifest/catalog files before reading to avoid large, slow operations.
  • Do not recommend database schema or ETL changes—keep suggestions at the semantic layer level.

Example use cases

  • User asks: 'What were total sales last month?' — query the semantic metric or run compiled SQL if needed.
  • User requests revenue by region with a custom segment — get compiled SQL and add CASE/WHERE/grouping.
  • No semantic layer: discover mart models, inspect columns, write SQL using ref('mart_model'), and execute.
  • In a local dbt project without a server: jq-filter manifest.json/catalog.json to find column info and produce SQL.
  • Metric exists but lacks a dimension: join the compiled metric to a dimension table and return grouped results.

FAQ

No. It only reads semantic models, compiled SQL, or manifest/catalog artifacts to answer questions. It does not change models or run dbt commands.

What if the semantic layer cannot answer the question?

Follow the flow: try compiled SQL modifications, then model discovery, then manifest/catalog analysis before concluding the question cannot be answered.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
answering-natural-language-questions-with-dbt skill by dbt-labs/dbt-agent-skills | VeilStrat