zaggino/z-schema/handling-validation-errors
Claude Code and agent skill by zaggino/z-schema
- community
Checking that the SKILL.md file is still in the repository.
Inspects, filters, and maps z-schema validation errors for application use. Use when the user needs to handle validation errors, walk nested inner errors from anyOf/oneOf/not combinators, map error codes to user-friendly messages, filter errors with includeErrors or excludeErrors, build form-field error mappers, use reportPathAsArray, interpret SchemaErrorDetail fields like code/path/keyword/inner, or debug why validation failed.
Install
npx vskill@latest install zaggino/z-schema/handling-validation-errorsSKILL.md
Handling Validation Errors in z-schema
z-schema reports validation errors as ValidateError objects containing a .details array of SchemaErrorDetail. This skill covers inspecting, filtering, mapping, and presenting these errors.
Error structure
ValidateError extends Error:
| Property | Type | Description | |
|---|---|---|---|
.name | string | Always 'ValidateError' | |
.message | string | Summary message | |
.details | SchemaErrorDetail[] | All individual errors |
Each SchemaErrorDetail:
| Field | Type | Description | |||
|---|---|---|---|---|---|
message | string | Human-readable text, e.g. "Expected type string but found type number" | |||
code | string | Machine-readable code, e.g. "INVALID_TYPE" | |||
params | `(string \ | number \ | Array)[]` | Values filling the message template placeholders | |
path | `string \ | Array<string \ | number>` | JSON Pointer to the failing value ("#/age" or ["age"]) | |
keyword | string? | Schema keyword that caused the error ("type", "required", etc.) | |||
inner | SchemaErrorDetail[]? | Sub-errors from combinators (anyOf, oneOf, not) | |||
schemaPath | `Array<string \ | number>?` | Path within the schema to the constraint | ||
schemaId | string? | Schema ID if present | |||
title | string? | Schema title if present | |||
description | string? | Schema description if present |
Capturing errors
Try/catch (default mode)
Safe mode (no try/catch)
Walking nested errors
Combinators (anyOf, oneOf, not) produce nested inner errors. A recursive walker handles any depth:
Collecting all leaf errors
Flatten the tree to get every concrete error, skipping combinator wrappers:
Mapping errors to form fields
Convert JSON Pointer paths to field names for UI form validation:
Using array paths
Enable reportPathAsArray for easier programmatic access:
Filtering errors
Per-call filtering
Pass includeErrors or excludeErrors as the third argument:
Programmatic post-filtering
Custom error messages
Map error codes to user-friendly messages:
Stopping at first error
For fail-fast scenarios:
This reports only the first error encountered, reducing noise during iterative fixing.
Using the keyword field
The keyword field tells you which schema keyword triggered the error — useful for categorizing errors programmatically:
Reference files
For the full error code list with descriptions, see the validating-json-data skill's error-codes reference.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/handling-validation-errors/SKILL.md
Popularity
- Repository stars
- 350
- Repository forks
- 91
- Repository npm downloads, 7 days
- 2,848,839
- 7-day trend score
- 62
Stars and forks are for the whole GitHub repository, not this skill alone. Downloads are for the repository's npm package. Refreshed 16 Mar 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/zaggino/z-schema/handling-validation-errors)