К основному содержанию
скилл CX Codex

metabase-semantic-checker — скилл для Claude Code: проверка ссылок

Прогоняет семантический чекер Metabase по дереву YAML-файлов Representation Format и проверяет, что все ссылки на сущности и колонки разрешаются. Нужен, когда подозреваете битую ссылку.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add metabase/agent-skills --skill metabase-semantic-checker -a claude-code
Открыть на GitHub

Что делает metabase-semantic-checker

Скилл запускает семантический чекер Metabase поверх дерева YAML-файлов Representation Format. Он компилирует каждый MBQL-запрос в SQL по метаданным базы и смотрит, что каждая ссылка указывает на то, что реально существует: collection_id, parent_id, dashboard_id, document_id, based_on_card_id, теги трансформов, имена сниппетов. Для нативных запросов проверяет таблицы, колонки и сниппеты.

Внутри — вызов java -jar metabase.jar --mode checker в Docker-образе metabase/metabase-enterprise:latest. Скиллу нужны две вещи: само дерево репозитория с collections/, databases/, transforms/, python_libraries/ и файл метаданных базы, по умолчанию .metadata/table_metadata.json. Без этого файла чекер не запустится, его придётся сначала выгрузить из инстанса Metabase. Один прогон занимает минуту и больше: около минуты уходит на старт JVM и загрузку метаданных ещё до первых проверок, дальше время растёт с размером дерева.

Автор скилла прямо просит не гонять чекер после каждой правки. В большинстве проектов он подключён шагом CI на push или PR, и там ему и место. Локальный запуск — для точечной диагностики, когда вы явно просите проверить ссылки или колонки в MBQL и SQL. Если всё же запускаете, сначала сделайте все правки в YAML, а потом один прогон: фиксированные накладные расходы умножаются на число запусков. Для быстрой локальной проверки схемы есть npx @metabase/representations validate-schema.

Какие задачи решает

  • найти ссылку на коллекцию или карточку, которой больше нет в дереве
  • проверить, что колонки в MBQL-запросах ещё существуют в схеме
  • отловить битый parent_id или dashboard_id до пуша
  • убедиться, что нативные SQL-запросы ссылаются на реальные таблицы и сниппеты
  • разобраться, почему дашборд ссылается на несуществующую карточку

Примеры запросов агенту

  • проверь семантику: все ли ссылки на сущности разрешаются в дереве
  • сделай семантическую проверку колонок в MBQL и SQL запросах
  • убедись, что колонки в запросах всё ещё существуют в схеме

Как установить metabase-semantic-checker

1Через Skills CLI (Vercel)

npx skills add metabase/agent-skills --skill metabase-semantic-checker -a claude-code

2Вручную: положить файлы

~/.claude/skills/metabase-semantic-checker/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/metabase-semantic-checker/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Из того же набора7

metabase-database-metadata Скилл читает YAML-дерево метаданных Metabase и отвечает по схеме проекта: колонки, типы, внешние ключи. Пригодится, когда агент пишет запросы к таблицам. CX Codex +1 560установок metabase-representation-format Скилл объясняет YAML-формат сериализации Metabase: коллекции, карточки, дашборды, сегменты, меры, трансформы и data apps. Пригодится, когда агент правит или проверяет такие файлы. CX Codex +1 529установок metabase-embedding-sso-implementation Скилл проводит агента по шагам внедрения JWT SSO в вашу встройку Metabase: эндпоинт подписи токена, фронтенд-авторизация, маппинг групп. CX Codex +1 363установок metabase-react-sdk-setup Скилл проводит агента через первичную настройку Metabase React SDK: определение инстанса, API-ключ, поиск дашбордов, JWT-аутентификация и установка пакета. CX Codex +1 362установок metabase-static-embedding-to-guest-embedding-upgrade Переводит проект с подписанных iframe Metabase на guest embeds через веб-компоненты и embed.js. Пригодится, когда надо заменить /embed/ на <metabase-dashboard> и <metabase-question>. CX Codex +1 355установок metabase-learning Ведёт вас по курсу Metabase из 9 занятий с интервальными повторениями. Пригодится, если учите BI-инструмент и хотите структуру, а не случайные статьи. CX Codex +1 324установок

Похожие

circleci devops-skills Помогает настроить пайплайны CI/CD для CircleCI в файле .circleci/config.yml. Пригодится для сборки, тестов, кэширования и развёртывания проектов. CX Codex +1 323установок gitlab-cicd-pipeline aj-geddes Скилл помогает агенту писать .gitlab-ci.yml: стадии, джобы, кэш, артефакты, деплой в Kubernetes. Пригодится, когда пайплайн надо собрать с нуля или переделать. CX Codex +1 664установок github-actions-workflow aj-geddes Скилл для сборки GitHub Actions: тесты, сборка, сканирование безопасности и деплой прямо из репозитория. CX Codex +1 620установок github-actions-templates Seth Hobson Скилл создаёт GitHub Actions для тестирования, сборки и деплоя. Подойдёт, когда в проекте нужно настроить CI/CD или reusable workflows. CX Codex 17 420установок gitlab-ci-patterns Seth Hobson Скилл помогает собирать GitLab CI/CD-пайплайны со стадиями, кэшем и деплоем. Подойдёт для тестирования, сборки и доставки приложений. CX Codex 13 112установок ci-cd-best-practices Mindrally Скилл задаёт правила построения CI/CD-конвейеров, стратегий развёртывания и тестов. Пригодится при настройке автоматической доставки кода через GitLab CI, GitHub Actions или Kubernetes. CX Codex +1 1 200установок

Рядом в теме «Данные и базы»

Все скиллы по теме «Данные и базы» →

Вопросы о metabase-semantic-checker

Как установить metabase-semantic-checker в Claude?

Выполните npx skills add metabase/agent-skills --skill metabase-semantic-checker -a claude-code. Скилл появится в ~/.claude/skills/metabase-semantic-checker/SKILL.md.

Что делает metabase-semantic-checker?

Запускает семантический чекер Metabase по дереву YAML-файлов Representation Format. Проверяет, что ссылки на сущности и колонки в MBQL и нативных запросах разрешаются.

Что нужно, чтобы чекер заработал?

Файл метаданных базы, по умолчанию .metadata/table_metadata.json, выгруженный из инстанса Metabase, и Docker с образом metabase/metabase-enterprise:latest. Без метаданных проверки на уровне запросов не выполняются.

Исходный текст

SKILL.md · MIT
---
name: metabase-semantic-checker
description: 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`).
model: opus
allowed-tools: Read, Glob, Grep, Bash, AskUserQuestion
---

## Metabase semantic checker

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:

- Does every `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?
- For each MBQL query, do every `source-table`, field reference, join target, segment, measure, and expression resolve against the database schema? (Verified by compiling the query to SQL.)
- For each native query, do the referenced tables, columns, and snippets exist?
- Do dashboards' and documents' embedded card references point at real cards?

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.

## Inputs

Two inputs, both required:

- **The representation tree** — the repo root containing `collections/`, `databases/`, `transforms/`, `python_libraries/`. This is what gets checked.
- **The database metadata** — a JSON file exported from a Metabase instance. **By default located at `.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.

## When to run

**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:

- verify that all entity references resolve (collections, dashboards, cards, snippets, transform tags, etc.), or
- verify that all column references in queries — MBQL or SQL — are correct.

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.

## Running the checker

Once `.metadata/table_metadata.json` exists and Docker is available:

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

## Common failure modes

- **"Database metadata not found" / schema load errors** — `.metadata/table_metadata.json` is missing, stale, or malformed. Ask the user to re-export it from their Metabase instance.
- **Unknown collection / card / dashboard / snippet / tag reference** — the referenced `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.
- **Unknown table or field inside a query** — the query references a column that the database metadata doesn't know about. Either the warehouse schema has drifted (refetch metadata), or the query itself is wrong.
- **Docker image missing / not pulled** — run `docker pull metabase/metabase-enterprise:latest` first. On slow networks warn the user; the image is multi-hundred-MB.

© metabase · MIT · metabase/agent-skills

Смотрите также

Спонсоры проекта

Компании, которые помогают держать аналитику открытой