add-malli-schemas

Add Malli schemas to Metabase API endpoints for routes, params, and bodies.

48.6k|6.7k|Updated Feb 2, 2015
One-click install
npx skills add https://github.com/metabase/metabase --skill add-malli-schemas
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: add-malli-schemas
Source: https://github.com/metabase/metabase/tree/main/.claude/skills/add-malli-schemas
Command: npx skills add https://github.com/metabase/metabase --skill add-malli-schemas

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Efficiently add Malli schemas to API endpoints in the Metabase codebase with proper patterns, validation timing, and error handling.

Core Features & Use Cases

  • Route params have schemas
  • Query params have schemas with :optional true and :default where appropriate
  • Request body has a schema (for POST/PUT)
  • Response schema is defined (using :- after route string)
  • Use existing schema types from ms namespace when possible
  • Consider creating named schemas for reusable or complex types
  • Add contextual error messages for validation failures

Quick Start

Add a Malli schema to an endpoint, then attach to the endpoint macro; test by invoking the endpoint to verify validation.

Frequently Asked Questions about add-malli-schemas

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add Malli schemas to API endpoints in Metabase?

Add Malli schemas to API endpoints by defining schemas for route parameters, query parameters, request bodies, and responses using the `ms` namespace types. Attach schemas to endpoint macros, then test by invoking the endpoint to verify validation works correctly.

What's the proper way to schema route and query parameters in Malli?

Route parameters require schemas directly. Query parameters should include `:optional true` and `:default` where appropriate. Use existing `ms` namespace types when possible, and consider named schemas for reusable or complex types.

How do I define request body and response schemas for POST and PUT endpoints?

Request bodies require a schema for POST and PUT operations. Response schemas are defined using `:-` after the route string. Both leverage existing schema types from the `ms` namespace to maintain consistency.

Can I reuse schemas across multiple API endpoints?

Yes. Create named schemas for types used across multiple endpoints. Named schemas enable consistency, reduce duplication, and simplify maintenance across the Metabase API codebase.

How should I handle validation errors when schemas fail?

Add contextual error messages for validation failures to provide clear feedback when schema validation fails. This improves debugging and user experience across API endpoints.

Does Malli schema validation work with existing Metabase endpoint macros?

Yes. Malli schemas integrate directly with Metabase endpoint macros. Attach schemas and test by invoking endpoints; validation timing and error handling follow real-world endpoint patterns in the codebase.