rule-json-schema

Validate and standardize JSON Schemas generated from Zod definitions.

1|Updated Apr 17, 2025
One-click install
npx skills add https://github.com/carrot-foundation/schemas --skill rule-json-schema
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rule-json-schema
Source: https://github.com/carrot-foundation/schemas/tree/main/.agents/skills/rule-json-schema
Command: npx skills add https://github.com/carrot-foundation/schemas --skill rule-json-schema

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Generated JSON Schemas from Zod definitions can drift from standards and lack consistent metadata. This skill enforces a standardized generation and validation workflow to keep schemas reliable and well documented.

Core Features & Use Cases

  • Enforces top-level JSON Schema metadata such as the $schema, $id, title, description, type, properties, required, and additionalProperties for all generated schemas.
  • Provides a clear generation workflow: generate IPFS schemas from Zod definitions and validate them to catch structural issues early.
  • Use case: maintain schema integrity across a large schemas/**.schema.json set and ensure changes are driven from Zod sources.

Quick Start

Run pnpm generate-ipfs-schemas to produce the JSON Schemas from Zod definitions, then run pnpm validate-schemas to ensure structural correctness.

Frequently Asked Questions about rule-json-schema

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

FAQPage Schema
How do I validate generated JSON Schemas from Zod definitions?

To validate generated JSON Schemas from Zod definitions, run pnpm validate-schemas after generating them. This checks structural correctness to ensure all files meet required topology, descriptions, and field constraints.

What top-level metadata is required for JSON Schema files?

Required JSON Schema metadata includes $schema, $id, title, description, type, properties, required, and additionalProperties. Enforcing these fields ensures generated schemas remain standardized and well documented.

Why do my generated JSON Schemas drift from Zod source definitions?

Generated JSON Schemas drift from Zod sources when edits bypass the generation workflow. Enforcing regeneration from Zod definitions using pnpm generate-ipfs-schemas prevents manual drift and maintains schema integrity.

Can I automate validation across a large schemas directory?

Yes, you can automate validation across a schemas/**.schema.json directory. The workflow applies validation rules to all generated files to catch structural issues early and maintain consistent metadata.

What is the best way to generate IPFS schemas from Zod?

The best way to generate IPFS schemas from Zod is running pnpm generate-ipfs-schemas. This produces standardized JSON Schema files from Zod definitions before running subsequent structural validation.