skills/metabase-semantic-checker/SKILL.md
Runs the Metabase semantic checker against a tree of Representation Format YAML files to verify that all references resolve — cross-entity references (collection_id, dashboard_id, parent_id, parameter source cards, snippet references, transform tags, etc.) and references to columns inside MBQL and native queries. Slow (≥1 min per run). Only use when the user explicitly asks to verify entity references or column references in MBQL/SQL queries; in most cases this runs as a CI step, not locally. Requires database metadata on disk (by default `.metadata/table_metadata.json`).
npx skillsauth add metabase/agent-skills metabase-semantic-checkerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
The semantic checker validates a tree of Metabase Representation Format YAML files for referential integrity. Schema-level validation (shape of each file, required fields, enum values) is handled separately by npx @metabase/representations validate-schema; the semantic checker runs after schema validation and focuses on cross-file and cross-system consistency.
It compiles every MBQL query down to SQL against the database metadata and checks that each entity reference and each column reference resolves to something that actually exists. Concretely, it answers:
collection_id, parent_id, dashboard_id, document_id, based_on_card_id, transform tag, snippet name, etc. resolve to an entity that actually exists in the tree?source-table, field reference, join target, segment, measure, and expression resolve against the database schema? (Verified by compiling the query to SQL.)Each run takes 1 minute or more — roughly a minute of fixed JVM + metadata-loading overhead before any checks start, plus query-compilation time that scales with the tree.
The checker ships inside the Metabase Enterprise JAR and is invoked via --mode checker. Default Docker image: metabase/metabase-enterprise:latest. Use metabase/metabase-enterprise-head:latest only when the user explicitly wants the in-development build — e.g. testing unreleased checker changes.
Two inputs, both required:
collections/, databases/, transforms/, python_libraries/. This is what gets checked..metadata/table_metadata.json. The checker uses it to resolve column/table references inside queries; without it, query-level checks cannot run.If .metadata/table_metadata.json is missing, do not run the checker. Tell the user it needs to be exported from their Metabase instance first, and only run the checker once the metadata file is present on disk.
Do not run the semantic checker by default when making edits. It is slow (≥1 minute per run) and in most projects is wired up as a CI step that runs on every push or PR — that is where it belongs. Local runs are for targeted diagnosis, not routine validation.
Only run it locally when the user explicitly asks for one of these:
Phrasings that count as an explicit ask: "semantic check", "check references", "validate queries against the schema", "make sure the columns still exist", or diagnosing a broken reference the user already suspects. A bare "run the checker" does not count — by default "the checker" means the fast schema checker (npx @metabase/representations validate-schema). Only wording that explicitly names references or queries should trigger the semantic checker.
Otherwise, skip it. After editing YAML, rely on npx @metabase/representations validate-schema for local feedback and leave the semantic check to CI. Do not run it proactively at session start, and do not run it as a self-imposed "finishing step" after edits unless the user asked for it.
If you do run it, batch. Make all the YAML changes first, then run the checker once. Each invocation pays the ≥1-minute fixed overhead; running between edits multiplies that cost. If it surfaces issues, fix everything you can see in one pass before re-running.
Once .metadata/table_metadata.json exists and Docker is available:
docker pull metabase/metabase-enterprise:latest
docker run --rm \
-v "$PWD:/workspace" \
--entrypoint "" \
-w /app \
metabase/metabase-enterprise:latest \
java -jar metabase.jar \
--mode checker \
--export /workspace \
--schema-dir /workspace/.metadata/table_metadata.json \
--schema-format concise
Flag reference:
--mode checker — selects semantic-check mode (skips server startup, import, etc.).--export /workspace — path inside the container to the representation tree root. With the -v "$PWD:/workspace" mount above, this maps to the current repo root on the host.--schema-dir /workspace/.metadata/table_metadata.json — path to the database metadata JSON. Despite the -dir suffix the flag accepts a single JSON file. Point it elsewhere only if the user has stored metadata at a non-default path.--schema-format concise — format the input metadata is in. concise matches what a Metabase instance exports. Do not change unless the user explicitly has a different dump format.The container needs no network access for the check itself — pull the image first if the host is offline-prone.
Exit code is non-zero on findings. Surface the checker's stdout/stderr verbatim to the user; do not summarize away specific paths or entity names, since those are how the user locates the broken reference.
.metadata/table_metadata.json is missing, stale, or malformed. Ask the user to re-export it from their Metabase instance.entity_id or name does not exist in the tree. Either the target YAML is missing, or the reference is a typo; grep the tree for the id/name to confirm which.docker pull metabase/metabase-enterprise:latest first. On slow networks warn the user; the image is multi-hundred-MB.tools
Drive a Metabase instance from the terminal via the `mb` CLI. Authenticate with named profiles; inspect databases (list, get, full metadata rollup, schemas, tables in a schema) and trigger manual schema sync / field-values rescan; inspect tables, fields; list/get/create/update/archive cards (questions, models, metrics) and run them as JSON/CSV/XLSX; list/get/create/update dashboards and patch dashcards; list/get/create collections and traverse the hierarchy by id, entity_id, or "root"/"trash" (with items and recursive tree); list/get/create/update/archive native query snippets, segments, and measures; author/update/run transforms and schedule transform-jobs; read/update settings; search content (cards, dashboards, collections, transforms, metrics); manage Enterprise workspaces; git-sync to/from a git remote (status, dirty, import, export, branches, stash, add/remove a collection from sync). Use whenever the user wants to interact with a Metabase from the terminal — "log into metabase", "what profiles do I have", "list cards", "run card 42 as CSV", "create a transform", "list dashboards", "move a dashcard", "list collections", "what's in collection 4", "show the collection tree", "list snippets", "create a segment", "archive a measure", "search metabase for X", "spin up a workspace", "import the latest changes", "add a directory to git sync", "set a setting", "what schemas are in this database", "trigger a sync", "rescan field values", or anything hitting `mb <verb>`.
development
Understands the Metabase Database Metadata Format — a YAML-based on-disk representation of databases, tables, and fields synced from a Metabase instance. Use when the user needs to read, edit, or understand metadata files produced by `@metabase/database-metadata`, or when reasoning about a project's schema (columns, types, FK relationships) through the `.metadata/databases` folder.
development
Understands the Metabase Representation Format — a YAML-based serialization format for Metabase content (collections, cards, dashboards, documents, segments, measures, snippets, transforms). Use when the user needs to create, edit, understand, or validate Metabase representation YAML files, or when working with Metabase serialization/deserialization (serdes). Covers entity schemas, MBQL and native queries, visualization settings, parameters, and folder structure.
development
Migrates a project from Metabase static embedding to guest embeds (web components via embed.js). Use when the user wants to migrate/convert/switch/upgrade from static embedding to guest embeds, from signed embed iframes to web components, or replace /embed/ iframes with metabase-dashboard/metabase-question components.