Agent Skillsmohitagw15856/pm-claude-skills › metric-semantic-layer

metric-semantic-layer

GitHub

用于在语义层中统一定义指标,解决歧义。生成包含公式、粒度、维度、过滤条件和边缘情况的精确规范,并输出dbt/Cube/LookML格式代码,确保各工具数据一致。

skills/metric-semantic-layer/SKILL.md mohitagw15856/pm-claude-skills

Trigger Scenarios

定义指标 构建语义层/指标层条目 编写dbt MetricFlow / Cube / LookML指标定义

Install

npx skills add mohitagw15856/pm-claude-skills --skill metric-semantic-layer -g -y
More Options

Use without installing

npx skills use mohitagw15856/pm-claude-skills@metric-semantic-layer

指定 Agent (Claude Code)

npx skills add mohitagw15856/pm-claude-skills --skill metric-semantic-layer -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": "metric-semantic-layer",
    "description": "Define a metric in a semantic layer so it means one thing everywhere. Use when asked to define a metric, build a semantic layer \/ metrics layer entry, stop 'revenue means three things' problems, or write a metric definition for dbt MetricFlow \/ Cube \/ LookML. Produces a metric definition — exact formula, the base measure & aggregation, dimensions, filters, grain, edge cases, and a tool-ready spec."
}

Metric Semantic Layer Skill

"Active users" means three different things in three dashboards — that's the problem a semantic layer solves: define each metric once, precisely, and every tool reads the same definition. This skill writes that definition — the exact formula, base measure, allowed dimensions, default filters, and the edge cases that usually cause drift — in a tool-ready form (dbt MetricFlow / Cube / LookML).

Required Inputs

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

  • The metric — its name and the business question it answers.
  • The base data — the model/table and the column(s) it's computed from.
  • The aggregation — sum, count, count distinct, average, ratio.
  • Dimensions & filters — how it can be sliced, and any default filters (exclude test accounts, internal users, refunds).
  • Tool — dbt MetricFlow, Cube, LookML, or tool-agnostic.

Output Format

Metric: [metric_name]

1. Definition (plain English) — one sentence a non-analyst understands, and the precise version ("count of distinct user_ids with ≥1 qualifying event in the period, excluding internal/test accounts").

2. Formula — the exact calculation: base measure · aggregation · numerator/denominator (for ratios).

3. Grain & time — the time grain it's reported at, the date column it's anchored to, and how partial periods are handled.

4. Dimensions — the dimensions it can be sliced by (and any it must not be — non-additive metrics break when summed across the wrong dimension).

5. Default filters — what's always excluded (test/internal/refunds) so every consumer gets the same number.

6. Edge cases — null handling, late-arriving data, deduplication, currency/timezone, and additivity (can it be summed across days? across segments?). This section is where metric drift is prevented.

7. Tool-ready spec — the YAML/LookML for the chosen tool (MetricFlow metrics: / Cube measures: / LookML measure:), ready to commit.

Quality Checks

  • Has both a plain-English and an exact definition
  • States the base measure, aggregation, and (for ratios) numerator/denominator
  • Default filters are explicit, so every tool returns the same number
  • Additivity is addressed (which dimensions it can/can't be summed across)
  • Edge cases (nulls, dedup, timezone, late data) are handled
  • A tool-ready spec is provided, not just prose

Anti-Patterns

  • Do not leave the definition fuzzy — "active users" without the exact rule is how three dashboards disagree
  • Do not omit default filters — if one tool counts test accounts and another doesn't, the metric is broken
  • Do not ignore additivity — summing a non-additive metric (like a distinct count) across days gives a wrong number
  • Do not define metrics in BI tools instead of the semantic layer — that's how definitions fork
  • Do not skip timezone/null/dedup edge cases — they cause the subtle, hard-to-find discrepancies

Based On

Semantic-layer / metrics-layer practice (dbt MetricFlow, Cube, LookML) — single-source metric definitions with explicit grain, filters, and additivity.

Version History

  • a38bc30 Current 2026-07-05 11:38

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-hiring-panel/SKILL.md
exports/openclaw/agent-observability-spec/SKILL.md
exports/openclaw/agent-severance/SKILL.md
exports/openclaw/agent-spec/SKILL.md
exports/openclaw/agm-in-a-box/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/behavior-intervention-plan/SKILL.md
exports/openclaw/benefits-decoder/SKILL.md
exports/openclaw/bennett-time-audit/SKILL.md
exports/openclaw/bid-tender-review/SKILL.md
exports/openclaw/board-deck-narrative/SKILL.md
exports/openclaw/board-game-designer/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

Metadata

Files
0
Version
e4def4c
Hash
5f92afff
Indexed
2026-07-05 11:38

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