Zod v4

From jahands/prompts · View interactive version

Zod v4 is an AI agent skill from the GitHub repository jahands/prompts. Zod v4 coding guidelines and v3 migration reference. Use when writing, reviewing, or migrating code that uses Zod.

How to use this skill

Skill file

Most Zod code in training data is v3; write v4.

/** A registered user */
export type User = z.infer<typeof User>
export const User = z.object({...})

| v3 | v4 |

| ----------------------------------------- | ------------------------------------------- |

| z.string().email(), .url(), .uuid() | z.email(), z.url(), z.uuid() |

| z.string().ip() | z.ipv4(), z.ipv6() |

| z.string().datetime(), .date() | z.iso.datetime(), z.iso.date() |

| z.number().int() | z.int() (also z.int32(), z.float64()) |

| { message: '...' } | { error: '...' } |

| .strict(), .passthrough() | z.strictObject(), z.looseObject() |

| .format(), .flatten() | z.treeifyError(), z.flattenError() |

| z.function().args(...).returns(...) | z.function({ input: [...], output }) |

| .superRefine(), ctx.addIssue() | .check(), ctx.issues.push() |

| z.ZodIssueCode.custom | 'custom' |

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.