add-malli-schemas
Efficiently add Malli schemas to API endpoints in the Metabase codebase with proper patterns, validation timing, and error handling
Edit Metabase serdes YAML files (cards, dashboards, databases) with correct portable references and structural conventions. Use when modifying exported YAML content.
$ npx -y skills add metabase/metabase --skill serdes-yaml-edit --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/serdes-yaml-editContext preview
The summary Claude sees to decide when to auto-load this skill.
Edit Metabase serdes YAML files (cards, dashboards, databases) with correct portable references and structural conventions. Use when modifying exported YAML content.
name: serdes-yaml-edit description: Edit Metabase serdes YAML files (cards, dashboards, databases) with correct portable references and structural conventions. Use when modifying exported YAML content.
**Run both checkers after every edit.** No exceptions. Do not batch multiple edits before validating.
clojure -M:run:ee --mode checker --checker structural --export /path/to/export-dir clojure -M:run:ee --mode checker --checker cards --export /path/to/export-dir
If either checker fails, fix the issue before making further edits.
Serdes YAML uses portable references instead of integer IDs. This is the most important concept for editing.
String name: `"Sample Database"`
Array of `[database, schema, table]`:
table_id: - Sample Database - PUBLIC - ACCOUNTS
Array of `[database, schema, table, field]`:
id: - Sample Database - PUBLIC - ACCOUNTS - EMAIL
field_ref: - field - - Sample Database - PUBLIC - ACCOUNTS - EMAIL - null
The outer array is `[field, <field-path>, <options>]`. The options are usually `null`.
Entity ID string (21 characters): `"Qk5TgsNx4ubXIUtsQmT8G"`
dataset_query:
database: Sample Database
query:
source-table:
- Sample Database
- PUBLIC
- ACCOUNTS
type: queryThese rarely break validation:
These must use valid portable refs and will be caught by the cards checker if wrong:
Each entry in `result_metadata` describes an output column. When changing a query's source table or fields, you must update result_metadata to match. Each field entry needs at minimum:
Change `name:` at the top level. Safe, no ref changes needed.
Update all of these consistently: 1. `table_id` - top-level 2. `dataset_query.query.source-table` - in the query 3. `result_metadata` - every field entry's `id`, `field_ref`, and `table_id`
dataset_query:
database: Sample Database
query:
source-table:
- Sample Database
- PUBLIC
- ORDERS
filter:
- ">"
- - field
- - Sample Database
- PUBLIC
- ORDERS
- TOTAL
- null
- 100
type: querydisplay: bar # was: table
Valid types: `table`, `bar`, `line`, `pie`, `scalar`, `row`, `area`, `combo`, `scatter`, `funnel`, `map`, `pivot`, `progress`, `gauge`, `waterfall`
The export directory IS the reference catalog. When you need to find the correct name for a database, table, or field, look it up directly from the export.
ls databases/
Each entry is a database name (directory for serdes format, .yaml for concise format).
ls databases/<db-name>/schemas/<schema>/tables/
Example: `ls databases/Sample\ Database/schemas/PUBLIC/tables/` shows `ACCOUNTS`, `ORDERS`, `PRODUCTS`, etc.
ls databases/<db-name>/schemas/<schema>/tables/<table>/fields/
Example: `ls databases/Sample\ Database/schemas/PUBLIC/tables/PRODUCTS/fields/` shows `CATEGORY.yaml`, `TITLE.yaml`, `PRICE.yaml`, etc. The filename (minus `.yaml`) is the field name.
Card filenames encode the entity ID: `<entity-id>_<slug>.yaml`. The entity ID is the part before the first underscore (21 characters).
When a checker reports errors, follow this loop:
1. **Read the error message** - it tells you what's wrong and often suggests the fix 2. **Look up the correct value** from the export directory (see "Looking Up Valid References" above) 3. **Fix the YAML** 4. **Re-run both checkers** 5. **Repeat until clean**
Do not guess at fixes. Always look up the correct value from the export.
The structural checker validates YAML shape against Malli schemas. Common errors:
**Missing required key with typo suggestion:**
Missing required key 'name' - found 'nameee' which may be a typo
Fix: rename the typo'd key back to the correct name. The checker tells you what it expected and what it found.
**Wrong type:**
'archived' should be a boolean, got: "yes"
Fix: use `true`/`false`, not strings.
**Unknown key:**
Unknown key 'foobar' in card
Fix: remove the key, or check if it's a typo of a known key.
The cards checker validates that queries resolve against exported metadata. Error types:
**UNRESOLVED REFERENCES:**
UNRESOLVED REFERENCES: - field: Sample Database.PUBLIC.PRODUCTS.CATEGORYYY
The dotted path tells you exactly which reference failed. Look up the correct value:
Metabase is the easy, open-source way for everyone in your company to ask questions and learn from data.
Repo: metabase/metabase
Efficiently add Malli schemas to API endpoints in the Metabase codebase with proper patterns, validation timing, and error handling
Add OpenTelemetry tracing spans to Clojure code following Metabase tracing conventions. Use when instrumenting backend code with trace coverage.
Add product analytics events to track user interactions in the Metabase frontend
Evaluate Clojure code via nREPL using clj-nrepl-eval. Use this when you need to test code, check if edited files compile, verify function behavior, or interact…
Review Clojure and ClojureScript code changes for compliance with Metabase coding standards, style violations, and code quality issues. Use when reviewing pull…
Guide Clojure and ClojureScript development using REPL-driven workflow, coding conventions, and best practices. Use when writing, developing, or refactoring…