技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
data-metabase【数据与研究】Automates Metabase cards, dashboards, Remote Sync, embedding, tenants, and the Agent API/MCP server for AI workflows. Use when scripting, promoting, or embedding Metabase content.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
The classic Metabase REST API owns cards, dashboards, collections, permissions, and schema refresh. The versioned Agent API is the surface for headless semantic BI assistants and app-side AI workflows. The official MCP server (added in v60) and @metabase/cli (added in v62) serve AI clients and terminal scripting. Which release added what is in references/metabase-59-surface.md; before citing version-specific behavior, read the user's version from GET /api/session/properties (version), the current stable line from metabase.com/releases, and behavior from /docs/latest.
| Task | Path | Use When |
|---|---|---|
| Create/update questions and dashboards | Classic REST API + scripts/metabase_api.py | Standard content automation and incremental upserts |
| Promote content between environments | Remote Sync or serialization | Git-backed promotion, reviewable diffs, cross-environment moves |
| Build embedded customer analytics | Embedding + tenants + embedding permissions | Multi-tenant apps, customer portals, row-level isolation |
| Build an AI analytics app | Agent API | Versioned, semantic, app-side AI querying |
| Integrate Metabase with an AI coding agent | MCP server (v60+) | Claude, Cursor, VS Code — generate questions and dashboards via conversation |
| Govern AI access by group | Metabot AI governance (v61+, Pro/Enterprise) | Per-group controls, token limits, usage analytics |
| Refresh schema metadata | Database sync/rescan endpoints | New tables, changed columns, stale field values |
| Tune native SQL questions | Export-first + native query patterns | Stable automation without guessing request shapes |
Need to create or edit saved Metabase content?
-> Use classic REST API (`card`, `dashboard`, `collection`).
Need repeatable dev -> prod promotion with reviewable diffs?
-> Prefer Remote Sync or serialization before raw REST upserts.
Need embedded analytics for many customers or workspaces?
-> Use embedding + tenants + embedding permissions.
Need an AI assistant to discover metrics/tables and construct queries?
-> Use the versioned Agent API, not raw card CRUD.
Need to generate or edit questions/dashboards from an AI coding agent or terminal?
-> Use the official Metabase MCP server (v60+, connects Claude/Cursor/VS Code).
METABASE_URL (e.g., https://metabase.example.com)METABASE_API_KEYMETABASE_SESSIONMETABASE_USERNAME + METABASE_PASSWORDpython3 skills/universal/data-metabase/scripts/metabase_api.py health
python3 skills/universal/data-metabase/scripts/metabase_api.py whoami
python3 skills/universal/data-metabase/scripts/metabase_api.py list-databases
python3 skills/universal/data-metabase/scripts/metabase_api.py list-collections --tree
Your Metabase instance serves OpenAPI docs at /api/docs (for example https://metabase.example.com/api/docs). Use this to confirm request shapes for your exact build before scripting bulk edits.
GET /api/util/health).collection_id for save locationdatabase id for dataset_querydisplay and visualization_settings explicitlyTreat a Metabase content change as a small migration, especially when dashboard filters or permissions are involved:
create, update, archive, permission change). For each operation, record its supported inverse, exact writable fields, target identifiers, and dependencies. Inventory permissions, archive state, cards, dashboards, dashcard layout, and filter mappings separately.An upsert is idempotent only when its lookup key is unique and stable in that environment. If two candidates match, stop and surface the ambiguity rather than updating the first result.
carddisplay + visualization_settingscontinuation_token paginationnpm install -g @metabase/cli; check the CLI README for the minimum Metabase version, which differs for API-key and browser login; distinct from the classic REST/JAR admin surfaces) builds questions, dashboards, documents, and transforms from the terminal — see references/metabase-cli.md/docs/latest/embedding before scaffolding or upgrading an app. Breaking boundary: SDK 1.54.x and below use the legacy auth API (authProviderUri, backend returns { id }); later versions drop authProviderUri and the backend returns { jwt }Plan tiering decides many designs: SSO, row and column security (sandboxing), the modular embedding SDK, custom visualizations, and Metabot/AI governance have been paid-plan features, not Open Source. Tier names and which features sit on which tier change, so confirm the feature on the metabase.com/pricing comparison before designing around it.
Do not quote prices from memory. Before putting a cost in a proposal, read metabase.com/pricing and record: base price and included users per tier, per-user price, whether the figure shown is the annual-billing or monthly-billing price (they differ), the hosted AI token rate versus bring-your-own-provider-key, and the transforms allowance and per-run price.
METABASE_API_KEY, passwords, or session tokens.MB_API_KEY, not the user-facing METABASE_API_KEY.| Topic | File | Load when |
|---|---|---|
| Authentication (API key + fallback) | references/api-auth.md | Any API automation task |
| Reports (cards): create/edit patterns | references/reports-cards.md | Creating or updating saved questions |
| Dashboards and card placement | references/dashboards.md | Building or replicating dashboards |
Charts and visualization_settings | references/charts-settings.md | Configuring chart display or axis settings |
| Agent API for semantic BI | references/agent-api.md | Building AI analytics apps or headless BI workflows |
| Embedding and integration | references/embedding-integration.md | Public links, signed JWT, or SDK embedding |
| Tenants, embedding permissions, routing | references/tenants-routing.md | Multi-tenant apps or customer portal isolation |
| Permissions and collections | references/permissions-collections.md | Group setup, sandboxing, or collection hierarchy |
| Native SQL query patterns | references/native-query-patterns.md | Template tags, field filters, caching in SQL cards |
| Remote Sync and promotion workflows | references/remote-sync.md | Git-backed content promotion or cross-env moves |
| Surface map and release anchors | references/metabase-59-surface.md | Confirming which API layer a request belongs to, or which release added a feature |
CLI: mb API client and JAR admin commands | references/metabase-cli.md | Scripting content via mb, or server admin (migrate, dump-to-h2, serialization) |
| Template | File |
|---|---|
| Card spec skeleton | assets/card-spec.template.json |
| Dashboard spec skeleton | assets/dashboard-spec.template.json |
| Dashcard layout skeleton | assets/dashcards-layout.template.json |
| Embed JWT examples | assets/embed-jwt-example.md |
scripts/metabase_api.py is a dependency-free helper for auth, discovery, content CRUD, dashboard layout work, query execution, and schema refresh. Dashboard placement writes require explicit arrays and unique nonzero integer ids; malformed fetched lists stop the write because omitted placements are deleted. Run its offline regressions with python3 -m pytest scripts/test_metabase_api.py from this skill directory.
Examples:
# Print authenticated user (tries API key, then session)
python3 skills/universal/data-metabase/scripts/metabase_api.py whoami
# Discover IDs before scripting
python3 skills/universal/data-metabase/scripts/metabase_api.py list-collections --tree
python3 skills/universal/data-metabase/scripts/metabase_api.py list-databases
python3 skills/universal/data-metabase/scripts/metabase_api.py database-metadata --id 2
python3 skills/universal/data-metabase/scripts/metabase_api.py list-fields --database-id 2
# Export an existing card JSON (use as a template for visualization_settings)
python3 skills/universal/data-metabase/scripts/metabase_api.py export-card --id 123 --out card.json
# Export an existing dashboard JSON (use as a template for layout)
python3 skills/universal/data-metabase/scripts/metabase_api.py export-dashboard --id 5 --out dashboard.json
# Create/update a card from a JSON spec (see references/reports-cards.md)
python3 skills/universal/data-metabase/scripts/metabase_api.py upsert-card --spec card-spec.json
# Create/update a dashboard from a JSON spec
python3 skills/universal/data-metabase/scripts/metabase_api.py upsert-dashboard --spec dashboard-spec.json
# Add or update dashboard layout
python3 skills/universal/data-metabase/scripts/metabase_api.py add-dashcard --dashboard-id 5 --spec dashcard.json
python3 skills/universal/data-metabase/scripts/metabase_api.py update-dashcards --dashboard-id 5 --spec dashcards-layout.json
# Execute a query spec or export a saved card result
python3 skills/universal/data-metabase/scripts/metabase_api.py run-query --spec dataset-query.json
python3 skills/universal/data-metabase/scripts/metabase_api.py export-card-query --id 123 --format csv --out report.csv
# Refresh metadata after schema changes
python3 skills/universal/data-metabase/scripts/metabase_api.py sync-schema --id 2
python3 skills/universal/data-metabase/scripts/metabase_api.py rescan-values --id 2
When prior decisions or pitfalls are relevant, consult learnings.consolidated.md if present; use learnings.md only for needed history or as the available fallback. Otherwise skip both.
After applying it, if you encountered a pattern worth remembering, a mistake worth preventing, or a domain fact that surprised you, append one dated bullet to learnings.md via agents-skills-feedback-loop/scripts/append_learning.py. Do not modify SKILL.md itself.