add-malli-schemas
Efficiently add Malli schemas to API endpoints in the Metabase codebase with proper patterns, validation timing, and error handling
Deciding where frontend code lives — tier model, move mechanics, extension points, side effects, naming, and the traps. Use when moving code between modules, carving new modules, fixing boundary violations, adding a barrel or an endpoint, or reviewing module-shape decisions.
$ npx -y skills add metabase/metabase --skill fe-modularization --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/fe-modularizationContext preview
The summary Claude sees to decide when to auto-load this skill.
Deciding where frontend code lives — tier model, move mechanics, extension points, side effects, naming, and the traps. Use when moving code between modules, carving new modules, fixing boundary violations, adding a barrel or an endpoint, or reviewing module-shape decisions.
name: fe-modularization description: Deciding where frontend code lives — tier model, move mechanics, extension points, side effects, naming, and the traps. Use when moving code between modules, carving new modules, fixing boundary violations, adding a barrel or an endpoint, or reviewing module-shape decisions.
The module is the unit of blast radius: dependency direction, test selection, bundle cones, and review scope all follow module boundaries. Every decision here serves one goal: **make the file locations tell the truth about who owns what and who may depend on whom.**
from a barrel. Move the code, codemod every call site, delete the old path, all in the same PR.
`enforcePublicApi: true`, and never past `metabase/ui`'s index at all. If the barrel is heavy, the fix is making the module side-effect free (below), not a deep import.
the fix makes the consumer worse, the plan is wrong.
enforced with `enforcePublicApi: true` and an explicit `index.ts`.
takes it to zero violations.
numbers.
Mantine from `metabase/ui`, react-redux hooks from `metabase/redux`; the raw specifiers are lint-forbidden.
| what | where | |---|---| | module elements, tiers, `enforceSharedTiers`, `enforcePublicApi` | `frontend/lint/module-boundaries.mjs` | | shared sub-tiers and levels, cluster rules | `frontend/lint/shared-tiers.mjs` | | standalone boundaries lint (all violations, incl. grandfathered) | `bun run module-boundaries` (config `eslint.config.module-boundaries.mjs`) | | PR lint (only enforced modules fail CI) | `bun run lint-eslint-pure` | | side-effect-free directories and their exceptions | `frontend/build/shared/rspack/side-effect-free-modules.js` (`SIDE_EFFECT_FREE_PATHS`, `SIDE_EFFECT_PATHS`) | | the lint rules that enforce that promise | `metabase/no-module-side-effects`, `metabase/no-base-api-access` in `frontend/lint/eslint-plugin-metabase/rules/` | | public-api enforcement | `metabase/enforce-module-public-api` rule, driven by `getPublicApiModules()` |
Tiers: `lib < basic < shared < feature < app`. Imports point downward, never sideways at feature tier (features may not import features; app and EE may import anything). The shared tier is subdivided in `shared-tiers.mjs` into shared-utils (U0…), shared-platform (P0…), and shared-domain, each ordered into levels. A module imports only *strictly lower* levels of its sub-tier plus the sub-tiers below; same-level peers are deliberately forbidden, which is what makes cycles structurally impossible. A domain may hold two seats when consumers demand it: a low core and a high surface (metabase-lib below questions below query_builder; viz-core below visualizations).
Enforcement is per module: `enforceSharedTiers: false` on an element exempts it from the level rules (counted by `bun run module-boundaries`, invisible to PR lint). Modules with `enforcePublicApi: true` may only be imported from outside via `metabase/<module>`, and import relatively inside.
1. **Who owns the concept?** Code lives with the module that owns its concept, not the module that renders or calls it. A mode encoding dashboard click behaviour is dashboard code even if viz executes it. Metabot conversation state is metabot state even though the store registers it. 2. **Consumer-tier check.** The destination must sit at or below the file's *lowest* consumer. A single consumer below the proposed home vetoes the move; report it, don't force it. 3. **Only four legitimate fixes** for a bad edge: move the code to its terminal home; invert through a designed extension point (a prop, an injected component, a contract type owned by the socket); fix the tier placement when the declared level is wrong; delete a thin wrapper (a rename with no derivation isn't an abstraction — deleting it *is* the migration). 4. **A bridge lives above the lower endpoint.** Code that needs both sides of a boundary belongs in or above the higher module. 5. **"Genuinely shared" is proven by consumers.** A shared address needs two or more consumers the tier rules can't serve another way. One consumer pretending to be shared is a feature module at the wrong address.
The socket's owner defines the contract; every plug lives with its extender. Visualization owns the `mode` prop and click interfaces, each surface supplies its mode; the editor owns its extension contract, metabot supplies tiptap extensions; querying owns `TemplateTagsSidebarProps`, parameters implements it.
for edition gating; single-reader slots move out to their reading module; slots with many readers live in the module that owns the concept (every slot the whitelabel plugin fills lives in `whitelabel`), tier permitting. Keep contracts type-light so implementations can load lazily.
or second slot appears; then the composition deserves its own module above both parts. Don't pre-build the wrapper.
A module that has redux state owns it:
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…