dbt-model-spec

GitHub

用于规范设计 dbt 模型,明确粒度、来源、转换逻辑及测试。输出包含目的、血缘、列定义、dbt 测试清单、物化策略选择理由及 SQL/YAML 骨架代码,确保模型可审查且数据准确可靠。

exports/openclaw/dbt-model-spec/SKILL.md mohitagw15856/pm-claude-skills

Trigger Scenarios

设计 dbt 模型 规划数据转换逻辑 编写 staging/intermediate/mart 层模型规范 定义表级 dbt 测试

Install

npx skills add mohitagw15856/pm-claude-skills --skill dbt-model-spec -g -y
More Options

Non-standard path

npx skills add https://github.com/mohitagw15856/pm-claude-skills/tree/main/exports/openclaw/dbt-model-spec -g -y

Use without installing

npx skills use mohitagw15856/pm-claude-skills@dbt-model-spec

指定 Agent (Claude Code)

npx skills add mohitagw15856/pm-claude-skills --skill dbt-model-spec -a claude-code -g -y

安装 repo 全部 skill

npx skills add mohitagw15856/pm-claude-skills --all -g -y

预览 repo 内 skill

npx skills add mohitagw15856/pm-claude-skills --list

SKILL.md

Frontmatter
{
    "name": "dbt-model-spec",
    "homepage": "https:\/\/mohitagw15856.github.io\/pm-claude-skills\/skill\/dbt-model-spec.html",
    "metadata": {
        "openclaw": {
            "emoji": "🛠"
        }
    },
    "description": "Spec a dbt model — its grain, sources, transformations, tests, and materialization. Use when asked to design a dbt model, plan a data transformation, write a staging\/intermediate\/mart model spec, or define dbt tests for a table. Produces a model spec — purpose & grain, lineage (sources → refs), the transformation logic, column definitions, dbt tests, materialization choice, and the skeleton SQL\/YAML."
}

dbt Model Spec Skill

A dbt model is only trustworthy if its grain is unambiguous, its sources are declared, and it's tested. This skill specs a model the way a good analytics engineer would — naming the grain first, mapping lineage, defining each column, choosing the right materialization, and writing the dbt tests that keep it correct — so the model is reviewable before a line of SQL ships.

Required Inputs

Ask for these only if they aren't already provided:

  • What the model represents and its grain (one row per ___ — the single most important decision).
  • Layer — staging, intermediate, or mart (dimension/fact). Conventions differ per layer.
  • Sources / upstream refs — the raw tables or models it builds on.
  • The business logic — joins, filters, aggregations, and any business rules.

Output Format

dbt Model: [model_name]

1. Purpose & grain — what it is, and one row per [grain] stated explicitly. Layer (staging/intermediate/mart).

2. Lineagesource('…') / ref('…') upstreams → this model → likely downstream consumers.

3. Transformation logic — the joins, filters, aggregations, window functions, and business rules, in order. Flag fan-out risks (joins that break the grain).

4. Columns — a table: name · type · description · (key/measure/dimension). The schema contract.

column type description

5. Tests (dbt) — unique + not_null on the grain key, relationships for FKs, accepted_values for enums, and any custom/dbt_utils tests the logic needs. Tests are the model's guarantees — don't skip them.

6. Materialization — view / table / incremental / ephemeral, with the reasoning (incremental needs a unique_key + an is_incremental() filter).

7. Skeleton — a starting model.sql (CTE-structured: imports → logic → final select) and the schema.yml with tests, ready to fill in.

Quality Checks

  • The grain is stated as "one row per ___" and the key is tested unique + not_null
  • Sources/refs use source()/ref(), not hard-coded table names
  • Every column has a type and description (the schema contract)
  • Tests cover the grain key, FKs (relationships), and enum columns
  • Materialization is justified; incremental models declare a unique_key and is_incremental() logic
  • Fan-out joins that could break the grain are flagged

Anti-Patterns

  • Do not leave the grain ambiguous — an untested, unclear grain is how duplicate rows and wrong metrics happen
  • Do not hard-code upstream table names — use ref()/source() so lineage and environments work
  • Do not ship a model with no tests — untested models silently rot; the grain key at minimum must be tested
  • Do not default everything to a table — pick the materialization the use justifies (views for light, incremental for large append-only)
  • Do not bury business logic without comments — the next analyst must understand the rules

Based On

dbt / analytics-engineering best practice — explicit grain, ref/source lineage, layered modelling (staging→intermediate→mart), schema tests.

Version History

  • 54fad50 Current 2026-07-19 12:16

Same Skill Collection

exports/openclaw/360-feedback-template/SKILL.md
exports/openclaw/401k-plan-decoder/SKILL.md
exports/openclaw/ab-test-planner/SKILL.md
exports/openclaw/ab-test-readout/SKILL.md
exports/openclaw/accessibility-audit/SKILL.md
exports/openclaw/account-plan/SKILL.md
exports/openclaw/acquirer-red-team/SKILL.md
exports/openclaw/ad-copy/SKILL.md
exports/openclaw/aeo-optimizer/SKILL.md
exports/openclaw/agenda-or-cancel/SKILL.md
exports/openclaw/agent-design-review/SKILL.md
exports/openclaw/agent-observability-spec/SKILL.md
exports/openclaw/agent-spec/SKILL.md
exports/openclaw/ai-ethics-review/SKILL.md
exports/openclaw/ai-eval-plan/SKILL.md
exports/openclaw/ai-feature-prd/SKILL.md
exports/openclaw/ai-product-canvas/SKILL.md
exports/openclaw/air-quality/SKILL.md
exports/openclaw/altitude-shifter/SKILL.md
exports/openclaw/ambiguity-resolver/SKILL.md
exports/openclaw/analyst-relations-brief/SKILL.md
exports/openclaw/announcement-card/SKILL.md
exports/openclaw/api-docs-writer/SKILL.md
exports/openclaw/api-test-plan/SKILL.md
exports/openclaw/api-versioning-strategy/SKILL.md
exports/openclaw/apology-letter/SKILL.md
exports/openclaw/architecture-decision-record/SKILL.md
exports/openclaw/architecture-diagram/SKILL.md
exports/openclaw/archive-strategy/SKILL.md
exports/openclaw/assumption-bounty/SKILL.md
exports/openclaw/assumption-mapper/SKILL.md
exports/openclaw/async-update-format/SKILL.md
exports/openclaw/auto-repair-estimate-decoder/SKILL.md
exports/openclaw/autopilot-charter/SKILL.md
exports/openclaw/benefits-decoder/SKILL.md
exports/openclaw/bid-tender-review/SKILL.md
exports/openclaw/board-deck-narrative/SKILL.md
exports/openclaw/board-minutes/SKILL.md
exports/openclaw/board-pre-read/SKILL.md
exports/openclaw/bom-cost-review/SKILL.md
exports/openclaw/bookkeeping-categorization/SKILL.md
exports/openclaw/boolean-search-builder/SKILL.md
exports/openclaw/brag-doc/SKILL.md
exports/openclaw/brainstorming/SKILL.md
exports/openclaw/brief-builder/SKILL.md
exports/openclaw/briefing-note/SKILL.md
exports/openclaw/budget-builder/SKILL.md
exports/openclaw/budget-variance-analysis/SKILL.md
exports/openclaw/bug-diagnosis/SKILL.md
exports/openclaw/bug-report/SKILL.md

Metadata

Files
0
Version
471c606
Hash
ec94c70a
Indexed
2026-07-19 12:16

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-07-30 12:28
浙ICP备14020137号-1 $방문자$