Zod 4 is a major breaking release with real performance wins and faster TypeScript compilation, but you'll need to update your code. The biggest gotchas are z.record() now requiring two arguments instead of one, strict objects moving from .strict() to z.strictObject(), and .default() behavior changing in ways that'll bite you if you're using transforms. This guide walks through the migration with a quick reference table, covers new features like z.file() and z.templateLiteral(), and includes find-replace patterns for the common breaks. If you're maintaining a Zod 3 codebase or starting fresh with v4, this gives you the specifics without having to dig through changelog noise.
- skills.sh installs
- 289
- GitHub stars
- 9
- last updated
- Aug 21, 2026
Install
$ npx -y skills add kastalien-research/thoughtbox-dot-claude --skill zod4 --agent claude-codeInstalls into .claude/skills of the current project.
Files
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 |
Install Zod 4:
npm install zod@^4.0.0
For detailed breaking changes, see ./reference/breaking-changes.md.
Key Breaking Changes
1. z.record() Requires Two Arguments
// Zod 3 (BROKEN in v4)
z.record(z.string());
// Zod 4 (REQUIRED)
z.record(z.string(), z.string());
2. Strict/Loose Object Syntax
// Zod 3
z.object({ name: z.string() }).strict();
z.object({ name: z.string() }).passthrough();
Sponsors
Details
- Repository
- github.com/kastalien-research/thoughtbox-dot-claude
- Categories
- Documentation, Data Science & ML
- First seen
- Jun 3, 2026
