building-dbt-semantic-layer
Building the dbt Semantic Layer
This skill guides the creation and modification of dbt Semantic Layer components: semantic models, entities, dimensions, and metrics.
- Semantic models - Metadata configurations that define how dbt models map to business concepts
- Entities - Keys that identify the grain of your data and enable joins between semantic models
- Dimensions - Attributes used to filter or group metrics (categorical or time-based)
- Metrics - Business calculations defined on top of semantic models (e.g., revenue, order count)
Additional Resources
- Time Spine Setup - Required for time-based metrics and aggregations
- Best Practices - Design patterns and recommendations for semantic models and metrics
- Latest Spec Authoring Guide - Full YAML reference for dbt Core 1.12+ and Fusion
- Legacy Spec Authoring Guide - Full YAML reference for dbt Core 1.6-1.11
Determine Which Spec to Use
There are two versions of the Semantic Layer YAML spec:
More from dbt-labs/dbt-agent-skills
using-dbt-for-analytics-engineering
Builds and modifies dbt models, writes SQL transformations using ref() and source(), creates tests, and validates results with dbt show. Use when doing any dbt work - building or modifying models, debugging errors, exploring unfamiliar data sources, writing tests, or evaluating impact of changes.
327adding-dbt-unit-test
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.
305fetching-dbt-docs
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.
298running-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.
287answering-natural-language-questions-with-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, testing, or building dbt models during development.
286troubleshooting-dbt-job-errors
Diagnoses dbt Cloud/platform job failures by analyzing run logs, querying the Admin API, reviewing git history, and investigating data issues. Use when a dbt Cloud/platform job fails and you need to diagnose the root cause, especially when error messages are unclear or when intermittent failures occur. Do not use for local dbt development errors.
283