askill
schema-validate

schema-validateSafety 95Repository

Validate JSON data against a JSON Schema. Use when the user asks to validate JSON against a schema, check if JSON conforms to a schema, test JSON data validity, or verify JSON structure matches a schema definition.

2 stars
1.2k downloads
Updated 2/14/2026

Package Files

Loading files...
SKILL.md

Validate JSON Against Schema

Validate JSON data files against a JSON Schema definition.

Usage

npx tsx scripts/validate.ts <json-file> --schema=<schema-file> [options]

Arguments

ArgumentRequiredDescription
json-fileYesPath to the JSON file to validate

Options

OptionDescription
--schema=FILEPath to the JSON Schema file (required)
--all-errorsReport all errors, not just the first
--strictEnable strict mode validation
--verboseShow detailed validation output
--formatOutput format: text (default), json

Output

Valid JSON:

Valid
  Schema: user-schema.json
  File: user.json

Invalid JSON:

Invalid (3 errors)
  1. /email: must match format "email"
  2. /age: must be >= 0
  3. /name: must be string

Script Execution

npx tsx scripts/validate.ts data.json --schema=schema.json
npx tsx scripts/validate.ts data.json --schema=schema.json --all-errors
npx tsx scripts/validate.ts data.json --schema=schema.json --format=json

Run from the json-schema plugin directory: ~/.claude/plugins/cache/json-schema/

Batch Validation

Validate multiple files against the same schema using glob patterns:

# Validate all JSON files in a directory
for f in data/*.json; do npx tsx scripts/validate.ts "$f" --schema=schema.json; done

JSON Output Format

When using --format=json:

{
  "valid": false,
  "file": "user.json",
  "schema": "user-schema.json",
  "errors": [
    {
      "path": "/email",
      "message": "must match format \"email\"",
      "keyword": "format"
    }
  ]
}

Error Messages

Common validation errors:

  • must be string - Type mismatch
  • must match format "..." - Format validation failed
  • must be >= N / must be <= N - Number range violation
  • must NOT have additional properties - Unknown property
  • must have required property '...' - Missing required field
  • must match pattern "..." - String pattern mismatch

Related Skills

  • Use schema-meta to validate that a schema is well-formed
  • Use schema-check to validate a JSON file against its embedded $schema

Install

Download ZIP
Requires askill CLI v1.0+

AI Quality Score

74/100Analyzed 2/20/2026

Well-structured skill with clear usage instructions, examples, and error messages. Provides comprehensive documentation for JSON schema validation. Slightly limited by being tied to a specific plugin location, but the core content is actionable and reusable within that context. Bonus points for including when-to-use guidance and structured command examples.

95
85
58
72
80

Metadata

Licenseunknown
Version-
Updated2/14/2026
PublisherMearman

Tags

llm