Install any skill in seconds. Free to start, no credit card required.
Get Started Free →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.
.claude/skills/mohitagw15856-metric-semantic-layer/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 17% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 27% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 18% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 58% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 41% | 0% |
"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).
Ask for these only if they aren't already provided:
[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.
Semantic-layer / metrics-layer practice (dbt MetricFlow, Cube, LookML) — single-source metric definitions with explicit grain, filters, and additivity.
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 16,611 | 14,788 | -11% | 1 | 1 | 0% | 3,134 | 3,663 | +17% | 0 | 0 | — |
case-02 | pass→pass | 17,926 | 15,327 | -14% | 1 | 1 | 0% | 3,601 | 3,707 | +3% | 0 | 0 | — |
case-03 | fail→pass | 14,872 | 15,639 | +5% | 1 | 1 | 0% | 3,056 | 3,886 | +27% | 0 | 0 | — |
case-04 | fail→pass | 20,122 | 19,689 | -2% | 1 | 1 | 0% | 3,971 | 4,668 | +18% | 0 | 0 | — |
case-05 | fail→fail | 14,024 | 13,972 | -0% | 1 | 1 | 0% | 2,734 | 3,565 | +30% | 0 | 0 | — |
case-06 | fail→pass | 18,858 | 21,419 | +14% | 1 | 1 | 0% | 2,038 | 3,217 | +58% | 0 | 0 | — |
case-07 | fail→pass | 13,121 | 16,384 | +25% | 1 | 1 | 0% | 2,550 | 3,583 | +41% | 0 | 0 | — |
case-13 | pass→pass | 12,648 | 14,633 | +16% | 1 | 1 | 0% | 2,428 | 3,699 | +52% | 0 | 0 | — |
case-08 | fail→pass | 21,451 | 14,756 | -31% | 1 | 1 | 0% | 3,095 | 3,654 | +18% | 0 | 0 | — |
case-09 | pass→pass | 18,623 | 19,324 | +4% | 1 | 1 | 0% | 3,200 | 4,530 | +42% | 0 | 0 | — |
case-10 | pass→pass | 16,352 | 23,461 | +43% | 1 | 1 | 0% | 3,331 | 4,173 | +25% | 0 | 0 | — |
case-11 | fail→fail | 12,939 | 14,209 | +10% | 1 | 1 | 0% | 2,676 | 3,233 | +21% | 0 | 0 | — |
case-12 | fail→pass | 11,854 | 10,981 | -7% | 1 | 1 | 0% | 2,621 | 3,230 | +23% | 0 | 0 | — |
case-14 | pass→pass | 9,627 | 12,905 | +34% | 1 | 1 | 0% | 2,044 | 3,459 | +69% | 0 | 0 | — |
case-15 | pass→pass | 12,053 | 14,469 | +20% | 1 | 1 | 0% | 2,601 | 3,920 | +51% | 0 | 0 | — |
case-16 | fail→pass | 14,692 | 14,522 | -1% | 1 | 1 | 0% | 3,022 | 3,547 | +17% | 0 | 0 | — |
case-17 | pass→pass | 13,008 | 12,269 | -6% | 1 | 1 | 0% | 2,466 | 3,104 | +26% | 0 | 0 | — |
case-18 | pass→pass | 11,761 | 12,882 | +10% | 1 | 1 | 0% | 2,223 | 3,156 | +42% | 0 | 0 | — |
case-19 | pass→pass | 12,615 | 14,604 | +16% | 1 | 1 | 0% | 2,396 | 3,660 | +53% | 0 | 0 | — |
case-20 | pass→pass | 9,412 | 12,145 | +29% | 1 | 1 | 0% | 1,995 | 3,260 | +63% | 0 | 0 | — |
case-21 | fail→fail | 11,036 | 4,617 | -58% | 1 | 1 | 0% | 2,233 | 1,643 | -26% | 0 | 0 | — |
case-22 | pass→pass | 10,764 | 9,531 | -11% | 1 | 1 | 0% | 2,261 | 2,746 | +21% | 0 | 0 | — |
case-23 | pass→pass | 12,156 | 12,549 | +3% | 1 | 1 | 0% | 2,829 | 3,615 | +28% | 0 | 0 | — |
case-24 | pass→pass | 13,069 | 9,825 | -25% | 1 | 1 | 0% | 3,006 | 2,988 | -1% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 24 cases were attempted. The headline lift of +33 percentage points is the difference between those two pass rates over the 24 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.