Agent skill · Frontend

metabase_ingest

Convert Metabase questions, models, and metrics into ktx Semantic Layer source definitions. Covers result-metadata to KSL column type mapping, FK/PK detection, near-duplicate deduplication, pre-aggregation decomposition, join-graph connectivity, and how to react to priorProvenance from earlier ingest syncs. Load when the WorkUnit contains `cards/<id>.json` files under a Metabase bundle.

Kaeliogithub.com/KaelioGitHub ↗
claude-codecodexApache-2.0
Install
npx skills add Kaelio/ktx --skill metabase_ingest --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 19 KB
Bundled scripts: none
Path: packages/cli/src/skills/metabase_ingest/SKILL.md
Open the folder on GitHub →
Where it comes from
Source: Kaelio/ktx
Stars: 1,526 · +15 this week
Language: TypeScript
Read our review of the source →

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

Review
written from the skill's own SKILL.md · Aug 5, 2026

What it does

Transforms Metabase collection cards into ktx Semantic Layer source definitions. Uses cards/<id>.json data to build sources, mapping resultMetadata base_type to KSL types, identifying PK/FK candidates, time columns, and applying deduplication and pre-aggregation rules. Reacts to priorProvenance guidance when provided. Ingests only when WorkUnit contains cards/<id>.json files under a Metabase bundle. Uses parameters and resultMetadata fields to drive mapping and join discovery, and enforces verification steps before writing any schema.table.column entries.

How it works

  • Each WorkUnit represents one Metabase collection's cards for one database; every cards/<id>.json includes resolvedSql, resultMetadata, and related metadata.
  • Map each resultMetadata entry to a KSL type: Integer/Float/Decimal/BigInteger → number; Text/TextLike → string; DateTime/Date/DateTimeWithTZ → time; Boolean → boolean. Identify grain candidates via semantic_type: type/PK and join candidates via semantic_type: type/FK with fk_target_field_id. Identify time columns via semantic_type: type/CreationTimestamp or type/UpdatedTimestamp and set role: time. Use display_name for measure descriptions when available.
  • Use parameters to guide SQL translation steps if SQL resolution fell back and to drop optional clauses for Step A of translation.
  • Use lastRunAt and dashboardCount to assess staleness and skip signals.
  • Before writing, verify identifiers with entity_details and, if needed, perform sql_execution probes to confirm column resolution and values.
  • For each card, perform decision tree steps: determine base tables/joins, call sl_discover for candidate targets, decide whether to edit existing sources or write new ones, and include rawPaths: ["cards/<id>.json"] on write/edit calls. When dealing with manifest-only names, bootstrap an overlay first with sl_write_source and add measures, then use sl_edit_source for tweaks. Ensure proper join usage and avoid incorrect joins (FK to non-key display values).
  • Apply priorProvenance guidance to prefer edits over new writes when appropriate, and to avoid duplicating existing work.

When to use it

Use when ingesting a Metabase bundle where the WorkUnit includes cards/<id>.json files; triggers include the presence of such files in the Metabase bundle and the need to convert Metabase card metadata into ktx Semantic Layer sources with proper mappings and joins.

What it can touch

  • Commands and tools named: sla_discover, sl_read_source, sl_write_source, sl_edit_source, sql_execution, read_raw_file. It references the file path pattern cards/<id>.json. It uses the mapping rules described in resultMetadata to derive KSL column types and roles.

Caveats

  • License: Apache-2.0
  • Declared tools: claude-code, codex
  • Behavior depends on presence of priorProvenance to guide edits vs writes; may skip cards if non-trivial business logic cannot be translated reliably.
  • Requires verification steps before emitting schema.table.column into wiki or SL sources; may require overlay creation for manifest-backed names to avoid shadowing manifest schema.
  • If a card is determined to be a near-duplicate, a generalized source is created and others are marked skipped.
From the SKILL.md

# Metabase to ktx Semantic Layer Each WorkUnit represents one Metabase collection's cards for one Metabase database (mapped to exactly one ktx connection). Every `cards/<id>.json` file carries the resolved SQL, result_metadata, card type, collection path, and referenced-card ids. The WU's `sync-config.json` tells you which sync mode is active and which selections apply. `databases/<id>.json` tells you the target ktx connection. ## Context format Each card JSON looks like: ```json { "metabaseId": 7, "name": "Daily orders", "description": "Orders by day", "type": "model", "databaseId": 42, "collectionId": 5, "resolvedSql": "SELECT ...", "templateTags": [{"name": "ref", "type": "card", "cardReference": 10}], "resultMetadata": [ {"name": "day", "base_type": "type/DateTime", "semantic_type": "type/CreationTimestamp"}, {"name": "order_count", "base_type": "type/Integer"} ], "collectionPath": ["Data", "Orders Team"], "referencedCardIds": [10] } ``` Use `resultMetadata` to: - Map `base_type` to KSL column type: `type/Integer`, `type/Float`, `type/Decimal`, `type/BigInteger` → `number`; `type/Text`, `type/TextLike` → `string`; `type/DateTime`, `type/Date`, `type/DateTimeWithTZ` → `time`; `t

What's inside
Steps it walks through
  1. Context format
  2. Additional card metadata
  3. Identifier Verification Protocol
  4. Decision tree
  5. priorProvenance
  6. Deduplication
  7. Pre-aggregation decomposition
  8. SQL translation from raw native to KSL
  9. Step A - Handle dummy-substituted placeholders (resolved cards only)
  10. Step B - Inline {{#N}} references (fallback cards only)
  11. Step C - Inlining cleanup checklist
  12. Join-graph connectivity
  13. Cross-card references ({{#N}})
  14. Provenance markers
More from ktx
All skills →
About this skill
What does the metabase_ingest skill do?

Convert Metabase questions, models, and metrics into ktx Semantic Layer source definitions. Covers result-metadata to KSL column type mapping, FK/PK detection, near-duplicate deduplication, pre-aggregation decomposition, join-graph connectivity, and how to react to priorProvenance from earlier ingest syncs. Load when the WorkUnit contains `cards/<id>.json` files under a Metabase bundle.

How do I install it?

Run `npx skills add Kaelio/ktx --skill metabase_ingest --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.

Where does this skill come from?

From Kaelio/ktx, a repository with 1,526 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.

Is a popular skill a good skill?

Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.

Keep going