Agent Skillscbrock84/headcount › data-modeling

data-modeling

GitHub

指导数据仓库建模,涵盖分层架构、粒度定义、维度模型及语义层设计。用于优化查询性能、规范指标口径及诊断数据问题。

plugins/data-analytics/skills/data-modeling/SKILL.md cbrock84/headcount

Trigger Scenarios

设计或重构数据仓库结构 定义新数据源的粒度与表结构 构建语义层或指标层 诊断查询缓慢或数据错误

Install

npx skills add cbrock84/headcount --skill data-modeling -g -y
More Options

Non-standard path

npx skills add https://github.com/cbrock84/headcount/tree/main/plugins/data-analytics/skills/data-modeling -g -y

Use without installing

npx skills use cbrock84/headcount@data-modeling

指定 Agent (Claude Code)

npx skills add cbrock84/headcount --skill data-modeling -a claude-code -g -y

安装 repo 全部 skill

npx skills add cbrock84/headcount --all -g -y

预览 repo 内 skill

npx skills add cbrock84/headcount --list

SKILL.md

Frontmatter
{
    "name": "data-modeling",
    "description": "Designs the warehouse and semantic layer — source-to-mart structure, dimensional modeling, grain, slowly changing dimensions, and the metric layer analytics reads through. Use this to design or restructure a warehouse, model a new source, decide on grain or table structure, build a semantic or metric layer, or diagnose why queries are slow, wrong, or impossible to write."
}

Data modeling

Layers, and why the middle one matters

Three layers, each with one job:

  1. Raw — source data, append-only, otherwise unmodified. Do not apply business logic on ingest: you cannot recover what you discarded, and the logic will need to change retroactively.

    Privacy and security transformations are the exception, and belong at ingest. Credentials and secrets should never land in the warehouse at all. Personal data that is not needed should be dropped rather than stored and governed later, and identifiers you must keep but rarely need in the clear should be tokenized or encrypted on arrival. Retention and deletion apply from ingest, not from the marts.

    The distinction: strip what you must not hold, keep everything you are entitled to hold, and leave interpretation for later.

  2. Staging — cleaned and conformed: consistent types, standardized names, deduplicated, no business logic yet.

  3. Marts — business-facing models shaped for how questions are asked.

The discipline that pays is keeping business logic out of layers 1 and 2. Logic embedded in ingestion cannot be changed retroactively, and it will need to change.

Grain is the decision everything follows from

State the grain of every table in one sentence: one row per what. "One row per order line per day" is a grain. "Order data" is not.

Most modeling errors are grain errors, and they surface as fan-out — a join multiplying rows so every downstream sum is inflated. If a number is mysteriously too high, check the grain before checking the logic.

Dimensional structure

Facts for events and measurements; dimensions for the things being described. Keep facts narrow and long, dimensions wide and short.

Conform dimensions across facts — one customer dimension, used everywhere. Separate customer tables per domain is how the same customer gets counted differently in two reports.

Handle history deliberately. Overwriting a dimension attribute rewrites the past: last year's revenue silently re-attributes to this year's segment. Decide per attribute whether history matters, and where it does, keep versions with valid-from and valid-to.

The semantic layer

Define metrics once, above the marts, and have every consumer read through it. Without it, the same metric is reimplemented in each dashboard and they drift — not because anyone is careless, but because a filter differs.

The semantic layer is where the metric dictionary becomes executable rather than documentary.

Performance

Model for the query pattern you actually have. Pre-aggregate what is queried constantly; leave the long tail to compute on demand.

Partition and cluster on what people filter by — usually time, then a tenant or entity key. Most slow warehouse queries are full scans of a table that could have been partitioned by date.

Denormalize deliberately, and write down why. Undocumented denormalization is indistinguishable from a modeling error six months later.

Never

  • Build a mart directly on raw. The coupling means every source change breaks the business layer.
  • Mix grains in one table.
  • Let a dashboard contain business logic the warehouse does not. That logic is invisible and unversioned.

Version History

  • d58a7ee Current 2026-09-02 21:04

Same Skill Collection

plugins/corporate-strategy/skills/chief-strategy-officer/SKILL.md
plugins/corporate-strategy/skills/market-entry/SKILL.md
plugins/corporate-strategy/skills/mergers-and-acquisitions/SKILL.md
plugins/corporate-strategy/skills/portfolio-strategy/SKILL.md
plugins/corporate-strategy/skills/scenario-planning/SKILL.md
plugins/corporate-strategy/skills/strategic-alliances/SKILL.md
plugins/customer-experience/skills/chief-customer-officer/SKILL.md
plugins/customer-experience/skills/customer-onboarding-and-implementation/SKILL.md
plugins/customer-experience/skills/customer-success-management/SKILL.md
plugins/customer-experience/skills/escalation-management/SKILL.md
plugins/customer-experience/skills/self-service-and-knowledge/SKILL.md
plugins/customer-experience/skills/support-operations/SKILL.md
plugins/customer-experience/skills/voice-of-customer/SKILL.md
plugins/data-analytics/skills/ai-ml-governance/SKILL.md
plugins/data-analytics/skills/business-intelligence/SKILL.md
plugins/data-analytics/skills/chief-data-officer/SKILL.md
plugins/data-analytics/skills/data-engineering/SKILL.md
plugins/data-analytics/skills/data-governance/SKILL.md
plugins/demand-generation/skills/ai-search-optimization/SKILL.md
plugins/demand-generation/skills/app-store-optimization/SKILL.md
plugins/demand-generation/skills/experimentation/SKILL.md
plugins/demand-generation/skills/landing-page-cro-expert/SKILL.md
plugins/demand-generation/skills/lead-capture/SKILL.md
plugins/demand-generation/skills/lifecycle-messaging/SKILL.md
plugins/demand-generation/skills/listing-distribution/SKILL.md
plugins/demand-generation/skills/marketing-analytics/SKILL.md
plugins/demand-generation/skills/paid-advertising/SKILL.md
plugins/demand-generation/skills/programmatic-seo/SKILL.md
plugins/demand-generation/skills/seo-strategy/SKILL.md
plugins/executive/skills/ai-research-analyst/SKILL.md
plugins/executive/skills/business-growth-consultant/SKILL.md
plugins/executive/skills/chief-executive/SKILL.md
plugins/executive/skills/fundraising-and-investor-relations/SKILL.md
plugins/executive/skills/saas-idea-validator/SKILL.md
plugins/finance/skills/budgeting-and-forecasting/SKILL.md
plugins/finance/skills/capital-allocation/SKILL.md
plugins/finance/skills/capital-structure-and-covenants/SKILL.md
plugins/finance/skills/cost-accounting/SKILL.md
plugins/finance/skills/financial-modeling/SKILL.md
plugins/finance/skills/financial-reporting-and-close/SKILL.md
plugins/finance/skills/financial-statement-analysis/SKILL.md
plugins/finance/skills/internal-controls-and-audit/SKILL.md
plugins/finance/skills/revenue-recognition/SKILL.md
plugins/finance/skills/tax/SKILL.md
plugins/finance/skills/treasury-and-liquidity/SKILL.md
plugins/finance/skills/unit-economics/SKILL.md
plugins/it-operations/skills/backup-and-recovery/SKILL.md
plugins/it-operations/skills/chief-information-officer/SKILL.md
plugins/it-operations/skills/cloud-administration/SKILL.md

Metadata

Files
0
Version
d58a7ee
Hash
b0534bb8
Indexed
2026-09-02 21:04

trang chủ - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-02 22:04
浙ICP备14020137号-1 $bản đồ khách truy cập$