npx skills add ...
npx skills add zaggino/z-schema --skill skill-creator
Create, improve, and test skills for the z-schema JSON Schema validator library. Use this skill whenever the user wants to create a new skill from scratch, turn a workflow into a reusable skill, update or refine an existing skill, write test cases for a skill, or organize reference material for a skill. Also use when someone mentions "skill", "SKILL.md", or wants to document a z-schema workflow for reuse by humans or AI agents.
npx skills add zaggino/z-schema --skill skill-creator
Create skills that help people and AI agents accomplish goals with z-schema — a JSON Schema validator supporting draft-04 through draft-2020-12.
Skills live in skills/<skill-name>/ and teach Claude how to perform z-schema tasks reliably: validating data, writing schemas, handling errors, using custom formats, contributing to the codebase, and more.
Match your communication style to the user's technical level. Most z-schema users are developers, but skill creation itself may be new to them. Briefly explain skill-specific concepts (frontmatter, progressive disclosure, trigger descriptions) when first introduced. Don't assume everyone knows what YAML frontmatter is — one sentence of explanation is enough.
Keep things conversational and practical. Avoid heavy jargon unless the user is clearly comfortable with it.
Understand what the user wants the skill to accomplish. The conversation may already contain a workflow to capture — if so, extract what you can from it before asking questions.
Determine:
Ask about edge cases, input variety, and success criteria. Probe for specifics:
docs/ that cover this territory? Check before reinventing.skills/ that overlaps? Review it to avoid duplication and maintain consistency.Read the relevant z-schema documentation to ground the skill in accurate, current information:
Study the existing skills/validating-json-schema/SKILL.md as a reference for tone, structure, and level of detail.
See references/skill-structure.md for the full structural guide, z-schema conventions, and examples.
Core principles:
Start with frontmatter — name and description are required. The description is the primary trigger mechanism — make it specific and slightly "pushy" to ensure the skill activates when relevant.
Keep SKILL.md under 500 lines. Move detailed reference material (option tables, error code lists, schema examples) into references/ files. Point to them clearly from the main SKILL.md with guidance on when to read each one.
Use imperative instructions. Write "Create a validator with ZSchema.create()" not "You should create a validator...".
Explain the why. Instead of rigid MUST/NEVER rules, explain reasoning. Today's LLMs respond better to understanding motivation than to heavy-handed directives.
Include working code examples. z-schema skills are most useful when they contain copy-paste-ready TypeScript snippets. Always use ZSchema.create() (never new ZSchema()), always use the correct import style, and specify which draft the example targets if it matters.
Ground in z-schema reality. Every API call, option name, error code, and type name in the skill must be accurate. Cross-reference against src/index.ts exports, docs/options.md, and src/errors.ts to verify.
If the skill needs detailed supplementary material, add files under <skill-name>/references/:
Good candidates for reference files:
skills/validating-json-schema/references/options.md)skills/validating-json-schema/references/error-codes.md)Include a table of contents in reference files over 150 lines.
For skills with verifiable outputs, create 2–3 realistic test prompts — things a real user would say. Share them with the user for confirmation before running them.
Test prompt examples for a z-schema skill:
$ref to reference a shared address definition and validation is failing with an unresolvable reference error"Running tests:
Execute each test prompt yourself, following the skill's instructions to complete the task. Verify:
Save test results for the user to review. Organize by test case:
After reviewing test results with the user:
Generalize from feedback. Don't overfit to test cases. If a user says "the error handling example doesn't show nested errors from oneOf", the fix isn't just adding that one example — it's ensuring the error handling section covers combiner keywords comprehensively.
Keep it lean. Remove instructions that aren't pulling their weight. If test runs show the skill causing unnecessary steps, trim.
Explain the why. If you find yourself writing "ALWAYS do X", reframe: explain why X matters so the model (or human) understands the reasoning.
Look for repeated patterns. If every test case required the same boilerplate setup, the skill should include that setup as a template.
Re-verify accuracy. After changes, re-check API names, option defaults, error codes, and types against the source code.
Rerun tests after changes. Repeat until the user is satisfied or feedback is all positive.
When the user wants to improve a skill that already exists:
src/.description in frontmatter. Make it more specific about when to activate. Include synonyms and related phrases.src/index.ts exports and docs/usage.md. Ensure ZSchema.create() is used, imports are correct, and the draft version matches the example.references/ files. Keep SKILL.md focused on the most common workflows.Every skill for this repository should respect these constraints:
ZSchema.create(options?) — never new ZSchema(). This returns typed variants based on options (ZSchema, ZSchemaSafe, ZSchemaAsync, ZSchemaAsyncSafe).draft2020-12. Always specify the draft explicitly in examples if it matters.import ZSchema from 'z-schema' (default) or import { ZSchema } from 'z-schema' (named). Use import type { ... } for type-only imports.ValidateError has .details (not .errors) — an array of SchemaErrorDetail with message, code, params, path, keyword, inner.Skills should demonstrate the mode appropriate to the use case:
validator.validate(data, schema) — throws ValidateErrorvalidator.validateSafe(data, schema) — returns { valid, err? }{ async: true } — for async format validators{ async: true, safe: true } — returns Promise<{ valid, err? }>If a skill involves draft-specific features, be explicit about which drafts support them:
prefixItems — draft-2020-12 only (replaces array-form items)$dynamicRef/$dynamicAnchor — draft-2020-12 only$recursiveRef/$recursiveAnchor — draft-2019-09 onlyunevaluatedProperties/unevaluatedItems — draft-2019-09 and draft-2020-12if/then/else — draft-07+$id, const, contains — draft-06+Skills targeting z-schema contributors (not just consumers) must follow the codebase conventions:
strict: true, ESM with .js import extensions in src/import type for type-only importstest/spec/ with .spec.ts / .node-spec.ts / .browser-spec.ts suffixessrc/index.tsUPPER_SNAKE_CASE in src/errors.tsSee docs/conventions.md and docs/contributing.md for the full rules.
Before writing new reference material, check if docs/ already covers it:
docs/usage.md — full library API guidedocs/options.md — every option with description and defaultdocs/features.md — feature catalog with code examplesdocs/architecture.md — module structure and validation pipelinedocs/testing.md — test framework and patternsdocs/contributing.md — PR workflow and code change guidesPoint to existing docs rather than duplicating them. Only create skill-specific reference files when the skill needs a different angle or aggregation of information.
The description field in SKILL.md frontmatter determines whether the skill gets activated. After creating or improving a skill, review the description for triggering accuracy.
Good descriptions:
Example — weak:
Example — strong:
Tuning the description:
For the full structural guide, conventions, and examples for writing z-schema skills:
Break these into tracked tasks so nothing gets skipped. Take your time writing a good draft, then look at it with fresh eyes and improve it before sharing.
description: Validates JSON data against JSON Schema using z-schema. Use when the user needs to validate JSON, define schemas, handle validation errors, use custom formats, or work with JSON Schema drafts 04 through 2020-12. Covers sync/async modes, safe error handling, schema compilation, remote references, and TypeScript types.