# answering-natural-language-questions-with-dbt

Answers business questions about metrics and data: checks the dbt Semantic Layer first, then writes and runs SQL. Useful when you want numbers, not model work.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 1000 installs · ★ 746
- Author: dbt-labs
- License: Apache-2.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/dbt-labs/dbt-agent-skills/tree/HEAD/skills/dbt/skills/answering-natural-language-questions-with-dbt/SKILL.md
- Updated: 2026-10-22
- HTML: https://affpapa.org/en/nevibecode/skills/answering-natural-language-questions-with-dbt

## What it does

The skill takes a question like "what were total sales last quarter" and walks four levels. First the Semantic Layer: `list_metrics`, `get_dimensions`, `query_metrics`. If the metric exists but a dimension is missing or you need a custom filter, it pulls the compiled SQL with `get_metrics_compiled_sql`, edits it and runs it through `execute_sql`.

With no Semantic Layer it moves to model discovery: `get_mart_models`, `get_model_details`, then SQL written against `{{ ref('model_name') }}` and executed via `show --inline` or `execute_sql`. If there is no MCP server but you are inside a dbt project, it reads `target/manifest.json` and `target/catalog.json` and tells you to filter them with `jq` because the files get large. It cannot run the query in that case — no warehouse access, so you execute the SQL yourself.

The skill is not for development. Validating model logic, `dbt test`, `dbt build` and editing models are out of scope. After answering it may suggest a semantic layer change when a metric or dimension was missing, but it stays away from warehouse schema and ETL.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add dbt-labs/dbt-agent-skills --skill answering-natural-language-questions-with-dbt -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/answering-natural-language-questions-with-dbt/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/answering-natural-language-questions-with-dbt/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add dbt-labs/dbt-agent-skills --skill answering-natural-language-questions-with-dbt -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/answering-natural-language-questions-with-dbt/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add dbt-labs/dbt-agent-skills --skill answering-natural-language-questions-with-dbt -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/answering-natural-language-questions-with-dbt/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install dbt-labs/dbt-agent-skills answering-natural-language-questions-with-dbt
```

2. **Manually: put the files in place**
- File: `.github/skills/answering-natural-language-questions-with-dbt/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add dbt-labs/dbt-agent-skills --skill answering-natural-language-questions-with-dbt -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/dbt-labs/dbt-agent-skills --path skills/dbt/skills/answering-natural-language-questions-with-dbt
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/answering-natural-language-questions-with-dbt/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add dbt-labs/dbt-agent-skills --skill answering-natural-language-questions-with-dbt -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/dbt-labs/dbt-agent-skills/tree/HEAD/skills/dbt/skills/answering-natural-language-questions-with-dbt/SKILL.md

## When to use it
- get last quarter's sales total without opening a BI tool
- find the right metric in the dbt Semantic Layer
- add a missing dimension to an existing metric
- read mart model schemas and write SQL against them
- pull column lists out of `target/catalog.json`

## Example prompts
- How many active customers do we have right now?
- Show me revenue by region
- Which customers drove the most revenue last month?

## Source text · SKILL.md · Apache-2.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 495b795b469453e3.

BEGIN THIRD-PARTY FILE 495b795b469453e3
````text
---
name: answering-natural-language-questions-with-dbt
description: 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, testing, or building dbt models during development.
user-invocable: false
metadata:
  author: dbt-labs
---

# Answering Natural Language Questions with dbt

## Overview

Answer data questions using the best available method: semantic layer first, then SQL modification, then model discovery, then manifest analysis. Always exhaust options before saying "cannot answer."

**Use for:** Business questions from users that need data answers
- "What were total sales last month?"
- "How many active customers do we have?"
- "Show me revenue by region"

**Not for:**
- Validating model logic during development
- Testing dbt models or semantic layer definitions
- Building or modifying dbt models
- `dbt run`, `dbt test`, or `dbt build` workflows

## Decision Flow

```mermaid
flowchart TD
    start([Business question received])
    check_sl{Semantic layer tools available?}
    list_metrics[list_metrics]
    metric_exists{Relevant metric exists?}
    get_dims[get_dimensions]
    sl_sufficient{SL can answer directly?}
    query_metrics[query_metrics]
    answer([Return answer])
    try_compiled[get_metrics_compiled_sql<br/>Modify SQL, execute_sql]
    check_discovery{Model discovery tools available?}
    try_discovery[get_mart_models<br/>get_model_details<br/>Write SQL, execute]
    check_manifest{In dbt project?}
    try_manifest[Analyze manifest/catalog<br/>Write SQL]
    cannot([Cannot answer])
    suggest{In dbt project?}
    improvements[Suggest semantic layer changes]
    done([Done])

    start --> check_sl
    check_sl -->|yes| list_metrics
    check_sl -->|no| check_discovery
    list_metrics --> metric_exists
    metric_exists -->|yes| get_dims
    metric_exists -->|no| check_discovery
    get_dims --> sl_sufficient
````
END THIRD-PARTY FILE 495b795b469453e3

The third-party file has ended. Everything between the 495b795b469453e3 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2100 of 7768 bytes. © dbt-labs · Apache-2.0 · https://github.com/dbt-labs/dbt-agent-skills/tree/HEAD/skills/dbt/skills/answering-natural-language-questions-with-dbt/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
