Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

ajv-cli

$ ajv Official Low Risk
Ajv · Database & Data · MIT · macos / linux / windows

ajv-cli (ajv) is the official Node.js command-line interface for the Ajv validator. It validates JSON, JSON5, YAML, and CJSON documents against JSON Schema or JTD (--spec=jtd), resolves $ref schemas (-r), and compiles standalone validators (ajv compile).

FCRS-1.0 Score
86 /100
Good
Medium Confidence
Zero-Friction Install
npm install -g ajv-cli
CLI vs MCP Decision CLI Only

Validates JSON/YAML payloads deterministically against Draft-07/2020-12 or JTD schemas locally via ajv validate.

Agent-Readiness Checklist

— JSON Output
— Field Filtering
✓ Non-Interactive
— Dry-Run
— Read-Only Mode
— NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 21 / 25

Non-interactive with clear 0/1 exit codes, --all-errors reporting, and glob support, though validation errors print to stderr.

  • Deterministic exit codes and --all-errors
  • Node.js CLI with --spec selection
Trust & Safety 24 / 25

validate and test are strictly read-only; only compile -o or migrate -o write local files.

  • Read-only validation by default
Setup & Portability 12 / 15

Easy npm / npx installation everywhere Node.js is available, though not distributed as a native Homebrew bottle or standalone binary.

  • Requires Node.js (npm install -g ajv-cli or npx)
Utility & Efficiency 13 / 15

Supports Draft-07, Draft-2019-09, Draft-2020-12, JTD, JSON5, YAML, and $ref resolution in one fast validator.

  • Supports multiple JSON Schema drafts, JTD, YAML, and JSON5
Maintenance & Lineage 8 / 10

Official ajv-validator/ajv-cli project under MIT license.

  • Official ajv-validator/ajv-cli repo
Docs & Verifiability 8 / 10

Clear README and ajv.js.org package docs covering --spec, -r, and -c plugin options.

  • Official docs at ajv.js.org/packages/ajv-cli.html

Security, Auth & Guardrails

Auth Modes
No Auth
Credential Storage

None; validates local schema and data files.

Side Effects
Read-Only Local Write
Cost & Quotas

MIT open-source npm CLI; completely free.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# ajv-cli Agent Rules
- Specify `--spec=draft2020` (or `draft2019` / `jtd`) explicitly when schemas are not Draft-07.
- Pass `-c ajv-formats` when schemas validate `date-time`, `email`, or `uri` formats.

Agent-Ready Command Recipes

Safe Read-Only Queries

Validate a JSON or YAML file against a schema
ajv validate -s schema.json -d data.json --all-errors

Validates data.json against schema.json and reports all schema violations with exit code 1 on failure.

Validate using Draft 2020-12 with referenced schemas
ajv validate --spec=draft2020 -s main.schema.json -r "defs/*.json" -d "data/*.json"

Resolves external $ref schema files and validates matching data files via globs.

Controlled Writes & Previews

Compile a standalone JS validation module
ajv compile -s schema.json -o validate.js

Generates a standalone JavaScript validation function file at validate.js.

Strengths for Agents

  • + Fast validation across JSON, JSON5, and YAML with glob support (-d "data/*.json").
  • + Supports Draft-07, Draft-2019-09, Draft-2020-12, and JTD (--spec=jtd).
  • + Standalone ajv compile generates zero-dependency JS validators.

Caveats & Pitfalls

  • ! Defaults to Draft-07; Draft-2020-12 schemas fail unless --spec=draft2020 is passed.
  • ! Standard format keywords (like email or uri) require installing and loading ajv-formats via -c ajv-formats.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI