zod4
Installation
SKILL.md
Zod 4 Expert Guide
Zod 4 is a major release with significant performance improvements, reduced TypeScript compilation times, and a cleaner API. This skill covers migration from v3 and idiomatic Zod 4 usage.
Quick Migration Checklist
Before diving deep, address these high-impact breaking changes:
| Change | Zod 3 | Zod 4 |
|---|---|---|
| Record schemas | z.record(z.string()) |
z.record(z.string(), z.string()) |
| Strict objects | .strict() |
z.strictObject({...}) |
| Passthrough | .passthrough() |
z.looseObject({...}) |
| Error formatting | err.format() |
z.treeifyError(err) |
| Coerce input type | string |
unknown |