Tooluck logoTooluck
SKILL.md

metricflow_ingest

Agent skill fromKaelio/ktx

Map a MetricFlow semantic_model or metric into ktx semantic layer sources. Covers the MetricFlow to ktx primitive table, `extends:` inheritance flattening, metric-type handling (simple / derived / ratio / cumulative / conversion), `model: ref('x')` resolution, and four worked examples. Load when the turn contains `.yml`/`.yaml` files with top-level `semantic_models:` or `metrics:`.

How to install metricflow_ingest

install metricflow_ingest
# install the ktx pack with the skills CLI
npx skills add Kaelio/ktx

# or add only this skill to Claude Code: copy the folder

packages/cli/src/skills/metricflow_ingest/

# into

~/.claude/skills/metricflow_ingest/ (all projects)

.claude/skills/metricflow_ingest/ (one project)

packages/cli/src/skills/metricflow_ingest/SKILL.md

Apache-2.0Full file
1# MetricFlow to ktx Semantic Layer
2
3A MetricFlow `semantic_model` maps to an SL source; MetricFlow `measures` map to ktx measures; MetricFlow `entities` map to ktx `joins`; MetricFlow `metrics` (top-level) map to ktx measures OR to cross-model derived measures. Files in one WorkUnit are ALWAYS part of the same logical entity (a connected component, possibly spanning `extends:` + cross-model metric refs). Flatten inheritance and cross-file references at write time.
4
5## Mapping table
6
7| MetricFlow | ktx form | Notes |
8|---|---|---|
9| `semantic_model: X { model: ref('t') }` with measures + dimensions | **Overlay** named `X` with `measures`, computed-only `columns`, `column_overrides`, `joins` | The `model:` ref resolves to a manifest table. |
10| `semantic_model: X { model: source('s','t') }` | **Overlay** named `X` over table `t`. | Same shape; `source()` still resolves to a physical table. |
11| `semantic_model: X { model: <literal> }` with no manifest entry | **Standalone** with explicit `sql:`, `grain:`, `columns:` | Happens when the dbt manifest isn't available. |
12| `semantic_model: Y { extends: X }` | **Merge** Y's measures/dimensions/entities into X's overlay, or write a single overlay named for the most-derived child (Y) containing both X's and Y's primitives | Do not emit a second overlay for X - flatten. |
13| `measures: [{ name, agg, expr }]` | `measures: [{ name, expr: "<agg>(<expr>)" }]` | Aggregation inlined. `agg: count_distinct` → `count(distinct ...)`. |
14…

Excerpt shown under the repository's Apache-2.0 license.

More skills in ktx

Newsletter

Join the Community

Subscribe to our newsletter for the latest news and updates