File contents Zod
Introduced in zod@4.0.
Introduced in zod@4.0.
Available Resources
Primitives
Literals
Strings
String formats
Template literals
Numbers
Integers
BigInts
Booleans
Dates
Enums
Stringbools [#stringbool]
Nullables
Nullish
Unknown
Never
Objects
spread syntax
a TypeScript limitation
Recursive objects
Arrays
Tuples
Unions
Exclusive unions (XOR)
Discriminated unions
Intersections
Records
Maps
Sets
Files
Promises
Instanceof
Refinements
Codecs
stringToNumber
URL: /codecs#stringtonumber
stringToInt
stringToBigInt
URL: /codecs#stringtobigint
numberToBigInt
URL: /codecs#numbertobigint
isoDatetimeToDate
URL: /codecs#isodatetimetodate
epochSecondsToDate
URL: /codecs#epochsecondstodate
epochMillisToDate
URL: /codecs#epochmillistodate
jsonCodec
utf8ToBytes
bytesToUtf8
base64ToBytes
URL: /codecs#base64tobytes
base64urlToBytes
URL: /codecs#base64urltobytes
hexToBytes
stringToURL
stringToHttpURL
URL: /codecs#stringtohttpurl
uriComponent
URL: /codecs#uricomponent
stringToBoolean
URL: /codecs#stringtoboolean
Pipes
Transforms
Defaults
Prefaults
Catch
Branded types
Readonly
JSON
Functions
Custom
Apply
Defining a schema
Parsing data
Handling errors
Inferring types
How encoding works
Resources
Total TypeScript Zod Tutorial
Fixing TypeScript's Blindspot: Runtime Typechecking
Validate Environment Variables With Zod
API Libraries
Form Integrations
Zod to X
X to Zod
Mocking Libraries
Powered by Zod
Zod Utilities
The error param
Per-parse error customization
Global error customization
Internationalization
Error precedence
z.treeifyError()
z.prettifyError()
z.formatError()
z.flattenError()
Introduction
Features
Installation
Requirements
Ecosystem
Resources
URL: /ecosystem?id=resources
API Libraries
URL: /ecosystem?id=api-libraries
Form Integrations
URL: /ecosystem?id=form-integrations
Zod to X
URL: /ecosystem?id=zod-to-x
X to Zod
URL: /ecosystem?id=x-to-zod
Mocking Libraries
URL: /ecosystem?id=mocking-libraries
Powered by Zod
URL: /ecosystem?id=powered-by-zod
tRPC
React Hook Form
zshy
Sponsors
z.fromJSONSchema()
z.toJSONSchema()
Conversion
Registries
Do I need to depend on Zod?
How to configure peer dependencies?
How to support Zod 4?
Do I need to publish a new major version?
How to support Zod 3 and Zod 4 simultaneously?
How to support Zod and Zod Mini simultaneously?
How to accept user-defined schemas?
Registries
Metadata
Custom registries
On deck: Zod 4
Zod's current funding story
The Clerk fellowship
OSS, funding models, and trying new things
ZodError
z.coerce updates
.default() updates
z.object()
z.nativeEnum() deprecated
z.array()
z.promise() deprecated
z.function()
.refine()
z.record()
z.intersection()
Internal changes
100x reduction in tsc instantiations
2x reduction in core bundle size
Introducing Zod Mini
Metadata
JSON Schema conversion
Recursive objects
File schemas
Internationalization
Error pretty-printing
Top-level string formats
Template literal types
Number formats
Stringbool
Simplified error customization
Upgraded z.discriminatedUnion()
Multiple values in z.literal()
Refinements live inside schemas
An extensible foundation: zod/v4/core
Wrapping up
Versioning in Zod 4
Why?
Schemas
Internals
Parsing
Checks
Errors
Issues
Tree-shaking
When (not) to use Zod Mini
ZodMiniType
No default locale
Additional Resources (Optional)
Optionals
How to Use This Skill
Reference these resources when working with Zod.
1 --- 2 name: zod 3 description: Introduced in `zod@4.0`. 4 --- 5 6 # Zod 7 8 > Introduced in `zod@4.0`. 9 10 Introduced in `zod@4.0`. 11 12 ## Available Resources 13 14 ### Primitives 15 16 ### Literals 17 18 ### Strings 19 20 ### String formats 21 22 ### Template literals 23 24 ### Numbers 25 26 ### Integers 27 28 ### BigInts 29 30 ### Booleans 31 32 ### Dates 33 34 ### Enums 35 36 ### Stringbools \[#stringbool] 37 38 ### Nullables 39 40 ### Nullish 41 42 ### Unknown 43 44 ### Never 45 46 ### Objects 47 48 - **spread syntax** 49 - URL: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax 50 51 - **a TypeScript limitation** 52 - URL: https://github.com/microsoft/TypeScript/pull/61505 53 54 ### Recursive objects 55 56 ### Arrays 57 58 ### Tuples 59 60 ### Unions 61 62 ### Exclusive unions (XOR) 63 64 ### Discriminated unions 65 66 ### Intersections 67 68 ### Records 69 70 ### Maps 71 72 ### Sets 73 74 ### Files 75 76 ### Promises 77 78 ### Instanceof 79 80 ### Refinements 81 82 ### Codecs 83 84 - ****`stringToNumber`**** 85 - URL: /codecs#stringtonumber 86 87 - ****`stringToInt`**** 88 - URL: /codecs#stringtoint 89 90 - ****`stringToBigInt`**** 91 - URL: /codecs#stringtobigint 92 93 - ****`numberToBigInt`**** 94 - URL: /codecs#numbertobigint 95 96 - ****`isoDatetimeToDate`**** 97 - URL: /codecs#isodatetimetodate 98 99 - ****`epochSecondsToDate`**** 100 - URL: /codecs#epochsecondstodate 101 102 - ****`epochMillisToDate`**** 103 - URL: /codecs#epochmillistodate 104 105 - ****`jsonCodec`**** 106 - URL: /codecs#jsoncodec 107 108 - ****`utf8ToBytes`**** 109 - URL: /codecs#utf8tobytes 110 111 - ****`bytesToUtf8`**** 112 - URL: /codecs#bytestoutf8 113 114 - ****`base64ToBytes`**** 115 - URL: /codecs#base64tobytes 116 117 - ****`base64urlToBytes`**** 118 - URL: /codecs#base64urltobytes 119 120 - ****`hexToBytes`**** 121 - URL: /codecs#hextobytes 122 123 - ****`stringToURL`**** 124 - URL: /codecs#stringtourl 125 126 - ****`stringToHttpURL`**** 127 - URL: /codecs#stringtohttpurl 128 129 - ****`uriComponent`**** 130 - URL: /codecs#uricomponent 131 132 - ****`stringToBoolean`**** 133 - URL: /codecs#stringtoboolean 134 135 ### Pipes 136 137 ### Transforms 138 139 ### Defaults 140 141 ### Prefaults 142 143 ### Catch 144 145 ### Branded types 146 147 ### Readonly 148 149 ### JSON 150 151 ### Functions 152 153 ### Custom 154 155 ### Apply 156 157 ### Defining a schema 158 159 ### Parsing data 160 161 ### Handling errors 162 163 ### Inferring types 164 165 ### How encoding works 166 167 ### Resources 168 169 - **Total TypeScript Zod Tutorial** 170 - URL: https://www.totaltypescript.com/tutorials/zod 171 172 - **Fixing TypeScript's Blindspot: Runtime Typechecking** 173 - URL: https://www.youtube.com/watch?v=rY_XqfSHock 174 175 - **Validate Environment Variables With Zod** 176 - URL: https://catalins.tech/validate-environment-variables-with-zod/ 177 178 ### API Libraries 179 180 ### Form Integrations 181 182 ### Zod to X 183 184 ### X to Zod 185 186 ### Mocking Libraries 187 188 ### Powered by Zod 189 190 ### Zod Utilities 191 192 ### The `error` param 193 194 ### Per-parse error customization 195 196 ### Global error customization 197 198 ### Internationalization 199 200 ### Error precedence 201 202 ### `z.treeifyError()` 203 204 ### `z.prettifyError()` 205 206 ### `z.formatError()` 207 208 ### `z.flattenError()` 209 210 ### Introduction 211 212 ### Features 213 214 ### Installation 215 216 ### Requirements 217 218 ### Ecosystem 219 220 - **Resources** 221 - URL: /ecosystem?id=resources 222 223 - **API Libraries** 224 - URL: /ecosystem?id=api-libraries 225 226 - **Form Integrations** 227 - URL: /ecosystem?id=form-integrations 228 229 - **Zod to X** 230 - URL: /ecosystem?id=zod-to-x 231 232 - **X to Zod** 233 - URL: /ecosystem?id=x-to-zod 234 235 - **Mocking Libraries** 236 - URL: /ecosystem?id=mocking-libraries 237 238 - **Powered by Zod** 239 - URL: /ecosystem?id=powered-by-zod 240 241 - **tRPC** 242 - URL: https://trpc.io 243 244 - **React Hook Form** 245 - URL: https://react-hook-form.com 246 247 - **zshy** 248 - URL: https://github.com/colinhacks/zshy 249 250 ### Sponsors 251 252 ### `z.fromJSONSchema()` 253 254 ### `z.toJSONSchema()` 255 256 ### Conversion 257 258 ### Registries 259 260 ### Do I need to depend on Zod? 261 262 ### How to configure peer dependencies? 263 264 ### How to support Zod 4? 265 266 ### Do I need to publish a new major version? 267 268 ### How to support Zod 3 and Zod 4 simultaneously? 269 270 ### How to support Zod and Zod Mini simultaneously? 271 272 ### How to accept user-defined schemas? 273 274 ### Registries 275 276 ### Metadata 277 278 ### Custom registries 279 280 ### On deck: Zod 4 281 282 ### Zod's current funding story 283 284 ### The Clerk fellowship 285 286 - **Auth.js** 287 - URL: https://authjs.dev/getting-started 288 289 ### OSS, funding models, and trying new things 290 291 ### `ZodError` 292 293 ### `z.coerce` updates 294 295 ### `.default()` updates 296 297 ### `z.object()` 298 299 ### `z.nativeEnum()` deprecated 300 301 ### `z.array()` 302 303 ### `z.promise()` deprecated 304 305 ### `z.function()` 306 307 ### `.refine()` 308 309 ### `z.record()` 310 311 ### `z.intersection()` 312 313 ### Internal changes 314 315 ### 100x reduction in `tsc` instantiations 316 317 ### 2x reduction in core bundle size 318 319 ### Introducing Zod Mini 320 321 ### Metadata 322 323 ### JSON Schema conversion 324 325 ### Recursive objects 326 327 ### File schemas 328 329 ### Internationalization 330 331 ### Error pretty-printing 332 333 ### Top-level string formats 334 335 ### Template literal types 336 337 ### Number formats 338 339 ### Stringbool 340 341 ### Simplified error customization 342 343 ### Upgraded `z.discriminatedUnion()` 344 345 ### Multiple values in `z.literal()` 346 347 ### Refinements live inside schemas 348 349 ### An extensible foundation: `zod/v4/core` 350 351 ### Wrapping up 352 353 ### Versioning in Zod 4 354 355 ### Why? 356 357 ### Schemas 358 359 ### Internals 360 361 ### Parsing 362 363 ### Checks 364 365 ### Errors 366 367 ### Issues 368 369 ### Tree-shaking 370 371 ### When (not) to use Zod Mini 372 373 ### `ZodMiniType` 374 375 ### No default locale 376 377 ## Additional Resources (Optional) 378 379 ### Optionals 380 381 ## How to Use This Skill 382 383 Reference these resources when working with Zod.
hk-vk/skills commit d5cea8edfe
Frequently asked questions How do I install the Zod skill? Run npx get-skill add hk-vk/zod in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
What does the Zod skill do? Introduced in `zod@4.0`. It is listed under Coding & Dev Tools on SkillMD.
Is Zod safe to use? This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
Which AI agents work with Zod? This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Is Zod free to use? Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
Who published Zod? hk-vk (@hk-vk) published this skill. Their other Agent Skills are listed on their SkillMD profile.