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

metabase-database-metadata — скилл для Claude Code: схема из Metabase

Скилл читает YAML-дерево метаданных Metabase и отвечает по схеме проекта: колонки, типы, внешние ключи. Пригодится, когда агент пишет запросы к таблицам.

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

Что делает metabase-database-metadata

Скилл объясняет агенту формат Metabase Database Metadata — YAML-дерево баз, таблиц и полей, выгруженное из инстанса Metabase. Вся схема проекта лежит в .metadata/databases/, и агент читает её вместо того, чтобы гадать по именам таблиц. Файлы сделаны diff-friendly: числовые ID выброшены, внешние ключи записаны кортежами вроде ["Sample Database", "PUBLIC", "ORDERS"].

Рядом лежит .metadata/table_metadata.json — сырой JSON из Metabase, который может весить гигабайты. Скилл прямо запрещает его открывать, грепать и скармливать инструментам: файл нужен только как вход для экстрактора. Поэтому .metadata/ стоит держать в .gitignore, иначе репозиторий раздуется. Перед правкой .gitignore скилл просит подтверждение у пользователя.

Для первой выгрузки нужны URL инстанса и API-ключ, например через METABASE_URL и METABASE_API_KEY. Метаданные тянутся вызовом POST /api/ee/serialization/metadata/export с параметрами with-databases, with-tables и with-fields — по умолчанию они false, так что включать нужные секции надо явно. Дальше npx @metabase/database-metadata extract-table-metadata превращает JSON в YAML-дерево. В начале сессии скилл ничего не качает: если дерево на диске есть, он просто им пользуется. Обновление запускается только по просьбе пользователя. Спецификация формата лежит рядом в spec.md.

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

  • понять схему таблиц перед написанием SQL-запроса
  • найти внешние ключи между таблицами без ручного разбора JSON
  • выгрузить метаданные Metabase в читаемое YAML-дерево
  • объяснить агенту, какие колонки и типы есть в проекте
  • обновить устаревшую схему после изменений в базе

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

  • Посмотри в .metadata/databases/ и скажи, какие таблицы есть в базе ORDERS
  • Напиши запрос к таблице ORDERS — схему возьми из метаданных Metabase
  • Обнови метаданные из Metabase и покажи, что изменилось в схеме

Как установить metabase-database-metadata

1Через Skills CLI (Vercel)

npx skills add metabase/agent-skills --skill metabase-database-metadata -a claude-code

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

~/.claude/skills/metabase-database-metadata/SKILL.md

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

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

Вопросы о metabase-database-metadata

Как установить metabase-database-metadata в Claude?

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

Что делает metabase-database-metadata?

Учит агента читать YAML-дерево метаданных Metabase: базы, таблицы, поля, типы и связи по внешним ключам. Агент берёт схему из .metadata/databases/, а не угадывает её.

Что нужно, чтобы выгрузить метаданные?

URL инстанса Metabase и API-ключ — скилл ждёт их, например, в METABASE_URL и METABASE_API_KEY. Без них он попросит креды до вызова экспорта.

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

SKILL.md · MIT
---
name: metabase-database-metadata
description: 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.
model: opus
allowed-tools: Read, Edit, Glob, Grep, Bash, AskUserQuestion
---

## Metabase Database Metadata Format

Metabase represents database metadata — synced databases, their tables, and their fields — as a tree of YAML files. Files are **diff-friendly**: numeric IDs are omitted entirely, and foreign keys use natural-key tuples like `["Sample Database", "PUBLIC", "ORDERS"]` instead of database identifiers.

The format is defined by a specification bundled alongside this file as `spec.md` (upstream source: [metabase/database-metadata](https://github.com/metabase/database-metadata)). The same project ships a CLI (`@metabase/database-metadata` on npm) that converts the raw JSON exported from a Metabase instance into the YAML tree described by the spec.

## Canonical layout

All metadata for a project lives under a top-level `.metadata/` directory:

- **`.metadata/databases/`** — the YAML tree. **This is the canonical source for the agent.** Read these files to understand the schema, columns, types, and FK relationships.
- **`.metadata/table_metadata.json`** — the raw JSON exported from the Metabase instance. Potentially multi-megabyte (or multi-gigabyte) JSON with flat `databases` / `tables` / `fields` arrays. **Never open, grep, or pass it to tools.** It exists only as input to the extractor.

The `.metadata/` directory should be gitignored. On large warehouses the extracted metadata can reach gigabytes — committing it would make the repo painful or unusable.

## First-time setup

Do not run any of the steps below proactively at session start. Only run them when the user **explicitly asks** to fetch metadata, set up the workflow, or requests something that plainly requires knowledge of the database schema (e.g. "write a query against ORDERS", "describe what tables exist").

When setup is triggered:

### 1. Ensure `.metadata/` is gitignored

Read the repo's `.gitignore` and confirm `.metadata/` is listed. If it isn't, **ask the user before modifying `.gitignore`** — e.g.:

> `.metadata/` is not in `.gitignore`. Committing it would bloat the repo (metadata can be gigabytes). Shall I add it?

Only edit `.gitignore` after the user confirms.

### 2. Export the metadata from Metabase

Fetch `table_metadata.json` by calling `POST /api/ee/serialization/metadata/export` on the Metabase instance and writing the response to `.metadata/table_metadata.json`. The endpoint accepts three boolean query parameters that opt sections in or out — they all default to `false`, so requests must explicitly set the sections they want:

- `with-databases` — include the `databases` array.
- `with-tables` — include the `tables` array.
- `with-fields` — include the `fields` array.

A typical full export sets all three to `true`. The user supplies the base URL and an API key (e.g. via `METABASE_URL` and `METABASE_API_KEY` env vars):

```sh
mkdir -p .metadata
curl -sf -X POST "$METABASE_URL/api/ee/serialization/metadata/export?with-databases=true&with-tables=true&with-fields=true" \
  -H "X-API-Key: $METABASE_API_KEY" \
  -o .metadata/table_metadata.json
```

If the user has not provided credentials, ask for them before running the call.

### 3. Extract

Once `.metadata/table_metadata.json` is in place:

```sh
rm -rf .metadata/databases
npx @metabase/database-metadata extract-table-metadata .metadata/table_metadata.json .metadata/databases
```

Then read the YAML tree under `.metadata/databases/` to answer the user's question.

## Session start behaviour

At the start of a session, do not run any fetch commands. Just observe what's on disk:

- If `.metadata/table_metadata.json` **and** `.metadata/databases/` both exist, **assume the tree is sufficiently up to date** and use it directly. Do not refetch.
- If the tree is missing or only partial, do nothing until the user asks for something that needs it — then fall into the first-time-setup flow above.

If something in the tree looks stale or inconsistent while you're using it, mention it to the user and let them decide whether to refetch. Never refresh silently.

## Refreshing (user-initiated only)

If the user explicitly asks to refresh metadata, re-run the export call to overwrite `.metadata/table_metadata.json`, then re-run the extract step. Always remove `.metadata/databases` before re-extracting so stale files are not left behind.

## Entities

Three entity types, two file types:

| Entity | File | Description |
|--------|------|-------------|
| **Database** | `.metadata/databases/{db}/{db}.yaml` | A connected data source (Postgres, MySQL, BigQuery, etc.). Identified by name. |
| **Table** | `.metadata/databases/{db}/schemas/{schema}/tables/{table}.yaml` (or `.../tables/{table}.yaml` for schemaless DBs) | A physical table or view. Contains a `fields` array with all its columns nested inline. |
| **Field** | (nested inside a Table YAML, no separate file) | A column. Includes `base_type`, `database_type`, and optionally `effective_type`, `semantic_type`, `coercion_strategy`, `parent_id`, `fk_target_field_id`. |

## Foreign keys

Foreign keys use natural-key tuples, not numeric IDs:

- **Database FK**: the database name (string) — e.g. `"Sample Database"`
- **Table FK**: `[database, schema_or_null, table]` — e.g. `["Sample Database", "PUBLIC", "ORDERS"]`
- **Field FK**: `[database, schema_or_null, table, field, ...nested_field_names]` — e.g. `["Sample Database", "PUBLIC", "EVENTS", "DATA", "user", "name"]` for a JSON-unfolded column `DATA.user.name`

Field-level FKs show up as `parent_id` (nested field parent) and `fk_target_field_id` (referenced PK for FK columns).

## Type attributes on fields

- **`database_type`** — the raw native type string from the driver (`BIGINT`, `VARCHAR`, `JSONB`, etc.). Database-specific.
- **`base_type`** — the Metabase type matching the native type (`type/BigInteger`, `type/Text`, `type/Structured`, etc.).
- **`effective_type`** — the type Metabase treats the column as at query time. Only emitted when it differs from `base_type` (i.e. coercion is configured).
- **`coercion_strategy`** — the rule producing `effective_type` from `base_type` (e.g. `Coercion/ISO8601->DateTime`, `Coercion/UNIXMilliSeconds->DateTime`).
- **`semantic_type`** — business-domain label (`type/PK`, `type/FK`, `type/Email`, `type/Category`, `type/Latitude`, etc.). Drives UI and some analytical behavior.

See the bundled spec for the full type hierarchy and available coercion strategies.

## Reading the spec

This skill ships with a local snapshot of the spec as `spec.md`, alongside `SKILL.md`.

**Read it on demand, not eagerly.** Open `spec.md` only when you actually need detail beyond what `SKILL.md` summarizes — e.g. the full base-type / semantic-type hierarchy, the complete list of coercion strategies, or the exact folder-path rules. Do not open it at session start, and do not open it for tasks unrelated to the metadata tree.

If the bundled copy looks out of date with the upstream package, the skill's own `README.md` documents how to refresh it with `extract-spec`.

© metabase · MIT · metabase/agent-skills

Похожие скиллы

Все скиллы по теме «Данные и базы» →
specsfy-aux-database promovaweb Ведёт .specsfy/DATABASE.md с таблицами баз, схем, полей, связей и миграций, чтобы карта данных не расходилась с кодом. CX Codex +1 437установок database-schema alinaqi Скилл заставляет агента прочитать схему базы и проверить колонки с типами до того, как он напишет запрос или миграцию. CX Codex +1 302установок database-designer Alireza Rezvani Помогает проектировать схемы БД, анализировать индексы и готовить миграции. Подойдёт, когда нужно проверить структуру или изменить её без резкого переключения приложения. 819установок nosql-database-design aj-geddes Помогает агенту проектировать коллекции MongoDB и таблицы DynamoDB: вложенные документы, индексы, денормализация. Пригодится, когда схему надо решить до кода. CX Codex +1 486установок convex-migrate convex Скилл проводит миграцию схемы и бэкфилл данных в развёрнутом приложении Convex через @convex-dev/migrations. Пригодится, когда меняешь схему на живом приложении. CX Codex +1 36 100установок convex-explain-app convex Скилл строит понятную карту бэкенда Convex по схеме данных и функциям. Помогает быстро разобраться в незнакомом проекте перед правками или аудитом. CX Codex +1 35 900установок

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

metabase-representation-format Скилл объясняет YAML-формат сериализации Metabase: коллекции, карточки, дашборды, сегменты, меры, трансформы и data apps. Пригодится, когда агент правит или проверяет такие файлы. CX Codex +1 529установок metabase-semantic-checker Прогоняет семантический чекер Metabase по дереву YAML-файлов Representation Format и проверяет, что все ссылки на сущности и колонки разрешаются. Нужен, когда подозреваете битую ссылку. CX Codex +1 429установок 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установок

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

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