zaggino/z-schema/contributing-to-z-schema
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Guides contributors through the z-schema codebase, PR workflow, and common development tasks. Use when the user wants to contribute to z-schema, add a new feature or keyword, add an error code, add a format validator, modify options, write tests, run the test suite, fix a failing test, understand the validation pipeline, navigate the source code architecture, or submit a pull request. Also use when someone mentions contributing, PRs, the z-schema source code, or the JSON Schema Test Suite integration.
Install
npx vskill@latest install zaggino/z-schema/contributing-to-z-schemaSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
Contributing to z-schema
z-schema is a JSON Schema validator (draft-04 through draft-2020-12) written in TypeScript. This skill covers the development workflow, codebase navigation, and common contribution tasks.
Repository setup
If already cloned without --recursive (needed for the json-schema-spec/ submodule):
Quality checks
Run all checks before pushing:
Pre-commit hooks auto-run lint + format on staged files. Pre-push hooks run build + type-check.
Codebase map
Validation pipeline
- Schema compilation (
schema-compiler.ts): resolves$ref, collectsid/$id, registers in cache - Schema validation (
schema-validator.ts): validates schema against its meta-schema - JSON validation (
json-validation.ts+validation/*.ts): validates data against compiled schema — type checks, constraints, combiners (allOf/anyOf/oneOf/not),unevaluated*tracking, format checks. Keyword validators are split into modules undervalidation/by category - Report (
report.ts): errors accumulate in aReport, then convert toValidateError
Common tasks
Adding a new error code
- Add the error to the
Errorsobject insrc/errors.ts:
``typescript MY_NEW_ERROR: 'Description with {0} placeholder', ``
- Use
report.addError('MY_NEW_ERROR', [param])in the validation logic. - Write tests verifying the error code is produced.
Adding a new format validator
- Write the validator function in
src/format-validators.ts:
``typescript const myFormatValidator: FormatValidatorFn = (input: unknown) => { if (typeof input !== 'string') return true; return /^pattern$/.test(input); }; ``
- Register it in the
inbuiltValidatorsrecord:
``typescript const inbuiltValidators = { // ...existing 'my-format': myFormatValidator, }; ``
- Add tests in
test/spec/format-validators.spec.ts.
Adding a new option
- Add the option to
ZSchemaOptionsinsrc/z-schema-options.ts. - Add a default value in
defaultOptions. - If the option is part of
strictMode, add it to thestrictModeblock innormalizeOptions. - Document it in
docs/options.md. - Write tests.
Implementing a new JSON Schema keyword
- Add validation logic in the appropriate
src/validation/*.tsmodule (e.g.,array.tsfor array keywords,object.tsfor object keywords,combinators.tsfor applicators) orsrc/schema-validator.ts(for schema-level validation). The orchestration layer insrc/json-validation.tscalls into these modules. - Guard with a draft version check if the keyword is draft-specific.
- Remove relevant entries from
excludedFiles/excludedTestsintest/spec/json-schema-test-suite.common.ts. - Run the JSON Schema Test Suite to confirm compliance:
``bash npx vitest run --silent=false --project node -t "draft2020-12/newKeyword" ``
- Export any new types through
src/index.ts.
Modifying existing behavior
- Find the relevant module using the codebase map above.
- Make changes following code conventions (see below).
- Run the full test suite — regressions often appear in other drafts.
Test framework
- Vitest with
globals: true. - Two projects: node and browser (Playwright: Chromium, Firefox, WebKit).
- Tests live in
test/spec/.
File naming
| Suffix | Runs in | |
|---|---|---|
*.spec.ts | Both node and browser | |
*.node-spec.ts | Node only | |
*.browser-spec.ts | Browser only |
Running tests
Test pattern
JSON Schema Test Suite
Official test cases loaded via test/spec/json-schema-test-suite.common.ts. To enable tests for a newly implemented feature, remove entries from excludedFiles / excludedTests and confirm they pass.
Code conventions
- TypeScript
strict: true, ESM with.jsimport extensions insrc/ .tsimport extensions intest/(viaallowImportingTsExtensions)import typefor type-only imports (enforced by oxlint)- Import order: type-only → side-effect → node builtins → packages → relative
- oxfmt: 120 char width, single quotes, trailing commas (es5), semicolons
- Classes/types:
PascalCase— functions/variables:camelCase— errors:UPPER_SNAKE_CASE - All public API exported through
src/index.ts - Internal types stay unexported
- Schemas in
src/schemas/are generated byscripts/copy-schemas.mts— do not edit manually json-schema-spec/is a git submodule — do not commit changes to it
PR checklist
Reference files
- references/architecture-details.md — Full module dependency diagram, factory pattern, build outputs, and internal types
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/contributing-to-z-schema/SKILL.md
Popularity
- Repository stars
- 341
- Repository forks
- 91
- Repository npm downloads, 7 days
- 1,457,061
- 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 22 Mar 2026, 7 months ago.
Extension points
hookPre/post lifecycle hooks
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/contributing-to-z-schema)