metabase/agent-skills

metabase-representation-format

Understands the Metabase Representation Format — a YAML-based serialization format for Metabase content (collections, cards, dashboards, documents, segments, measures, snippets, transforms).

ソースを見る
リポジトリの原文

見出し、例、コード、表、リンク、参照画像を含む原文を表示しています。

Metabase Representation Format

Metabase represents user-created content as a tree of YAML files. Each file is one entity (a collection, card, dashboard, etc.). The format is portable across Metabase instances: numeric database IDs are replaced with human-readable names and entity IDs.

The format is defined by a spec bundled alongside this file as spec.md (upstream source: the @metabase/representations npm package). The same package ships a CLI (npx @metabase/representations validate-schema) that validates a tree of YAML files against the format.

Entities

The format defines 11 entity types.

EntitySerDes ModelDescription
CollectionCollectionFolder-like container for organizing content. Hierarchy via parent_id. Namespaces: null (main), "snippets", "transforms".
CardCardQuestion, model, or metric. Holds an MBQL or native dataset_query. Display types: table, bar, line, pie, scalar, etc. Card types: "question", "model", "metric".
DashboardDashboardGrid layout (24 columns) of cards with filter parameters and optional tabs. Contains dashcards array for card placement and parameters array for filter controls.
DocumentDocumentRich text page using ProseMirror AST. Can embed cards via cardEmbed nodes and link to entities via smartLink nodes.
SegmentSegmentSaved filter definition scoped to a table. Definition is a pMBQL query with a single stage containing only source-table and filters.
MeasureMeasureSaved aggregation definition scoped to a table. Definition is a pMBQL query with a single stage containing only source-table and exactly one aggregation.
SnippetNativeQuerySnippetReusable SQL fragment referenced in native queries via {{snippet: Name}}.
TransformTransformMaterializes query or Python script results into a database table. Source is either MBQL/native query or Python script.
TransformTagTransformTagLabel for categorizing transforms. Built-in types: "hourly", "daily", "weekly", "monthly", or null for custom.
TransformJobTransformJobScheduled job (cron) that executes transforms matching specific tags.
PythonLibraryPythonLibraryShared Python source file available to Python-based transforms.

Ownership and hierarchy

Critical — folder layout is decorative. Where an entity lands in Metabase is decided entirely by its fields, not by where its YAML file sits in the tree. Moving a file without updating the fields changes nothing. Updating the fields without moving the file still works correctly. Always treat the fields below as the source of truth.

The fields that actually determine placement:

  • `collection_id` (entity_id of a collection) — places the entity in that collection. null or omitted → root collection.
  • `parent_id` on a collectionthis, and only this, sets the collection's own parent. A collection's position in the folder tree is ignored on import; without parent_id (or with parent_id: null) the collection becomes a root-level collection, no matter how deep its folder is nested. To nest one collection under another, set parent_id to the parent collection's entity_id.
  • `dashboard_id` / `document_id` on a card — nests a card under a dashboard or document. Such a card must also set collection_id to match the parent's collection_id. A card never sets both.

On disk, cards nested under a dashboard or document live in a subfolder next to the parent YAML (e.g. my_dashboard/card.yaml sitting next to my_dashboard.yaml) — but again, this is purely for human navigation; the fields are what Metabase reads.

Import paths

Metabase only imports YAML from these top-level directories; anything outside is ignored:

  • collections/ — all user content (cards, dashboards, documents, snippets, transforms, etc.), partitioned by namespace: main/, snippets/, transforms/.
  • databases/only the segments/ and measures/ subdirectories under each table are imported.
  • python_libraries/ (also accepted as python-libraries/).
  • transforms/ — contains transform_jobs/ and transform_tags/.

serdes/meta

Every entity carries a top-level serdes/meta array that encodes its identity path. Each entry is {id, model, label?}label is the slugified name and is present on entities keyed by NanoID. Example:

yaml
serdes/meta:
- id: NDzkGoTCdRcaRyt7GOepg
  label: my_entity_name
  model: Card

validate-schema reads serdes/meta to determine which entity type each file represents. The full rules (including nested entities and composite identity paths) are in spec.md.

Reading the spec

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

Beyond the per-entity shapes summarized in this SKILL, spec.md also covers: MBQL query form (stages, field references, joins, expressions, aggregations, filter/expression operators, temporal bucketing, binning), native queries and template tags (text, number, date, boolean, dimension, temporal-unit, card, snippet, table), visualization settings, click behavior, and dashboard/card parameters. Reach for spec.md whenever edits touch any of those.

Read on demand, not eagerly. Open spec.md only when you are about to read or modify content files for the entities listed above — e.g. the user asks to edit a card, add a dashcard, tweak a transform, or similar work that implies YAML edits. Do not open it at session start or for tasks unrelated to representation YAML.

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.

Validating

Validate edits with the built-in CLI:

sh
npx @metabase/representations validate-schema --folder <path>

Pass the top-level export folder, or the git repository root. The tool walks the import paths listed above, reads serdes/meta on each file to pick the right validation rules, and exits non-zero on failure. Prefer running this over manually cross-checking field shapes. It's essentially instant, so invoke it whenever useful — after each edit, between edits, whenever the shape of a file feels uncertain. No reason to batch.

Generating entity IDs

Every entity needs a 21-character NanoID for entity_id. Generate one (or several) with the bundled CLI:

sh
npx @metabase/representations generate-entity-id
# → LZfXLFzPPR4NNrgjlWDxn

npx @metabase/representations generate-entity-id --count 5

Generating UUIDs

Some fields in the format require v4 UUIDs rather than NanoIDs — notably lib/uuid on MBQL aggregation clauses (referenced from order-by and later stages) and the id on dashboard/card parameters. Generate them with:

sh
npx @metabase/representations generate-uuid
# → 1d4e9fdf-49ae-4fbe-ae27-05e7c6a5cfe8

npx @metabase/representations generate-uuid --count 3
同じリポジトリから

関連する Skills

すべての Skills
metabase
コミュニティ

ai-readiness-checklist

A Metabase AI-readiness coach, covering the data groundwork that makes AI answers trustworthy: modeling with Transforms, table and field metadata, the Glossary, saved Metrics, and marking canonical content. Use this skill whenever the user wants to check if their data is ready for AI, prep the underlying data for Metabot or the Metabase MCP server, work through an AI readiness checklist, or audit their data modeling/metadata/metrics before turning on AI features. Trigger it even if the user just says "is my data AI ready?", "let's get set up for Metabot", or "run the AI readiness checklist" in a Metabase context. Not this skill if the question is about controlling who may use AI, capping AI spend, restricting what Metabot can see, auditing AI usage, or passing a security review — that's ai-governance-checklist. Rough test: this skill is about whether the data is good enough; that one is about who gets to point AI at it.

導入数
1
GitHub Stars
42
更新日
8月26日
metabase
コミュニティ

metabase-cli

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, entityid, 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 .

導入数
1
GitHub Stars
42
更新日
8月26日
metabase
コミュニティ

metabase-embedding-sso-implementation

Implements JWT SSO authentication for Metabase embedding in a project. Supports all embedding types that use SSO — Modular embedding (embed.js web components), Modular embedding SDK (@metabase/embedding-sdk-react), and Full app embedding (iframe-based). Creates the JWT signing endpoint, configures the frontend auth layer, and sets up group mappings. Use when the user wants to add SSO/JWT auth to their Metabase embedding, implement user identity for embedded analytics, set up JWT authentication for Metabase, or connect their app's authentication to Metabase embedding.

導入数
1
GitHub Stars
42
更新日
8月26日
metabase
コミュニティ

metabase-full-app-to-modular-embedding-upgrade

Migrates a project from Metabase Full App / Interactive (iframe-based) embedding to Modular (web-component-based) embedding. Use when the user wants to replace Metabase iframes with Modular embedding web components.

導入数
1
GitHub Stars
42
更新日
8月26日