guardrails

Write Malli-based Guardrails function specifications for runtime validation in Clojure.

1|Updated Aug 16, 2018
One-click install
npx skills add https://github.com/saskenuba/dotfiles --skill guardrails
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: guardrails
Source: https://github.com/saskenuba/dotfiles/tree/main/ai/.claude/skills/guardrails
Command: npx skills add https://github.com/saskenuba/dotfiles --skill guardrails

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill teaches Clojure developers how to write Malli-based Guardrails function specifications to perform runtime validation of arguments and return values.

Core Features & Use Cases

  • Define function specifications with >defn using Malli schemas to enforce argument and return types.
  • Learn primitive, collection, map, and composite schemas (Maybe, Enum, And, Or, Orn, Multi) and how to apply them to real-world code.
  • Create reusable domain types in a registry to minimize duplication and improve maintainability.

Quick Start

Define a simple Guardrails example: create a >defn add function that accepts two integers and returns an integer, and call it with (add 2 3) to verify runtime validation.

Frequently Asked Questions about guardrails

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

FAQPage Schema
How do I add runtime validation to Clojure functions using Malli schemas?

You add runtime validation to Clojure functions by defining them with >defn and applying Malli schemas to argument and return values, ensuring inputs and outputs are validated during execution.

What Malli schema types are available for Guardrails function specifications?

Guardrails supports primitive, collection, map, and composite Malli schemas including Maybe, Enum, And, Or, Orn, and Multi, enabling validation of complex real-world data structures in function specifications.

How do I avoid schema duplication when writing Guardrails specs across multiple functions?

You avoid schema duplication by creating reusable domain types in a Malli registry, which centralizes definitions and improves maintainability across your Guardrails function specifications.

Can I use Guardrails specs to validate optional keys in map schemas?

Yes, Guardrails supports optional keys in Malli map schemas, with best practices for schema depth, optional key handling, and error management covered for real-world function validation.

When should I use composite schemas like And, Or, and Multi in Guardrails?

Composite schemas like And, Or, and Multi apply when function arguments or return values require multiple validation rules simultaneously, such as combining type checks with custom predicates or branching validation logic.

What Clojure knowledge do I need before writing Guardrails function specifications?

You need a working understanding of Clojure function definitions and the Malli schema library, as Guardrails builds on >defn syntax and Malli's schema vocabulary to enforce runtime type safety.