# Metricflow Ingest

Map a MetricFlow semantic_model or metric into ktx semantic layer sources.

- Repository: https://github.com/Kaelio/ktx (1627 stars)
- Category: Engineering
- License: Apache-2.0
- Last updated: 2026-10-22
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add Kaelio/ktx --skill metricflow_ingest -g -a claude-code -y`
Codex: `npx skills add Kaelio/ktx --skill metricflow_ingest -g -a codex -y`
Cursor: `npx skills add Kaelio/ktx --skill metricflow_ingest -g -a cursor -y`
Gemini CLI: `npx skills add Kaelio/ktx --skill metricflow_ingest -g -a gemini-cli -y`

## Description

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:`.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# MetricFlow to ktx Semantic Layer

A 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.

## Mapping table

The rest: https://github.com/Kaelio/ktx/blob/HEAD/packages/cli/src/skills/metricflow_ingest/SKILL.md
