210-dbt-semantic-modeling

210-dbt-semantic-modeling is a cursor rule for coding agents from hamzaamjad/cursor-rules. It costs 0 tokens per session (567 once invoked), scanned A, original, MIT.

Rules for defining dbt semantic models: reusable descriptions of business data, dimensions, measures, metrics, and relationships. dbt is a tool that transforms and documents data, while a semantic layer gives reports consistent business definitions.

In plain words
What is it for?
Use them to define business metrics, time and category breakdowns, hierarchies, joins, ownership, descriptions, and validation thresholds in dbt.
Why use it?
They keep metric definitions in one governed place and reduce inconsistent calculations or incorrect joins across reports.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/hamzaamjad/cursor-rules/210-dbt-semantic-modeling
Clone the repo
git clone --depth 1 https://github.com/hamzaamjad/cursor-rules

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for 210-dbt-semantic-modeling

README.md
[![agentmods](https://agentmods.dev/badge/rules/hamzaamjad/cursor-rules/210-dbt-semantic-modeling.svg)](https://agentmods.dev/rules/hamzaamjad/cursor-rules/210-dbt-semantic-modeling)
Your own site
<a href="https://agentmods.dev/rules/hamzaamjad/cursor-rules/210-dbt-semantic-modeling"><img src="https://agentmods.dev/badge/rules/hamzaamjad/cursor-rules/210-dbt-semantic-modeling.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 567 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00567
Opus 5 $0.00000 $0.00283
Sonnet 5 $0.00000 $0.00113
Haiku 4.5 $0.00000 $0.00057

Measured 3d ago against content hash dd8fadd0a4a1, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

210-dbt-semantic-modeling scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

rules/200-domain/210-dbt-semantic-modeling.mdc · 49 lines

What it actually says

dbt-semantic-modeling

Purpose: Build a consistent, governed, and reusable semantic layer using dbt's native semantic models.

1. Semantic Model Definition

  • Define semantic_models: in YAML under models/semantic/ or a top-level semantic/ folder.
  • Use singular, business-centric names (e.g., customers, orders).
  • Include label, description, and meta.owner for each model.

2. Dimensions & Hierarchies

  • Under each model, list dimensions: with name, type (e.g., primary_key, time, categorical), and description.
  • Define time hierarchies (date, week, month) and business hierarchies (e.g., region → country → city).

3. Measures & Metrics

  • Define measures: with name, calculation_method (sum, average, derived), expression, timestamp, time_grains, and filters.
  • Add meta.business_definition and validation_thresholds for quality checks.
  • Centralize metric definitions to ensure consistency across reports.

4. Relationships & Joins

  • Declare joins: at project level: specify from, to, on, and relationship (one_to_many, many_to_one).
  • Validate cardinality to prevent aggregation errors.

5. Exposures & Packages

  • Use exposures: to link semantic models to BI dashboards, notebooks, or APIs.
  • Leverage exports: to share metrics and semantic definitions across projects.

6. Testing & Validation

  • Write schema tests for semantic models: existence, types, and sample values.
  • Implement custom SQL tests to validate key metrics against known benchmarks.

7. Documentation & Lineage

  • Generate docs with dbt docs generate including semantic models.
  • Tag models and measures for grouping (e.g., finance, marketing).
  • Version docs in CI; fail on outdated or missing metadata.

8. CI/CD & Governance

  • Add semantic builds in CI (dbt build --select semantic_models); fail on warnings/errors.
  • Enforce naming and style conventions via pre-commit hooks.
  • Store governance metadata (meta.access, tags.sensitivity) for row-level and column-level security.

9. Reusability & Parameterization

  • Publish semantic layers as packages for reuse across teams.
  • Parameterize definitions using vars for environment-specific overrides.

References: dbt Labs (Semantic Layer docs), knowledge_base/data_modeling/semantic/semantic_modeling_principles.md

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 49 lines · 0 tokens per session scan A dd8fadd0a4a1

Subscribe to this mod's changes

210-dbt-semantic-modeling is a cursor rule published in the GitHub repository hamzaamjad/cursor-rules (2 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 567 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.