feat: add Zod schema validation and JSON Schema for skills.json autocompletion#12
Merged
feat: add Zod schema validation and JSON Schema for skills.json autocompletion#12
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a Zod-driven schema for skills.json with runtime validation and generates/publishes a JSON Schema to enable editor autocompletion via $schema.
Changes:
- Introduce
skillsManifestSchema(Zod) and validateskills.jsonat read time with improved errors. - Add
generate:schemascript to generateskills.schema.jsonfrom the Zod schema and publish it with the package. - Auto-inject a
$schemaURL into newly written/initialized manifests; update fixtures/tests accordingly.
Reviewed changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| skills.schema.json | New root JSON Schema artifact (generated) for reference/autocomplete. |
| skills.json | Adds $schema pointer for editor autocompletion in the repo sample manifest. |
| scripts/generate-schema.ts | New generator script converting Zod schema to JSON Schema and writing outputs. |
| package.json | Adds generate:schema script and tsx dev dependency. |
| pnpm-lock.yaml | Locks new dependencies (tsx, zod, zod-to-json-schema and transitive deps). |
| packages/skills-package-manager/src/config/schema.ts | Adds Zod schema as source of truth for manifest structure. |
| packages/skills-package-manager/src/config/types.ts | Switches SkillsManifest type to be inferred from Zod schema. |
| packages/skills-package-manager/src/config/readSkillsManifest.ts | Adds Zod validation + validation error reporting for invalid manifests. |
| packages/skills-package-manager/src/config/writeSkillsManifest.ts | Injects $schema when writing manifests and retains defaults. |
| packages/skills-package-manager/src/commands/init.ts | Ensures initialized manifests include $schema. |
| packages/skills-package-manager/skills.schema.json | New package-published JSON Schema artifact (generated). |
| packages/skills-package-manager/package.json | Publishes skills.schema.json and adds Zod-related dependencies. |
| packages/skills-package-manager/test/manifest.test.ts | Adds schema validation tests and updates expected manifest output. |
| packages/skills-package-manager/test/init.test.ts | Updates init tests to assert $schema is present. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)
package.json:17
generate:schemarelies onzod-to-json-schema, but it isn't declared in the rootdevDependencies, sopnpm generate:schemamay fail to resolve it. Add it to the root devDependencies (or move the script under the workspace package and run it viapnpm --filter ...).
"scripts": {
"prepare": "simple-git-hooks && pnpm run build",
"build": "pnpm -r --filter=!website build",
"build:website": "pnpm --filter website build",
"generate:schema": "tsx scripts/generate-schema.ts",
"bump": "bumpp -r --no-tag --no-push",
"test": "rstest run",
"lint": "biome lint",
"format": "biome format --write",
"check": "biome check",
"check:write": "biome check --write"
},
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/skills-package-manager/src/config/writeSkillsManifest.ts
Outdated
Show resolved
Hide resolved
…ompletion - Add Zod schema as single source of truth for skills.json structure - Implement runtime validation in readSkillsManifest with helpful error messages - Generate JSON Schema from Zod for editor autocompletion via unpkg - Add pnpm generate:schema script for schema regeneration - Auto-inject $schema field when writing new manifests - Add validation tests for the schema layer
fe6203a to
ae915b0
Compare
…ills.json validation - Add new error code EMANIFESTVAL for manifest validation errors - Use ManifestError instead of SkillError for validation failures - Add helpful error message pointing to JSON Schema reference
ae915b0 to
8957453
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds Zod-based schema validation and JSON Schema generation for
skills.json, enabling:$schemapointing to unpkg for IDE supportKey changes:
skillsManifestSchemainsrc/config/schema.tsusing ZodreadSkillsManifest()now validates with helpful validation error messagespnpm generate:schemagenerates JSON Schema from Zod$schemafield in new manifests pointing to unpkgRelated Links
None
Checklist