[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6F3RV3V2G3SMBHK32NC0PYP":3,"skill-same:01M6F3RV3V2G3SMBHK32NC0PYP":69},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":46,"commitSha":47,"skillDirectory":48,"forksCount":49,"repositoryHtmlUrl":50,"repositoryHomepageUrl":51,"ownerHtmlUrl":52,"ownerBlogUrl":6,"ownerDescription":53,"updatedAt":54,"install":55,"resources":68},"01M6F3RV3V2G3SMBHK32NC0PYP","answering-natural-language-questions-with-dbt",null,"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.","ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fdbt-labs\u002Fdbt-agent-skills\u002Fanswering-natural-language-questions-with-dbt\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"answering natural language questions with dbt","questions","with","dbt","natural language","language","sql queries","revenue","false","me","show","testing","use","business","show me","data","metrics","development","sql","analytics","2026-11-10 10:12:30",false,"---\nname: answering-natural-language-questions-with-dbt\ndescription: 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.\nuser-invocable: false\nmetadata:\n  author: dbt-labs\n---\n\n# Answering Natural Language Questions with dbt\n\n## Overview\n\nAnswer 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.\"\n\n**Use for:** Business questions from users that need data answers\n- \"What were total sales last month?\"\n- \"How many active customers do we have?\"\n- \"Show me revenue by region\"\n\n**Not for:**\n- Validating model logic during development\n- Testing dbt models or semantic layer definitions\n- Building or modifying dbt models\n- `dbt run`, `dbt test`, or `dbt build` workflows\n\n## Decision Flow\n\n```mermaid\nflowchart TD\n    start([Business question received])\n    check_sl{Semantic layer tools available?}\n    list_metrics[list_metrics]\n    metric_exists{Relevant metric exists?}\n    get_dims[get_dimensions]\n    sl_sufficient{SL can answer directly?}\n    query_metrics[query_metrics]\n    answer([Return answer])\n    try_compiled[get_metrics_compiled_sql\u003Cbr\u002F>Modify SQL, execute_sql]\n    check_discovery{Model discovery tools available?}\n    try_discovery[get_mart_models\u003Cbr\u002F>get_model_details\u003Cbr\u002F>Write SQL, execute]\n    check_manifest{In dbt project?}\n    try_manifest[Analyze manifest\u002Fcatalog\u003Cbr\u002F>Write SQL]\n    cannot([Cannot answer])\n    suggest{In dbt project?}\n    improvements[Suggest semantic layer changes]\n    done([Done])\n\n    start --> check_sl\n    check_sl -->|yes| list_metrics\n    check_sl -->|no| check_discovery\n    list_metrics --> metric_exists\n    metric_exists -->|yes| get_dims\n    metric_exists -->|no| check_discovery\n    get_dims --> sl_sufficient\n    sl_sufficient -->|yes| query_metrics\n    sl_sufficient -->|no| try_compiled\n    query_metrics --> answer\n    try_compiled -->|success| answer\n    try_compiled -->|fail| check_discovery\n    check_discovery -->|yes| try_discovery\n    check_discovery -->|no| check_manifest\n    try_discovery -->|success| answer\n    try_discovery -->|fail| check_manifest\n    check_manifest -->|yes| try_manifest\n    check_manifest -->|no| cannot\n    try_manifest -->|SQL ready| answer\n    answer --> suggest\n    cannot --> done\n    suggest -->|yes| improvements\n    suggest -->|no| done\n    improvements --> done\n```\n\n## Quick Reference\n\n| Priority | Condition | Approach | Tools |\n|----------|-----------|----------|-------|\n| 1 | Semantic layer active | Query metrics directly | `list_metrics`, `get_dimensions`, `query_metrics` |\n| 2 | SL active but minor modifications needed (missing dimension, custom filter, case when, different aggregation) | Modify compiled SQL | `get_metrics_compiled_sql`, then `execute_sql` |\n| 3 | No SL, discovery tools active | Explore models, write SQL | `get_mart_models`, `get_model_details`, then `show`\u002F`execute_sql` |\n| 4 | No MCP, in dbt project | Analyze artifacts, write SQL | Read `target\u002Fmanifest.json`, `target\u002Fcatalog.json` |\n\n## Approach 1: Semantic Layer Query\n\nWhen `list_metrics` and `query_metrics` are available:\n\n1. `list_metrics` - find relevant metric\n2. `get_dimensions` - verify required dimensions exist\n3. `query_metrics` - execute with appropriate filters\n\nIf semantic layer can't answer directly (missing dimension, need custom logic) → go to Approach 2.\n\n## Approach 2: Modified Compiled SQL\n\nWhen semantic layer has the metric but needs minor modifications:\n\n- Missing dimension (join + group by)\n- Custom filter not available as a dimension\n- Case when logic for custom categorization\n- Different aggregation than what's defined\n\n1. `get_metrics_compiled_sql` - get the SQL that would run (returns raw SQL, not Jinja)\n2. Modify SQL to add what's needed\n3. `execute_sql` to run the raw SQL\n4. **Always suggest** updating the semantic model if the modification would be reusable\n\n```sql\n-- Example: Adding sales_rep dimension\nWITH base AS (\n    -- ... compiled metric logic (already resolved to table names) ...\n)\nSELECT base.*, reps.sales_rep_name\nFROM base\nJOIN analytics.dim_sales_reps reps ON base.rep_id = reps.id\nGROUP BY ...\n\n-- Example: Custom filter\nSELECT * FROM (compiled_metric_sql) WHERE region = 'EMEA'\n\n-- Example: Case when categorization\nSELECT\n    CASE WHEN amount > 1000 THEN 'large' ELSE 'small' END as deal_size,\n    SUM(amount)\nFROM (compiled_metric_sql)\nGROUP BY 1\n```\n\n**Note:** The compiled SQL contains resolved table names, not `{{ ref() }}`. Work with the raw SQL as returned.\n\n## Approach 3: Model Discovery\n\nWhen no semantic layer but `get_all_models`\u002F`get_model_details` available:\n\n1. `get_mart_models` - start with marts, not staging\n2. `get_model_details` for relevant models - understand schema\n3. Write SQL using `{{ ref('model_name') }}`\n4. `show --inline \"...\"` or `execute_sql`\n\n**Prefer marts over staging** - marts have business logic applied.\n\n## Approach 4: Manifest\u002FCatalog Analysis\n\nWhen in a dbt project but no MCP server:\n\n1. Check for `target\u002Fmanifest.json` and `target\u002Fcatalog.json`\n2. **Filter before reading** - these files can be large\n\n```bash\n# Find mart models in manifest\njq '.nodes | to_entries | map(select(.key | startswith(\"model.\") and contains(\"mart\"))) | .[].value | {name: .name, schema: .schema, columns: .columns}' target\u002Fmanifest.json\n\n# Get column info from catalog\njq '.nodes[\"model.project_name.model_name\"].columns' target\u002Fcatalog.json\n```\n\n3. Write SQL based on discovered schema\n4. Explain: \"This SQL should run in your warehouse. I cannot execute it without database access.\"\n\n## Suggesting Improvements\n\n**When in a dbt project**, suggest semantic layer changes after answering (or when cannot answer):\n\n| Gap | Suggestion |\n|-----|------------|\n| Metric doesn't exist | \"Add a metric definition to your semantic model\" |\n| Dimension missing | \"Add `dimension_name` to the dimensions list in the semantic model\" |\n| No semantic layer | \"Consider adding a semantic layer for this data\" |\n\n**Stay at semantic layer level.** Do NOT suggest:\n- Database schema changes\n- ETL pipeline modifications\n- \"Ask your data engineering team to...\"\n\n## Rationalizations to Resist\n\n| You're Thinking... | Reality |\n|--------------------|---------|\n| \"Semantic layer doesn't support this exact query\" | Get compiled SQL and modify it (Approach 2) |\n| \"No MCP tools, can't help\" | Check for manifest\u002Fcatalog locally |\n| \"User needs this quickly, skip the systematic check\" | Systematic approach IS the fastest path |\n| \"Just write SQL, it's faster\" | Semantic layer exists for a reason - use it first |\n| \"The dimension doesn't exist in the data\" | Maybe it exists but not in semantic layer config |\n\n## Red Flags - STOP\n\n- Writing SQL without checking if semantic layer can answer\n- Saying \"cannot answer\" without trying all 4 approaches\n- Suggesting database-level fixes for semantic layer gaps\n- Reading entire manifest.json without filtering\n- Using staging models when mart models exist\n- Using this to validate model correctness rather than answer business questions\n\n## Common Mistakes\n\n| Mistake | Fix |\n|---------|-----|\n| Giving up when SL can't answer directly | Get compiled SQL and modify it |\n| Querying staging models | Use `get_mart_models` first |\n| Reading full manifest.json | Use jq to filter |\n| Suggesting ETL changes | Keep suggestions at semantic layer |\n| Not checking tool availability | List available tools before choosing approach |\n\n","# Answering Natural Language Questions with dbt\n\n## Overview\n\nAnswer 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.\"\n\n**Use for:** Business questions from users that need data answers\n- \"What were total sales last month?\"\n- \"How many active customers do we have?\"\n- \"Show me revenue by region\"\n\n**Not for:**\n- Validating model logic during development\n- Testing dbt models or semantic layer definitions\n- Building or modifying dbt models\n- `dbt run`, `dbt test`, or `dbt build` workflows\n\n## Decision Flow\n\n```mermaid\nflowchart TD\n    start([Business question received])\n    check_sl{Semantic layer tools available?}\n    list_metrics[list_metrics]\n    metric_exists{Relevant metric exists?}\n    get_dims[get_dimensions]\n    sl_sufficient{SL can answer directly?}\n    query_metrics[query_metrics]\n    answer([Return answer])\n    try_compiled[get_metrics_compiled_sql\u003Cbr\u002F>Modify SQL, execute_sql]\n    check_discovery{Model discovery tools available?}\n    try_discovery[get_mart_models\u003Cbr\u002F>get_model_details\u003Cbr\u002F>Write SQL, execute]\n    check_manifest{In dbt project?}\n    try_manifest[Analyze manifest\u002Fcatalog\u003Cbr\u002F>Write SQL]\n    cannot([Cannot answer])\n    suggest{In dbt project?}\n    improvements[Suggest semantic layer changes]\n    done([Done])\n\n    start --> check_sl\n    check_sl -->|yes| list_metrics\n    check_sl -->|no| check_discovery\n    list_metrics --> metric_exists\n    metric_exists -->|yes| get_dims\n    metric_exists -->|no| check_discovery\n    get_dims --> sl_sufficient\n    sl_sufficient -->|yes| query_metrics\n    sl_sufficient -->|no| try_compiled\n    query_metrics --> answer\n    try_compiled -->|success| answer\n    try_compiled -->|fail| check_discovery\n    check_discovery -->|yes| try_discovery\n    check_discovery -->|no| check_manifest\n    try_discovery -->|success| answer\n    try_discovery -->|fail| check_manifest\n    check_manifest -->|yes| try_manifest\n    check_manifest -->|no| cannot\n    try_manifest -->|SQL ready| answer\n    answer --> suggest\n    cannot --> done\n    suggest -->|yes| improvements\n    suggest -->|no| done\n    improvements --> done\n```\n\n## Quick Reference\n\n| Priority | Condition | Approach | Tools |\n|----------|-----------|----------|-------|\n| 1 | Semantic layer active | Query metrics directly | `list_metrics`, `get_dimensions`, `query_metrics` |\n| 2 | SL active but minor modifications needed (missing dimension, custom filter, case when, different aggregation) | Modify compiled SQL | `get_metrics_compiled_sql`, then `execute_sql` |\n| 3 | No SL, discovery tools active | Explore models, write SQL | `get_mart_models`, `get_model_details`, then `show`\u002F`execute_sql` |\n| 4 | No MCP, in dbt project | Analyze artifacts, write SQL | Read `target\u002Fmanifest.json`, `target\u002Fcatalog.json` |\n\n## Approach 1: Semantic Layer Query\n\nWhen `list_metrics` and `query_metrics` are available:\n\n1. `list_metrics` - find relevant metric\n2. `get_dimensions` - verify required dimensions exist\n3. `query_metrics` - execute with appropriate filters\n\nIf semantic layer can't answer directly (missing dimension, need custom logic) → go to Approach 2.\n\n## Approach 2: Modified Compiled SQL\n\nWhen semantic layer has the metric but needs minor modifications:\n\n- Missing dimension (join + group by)\n- Custom filter not available as a dimension\n- Case when logic for custom categorization\n- Different aggregation than what's defined\n\n1. `get_metrics_compiled_sql` - get the SQL that would run (returns raw SQL, not Jinja)\n2. Modify SQL to add what's needed\n3. `execute_sql` to run the raw SQL\n4. **Always suggest** updating the semantic model if the modification would be reusable\n\n```sql\n-- Example: Adding sales_rep dimension\nWITH base AS (\n    -- ... compiled metric logic (already resolved to table names) ...\n)\nSELECT base.*, reps.sales_rep_name\nFROM base\nJOIN analytics.dim_sales_reps reps ON base.rep_id = reps.id\nGROUP BY ...\n\n-- Example: Custom filter\nSELECT * FROM (compiled_metric_sql) WHERE region = 'EMEA'\n\n-- Example: Case when categorization\nSELECT\n    CASE WHEN amount > 1000 THEN 'large' ELSE 'small' END as deal_size,\n    SUM(amount)\nFROM (compiled_metric_sql)\nGROUP BY 1\n```\n\n**Note:** The compiled SQL contains resolved table names, not `{{ ref() }}`. Work with the raw SQL as returned.\n\n## Approach 3: Model Discovery\n\nWhen no semantic layer but `get_all_models`\u002F`get_model_details` available:\n\n1. `get_mart_models` - start with marts, not staging\n2. `get_model_details` for relevant models - understand schema\n3. Write SQL using `{{ ref('model_name') }}`\n4. `show --inline \"...\"` or `execute_sql`\n\n**Prefer marts over staging** - marts have business logic applied.\n\n## Approach 4: Manifest\u002FCatalog Analysis\n\nWhen in a dbt project but no MCP server:\n\n1. Check for `target\u002Fmanifest.json` and `target\u002Fcatalog.json`\n2. **Filter before reading** - these files can be large\n\n```bash\n# Find mart models in manifest\njq '.nodes | to_entries | map(select(.key | startswith(\"model.\") and contains(\"mart\"))) | .[].value | {name: .name, schema: .schema, columns: .columns}' target\u002Fmanifest.json\n\n# Get column info from catalog\njq '.nodes[\"model.project_name.model_name\"].columns' target\u002Fcatalog.json\n```\n\n3. Write SQL based on discovered schema\n4. Explain: \"This SQL should run in your warehouse. I cannot execute it without database access.\"\n\n## Suggesting Improvements\n\n**When in a dbt project**, suggest semantic layer changes after answering (or when cannot answer):\n\n| Gap | Suggestion |\n|-----|------------|\n| Metric doesn't exist | \"Add a metric definition to your semantic model\" |\n| Dimension missing | \"Add `dimension_name` to the dimensions list in the semantic model\" |\n| No semantic layer | \"Consider adding a semantic layer for this data\" |\n\n**Stay at semantic layer level.** Do NOT suggest:\n- Database schema changes\n- ETL pipeline modifications\n- \"Ask your data engineering team to...\"\n\n## Rationalizations to Resist\n\n| You're Thinking... | Reality |\n|--------------------|---------|\n| \"Semantic layer doesn't support this exact query\" | Get compiled SQL and modify it (Approach 2) |\n| \"No MCP tools, can't help\" | Check for manifest\u002Fcatalog locally |\n| \"User needs this quickly, skip the systematic check\" | Systematic approach IS the fastest path |\n| \"Just write SQL, it's faster\" | Semantic layer exists for a reason - use it first |\n| \"The dimension doesn't exist in the data\" | Maybe it exists but not in semantic layer config |\n\n## Red Flags - STOP\n\n- Writing SQL without checking if semantic layer can answer\n- Saying \"cannot answer\" without trying all 4 approaches\n- Suggesting database-level fixes for semantic layer gaps\n- Reading entire manifest.json without filtering\n- Using staging models when mart models exist\n- Using this to validate model correctness rather than answer business questions\n\n## Common Mistakes\n\n| Mistake | Fix |\n|---------|-----|\n| Giving up when SL can't answer directly | Get compiled SQL and modify it |\n| Querying staging models | Use `get_mart_models` first |\n| Reading full manifest.json | Use jq to filter |\n| Suggesting ETL changes | Keep suggestions at semantic layer |\n| Not checking tool availability | List available tools before choosing approach |\n\n",{"name":5,"metadata":44,"description":7,"user-invocable":40},{"author":45},"dbt-labs","main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002Fdbt-labs\u002Fdbt-agent-skills\u002Fanswering-natural-language-questions-with-dbt",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":8,"skillName":5,"commands":56,"prompt":66,"zipAvailable":67},[57,60,63],{"tool":58,"command":59},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill answering-natural-language-questions-with-dbt",{"tool":61,"command":62},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill answering-natural-language-questions-with-dbt",{"tool":64,"command":65},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill answering-natural-language-questions-with-dbt","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fdbt-labs\u002Fdbt-agent-skills\u002Fanswering-natural-language-questions-with-dbt\u002FSKILL.md",true,[],[70,79,88,97,103,109],{"skillNo":71,"name":72,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":39},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[],[76,77,78],"model","model hierarchy","model hierarchy skill",{"skillNo":80,"name":81,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":39},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[],[85,86,87],"MCP","zoom","zoom mcp",{"skillNo":89,"name":90,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":39},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[94,95,96,86],"sdk","zoom apps sdk","apps",{"skillNo":98,"name":99,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":39},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[99],{"skillNo":104,"name":105,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":39},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[],[105],{"skillNo":110,"name":111,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":39},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[111]]