metabase-database-metadata
БесплатноБез исполняемых скриптовНе проверенUnderstands the Metabase Database Metadata Format — a YAML-based on-disk representation of databases, tables, and fields synced from a Metabase instance. Use…
от metabase★ 60 звёзд на GitHubОб этом скилле
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). 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 flatdatabases/tables/fieldsarrays. 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 thedatabasesarray.with-tables— include thetablesarray.with-fields— include thefieldsarray.
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):
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:
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.jsonand.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 tu
Установить metabase-database-metadata в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadEditGlobGrepBashAskUserQuestionВложенные файлы
FAQ
Что делает скилл metabase-database-metadata?
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.
Как установить скилл metabase-database-metadata?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл metabase-database-metadata запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic