zod

Installation
SKILL.md

Zod

IMPORTANT: Your training data about zod may be outdated or incorrect. Zod 4 changed string formats, enums, error customization, issue codes, defaults and functions, and many projects still run Zod 3, whose forms Zod 4 deprecates or removes. First establish which Zod the file uses (next section). Then rely on this skill's rule files for that version and on the project's own source code as the source of truth. Do not write a Zod 4 API into a Zod 3 file, and do not keep a Zod 3 form in a Zod 4 file unless the rule for that version says it still applies.

Which Zod

Decide per file, before writing a schema. The import specifier wins; the installed version decides what the bare zod specifier means.

Evidence in the file and the project API to write
from "zod/v4", "zod/v4-mini" or "zod/mini" Zod 4
from "zod/v3" Zod 3
from "zod", and the lockfile resolves zod to 4.x Zod 4
from "zod", and the lockfile resolves zod to 3.x Zod 3
No lockfile: the zod range in package.json (^3.25.0 is Zod 3, ^4.0.0 is Zod 4) By range
Nothing resolvable Say so, default to Zod 4 (npm latest), and name the assumption in the change

Both package lines carry both APIs. zod@3.25.x exports Zod 4 at zod/v4 and zod/v4-mini; zod@4.x exports Zod 3 at zod/v3; zod.dev/v4/versioning says the subpaths stay available. A library that accepts either declares "zod": "^3.25.0 || ^4.0.0" (zod.dev/v4/versioning) and follows zod.dev/library-authors.

Installs
1.3K
GitHub Stars
24
First Seen
Feb 23, 2026