Conversation
Hand-written workflow skill for Zod schema validation, mirroring the mastra plugin pattern from #161. Single trigger-heavy SKILL.md plus three references (versions, schemas, parsing-and-errors) covering both Zod v3 and v4 with inline migration callouts. Key v3 → v4 differences surfaced: - err.format() / err.flatten() → z.treeifyError() / z.flattenError() - separate { message, errorMap } → unified { error } param - z.lazy + ZodType<T> annotation → property getters for recursion - .superRefine() (deprecated) → .check() - new in v4: z.codec, z.prettifyError, .overwrite, zod/mini No MCP server (zod has no official docs MCP server). Skills-only plugin with skills: ['./skills/'].
- .claude-plugin/marketplace.json: add zod entry pointing to ./plugins/zod - release-please-config.json: add plugins/zod with simple release-type and extra-files jsonpath $.version for plugin.json bumps - README.md: append Zod section after Portless mirroring existing entries
Mirrors the use-better-auth pattern: lead with `ask src zod` / `ask docs zod` to read the lockfile-pinned source (with comments and tests), demoting node_modules/zod/dist to a fallback for environments where ask isn't installed. - New 'Finding Documentation' section in SKILL.md showing the SRC=$(ask src zod) idiom for reading docs, verifying symbols, and finding canonical examples in tests - versions.md 'When in doubt' switched to ask-first verification with explicit @Version pinning examples for v4.3.6 and v3.25.76 - 'When typecheck or runtime fails' debug snippet now greps $(ask src zod)/packages/zod/src instead of node_modules/zod/dist
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new plugin for Zod, including a comprehensive skill set and reference documentation for both v3 and v4. The changes include updates to the marketplace configuration, README, and release-please settings. Several critical issues were identified in the documentation regarding incorrect versioning claims (hallucinating a 2026 release date for v4 and non-existent version numbers) and the misidentification of the current stable version. Additionally, the plugin metadata needs to be updated to credit the upstream organization rather than an individual contributor.
There was a problem hiding this comment.
3 issues found across 8 files
Confidence score: 4/5
- This PR is safe to merge; all noted issues are documentation inaccuracies with low to moderate user impact.
- Most significant:
plugins/zod/skills/use-zod/references/versions.mdhas an invalid recursive schema example (Selfis undefined), which could mislead readers copying the v4 snippet. - Also in
plugins/zod/skills/use-zod/references/parsing-and-errors.md, the.loose()API call is incorrect for v4 and should bez.looseObject(...)or legacy.passthrough(). - Pay close attention to
plugins/zod/skills/use-zod/references/versions.md,plugins/zod/skills/use-zod/references/parsing-and-errors.md,plugins/zod/skills/use-zod/SKILL.md- fix v4 example/API usage and release-year accuracy.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="plugins/zod/skills/use-zod/references/versions.md">
<violation number="1" location="plugins/zod/skills/use-zod/references/versions.md:84">
P2: The recursive schema example uses `Self`, which is undefined. This makes the v4 example invalid when copied; the getter should reference the schema variable itself.</violation>
</file>
<file name="plugins/zod/skills/use-zod/SKILL.md">
<violation number="1" location="plugins/zod/skills/use-zod/SKILL.md:34">
P3: Correct the Zod v4 release year; the current text says 2026, but official docs place the v4 root/npm transition in 2025.</violation>
</file>
<file name="plugins/zod/skills/use-zod/references/parsing-and-errors.md">
<violation number="1" location="plugins/zod/skills/use-zod/references/parsing-and-errors.md:225">
P2: The v4 migration guidance references `.loose()`, which is not a Zod v4 object API; use `z.looseObject(...)` (or legacy `.passthrough()`) instead.</violation>
</file>
Architecture diagram
sequenceDiagram
participant User as "User / Claude"
participant Skill as "NEW: Zod Skill Plugin"
participant Ask as "ask CLI Tool"
participant FS as "Local Filesystem (node_modules)"
participant Cache as "ask Cache (~/.ask/)*"
Note over User,Cache: Runtime Skill Activation (Trigger: "zod", "z.object", etc.)
User->>Skill: "How do I format errors in this project?"
Skill->>FS: "NEW: Check installed version (package.json)"
FS-->>Skill: "Return version (e.g., v4.3.6)"
alt "NEW: ask CLI available"
Skill->>Ask: "ask src zod / ask docs zod"
Ask->>FS: "Resolve version from lockfile"
alt "Data not in cache"
Ask->>Ask: "Fetch version-accurate source/docs"
Ask->>Cache: "Store source/docs"
end
Ask-->>Skill: "Return paths ($SRC, $DOCS)"
Skill->>Cache: "NEW: Search symbols/tests (rg/fd)"
Cache-->>Skill: "API signatures & usage examples"
else "fallback: ask CLI missing"
Skill->>FS: "Inspect node_modules/zod/dist"
FS-->>Skill: "Return compiled output/types"
end
Note over Skill: "NEW: Branch logic based on version (v3 vs v4)"
alt "Version is v4"
Skill->>Skill: "CHANGED: Select v4 APIs (treeifyError, .check())"
else "Version is v3"
Skill->>Skill: "Select v3 APIs (err.format(), .superRefine())"
end
Skill-->>User: "Return version-accurate advice & migration callouts"
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
The v4 docs (api.mdx@v4.3.6) present .superRefine() as the standard recommended API for multi-issue refinements, with .check() as a lower-level, more verbose alternative for performance-sensitive paths. The skill had this inverted in 6 places, claiming .superRefine was deprecated. - SKILL.md: rewrite the 'training-data miswritten' bullet to describe .superRefine as recommended, .check as lower-level - SKILL.md: drop the bogus 'flagged as deprecated' debug bullet - SKILL.md: include both .superRefine and .check (low-level) in the v4 row of the version-detection table - versions.md: rewrite the multi-issue refinement cheatsheet row - versions.md: rewrite the 'New in v4' bullet for .check - schemas.md: invert the multi-issue refinement example so .superRefine leads as canonical, .check follows as lower-level - schemas.md: drop the 'avoid .superRefine in v4' bullet entirely Caught by review-documentation-analyzer in /review:code-review-loop iteration 1.
Apply 3 of 4 review thread suggestions on PR #168: - plugin.json: author restructured to upstream-org form ('Zod' / https://github.com/colinhacks/zod) per the mastra and better-auth precedent (@gemini-code-assist) - SKILL.md: Zod 4 release year corrected from 2026 to 2025 (v4.0.1 published 2025-07-10) (@cubic-dev-ai) - versions.md: recursive-schema example fixed — replaced undefined 'Self' placeholder with a self-referencing 'Tree' variable so the snippet works as written (@cubic-dev-ai) Skipped: @cubic-dev-ai's claim that '.loose()' is not a v4 object API. Verified false against zod@v4.3.6 classic/schemas.ts:1269 ('inst.loose = () => inst.clone(...)'). The .loose() instance method exists alongside z.looseObject({...}) — both are valid.
Summary
Adds a new built-in
zodplugin atplugins/zod/, following the same pattern established in PR #161 (mastra) and PR #159 (better-auth). No MCP server — the plugin is a pure skills-only plugin, identical in structure to both precedents.What's New
Plugin layout
plugins/zod/mirrorsplugins/mastra/andplugins/better-auth/:.claude-plugin/plugin.json— plugin manifest (name, version, description, author, homepage, repository, license, keywords)skills/use-zod/SKILL.md— main skill definition; activates when Zod schemas, validation, or parsing are mentionedSkill files (4 total)
skills/use-zod/SKILL.mdskills/use-zod/versions.mdskills/use-zod/schemas.mdskills/use-zod/parsing-and-errors.md.parse,.safeParse,.parseAsync) and error handlingNo MCP server
Zod is a pure schema-validation library with stable, well-documented APIs. A skill providing inline reference is sufficient; no runtime server is needed.
v3 ↔ v4 migration callouts surfaced in the skill
format/flatten→treeifyError/flattenError/prettifyErrormessage/errorMapissue params → unifiederrorparamz.lazy+ TypeScript annotation → property getter pattern for recursive schemas.superRefinedeprecated →.checkz.codec,.overwrite,zod/minilightweight buildaskCLI integration (mirrors better-auth from PR #159)The skill instructs Claude to resolve version-accurate docs and source via the
askCLI tool first (ask_public_library zod), falling back tonode_modules/zod/. This ensures advice reflects the installed version rather than training-data snapshot.Registry changes
.claude-plugin/marketplace.jsonzodpluginrelease-please-config.jsonplugins/zodREADME.mdzodto the built-in plugins tableNew files
Modified registry files
Verification
claude plugin validate plugins/zodpasses. Thehomepage/repositorywarning visible in CI output is a pre-existing issue onmain(affects other plugins as well) and is unrelated to this PR.Summary by cubic
Adds a built-in
zodskills-only plugin with version-aware help for Zod v3 and v4 (schemas, parsing, errors, and migrations). Mirrors themastra/better-authpattern, usesaskfor version detection, and requires no MCP server.New Features
plugins/zod/withskills/use-zod/andreferences/(schemas, parsing-and-errors, versions) covering common APIs, error handling, and v3↔v4 differences.ask(ask src zod,ask docs zod) withnode_modules/zod/fallback.err.format/err.flatten→z.treeifyError/z.flattenError;{ message, errorMap }→{ error }; recursion via getters; newz.codec(v4.1+),.overwrite, andzod/mini..claude-plugin/marketplace.json, added release config inrelease-please-config.json, and updated README.Bug Fixes
.superRefineremains the recommended multi-issue API in v4;.checkis a lower-level, performance-focused alternative.Zod.Written for commit 0af26ed. Summary will update on new commits.