# Zod

> Introduced in `zod@4.0`.

- Skill: `hk-vk/zod` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx get-skill add hk-vk/zod`
- Raw SKILL.md: https://api.skillmd.com/api/skills/hk-vk/zod/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: hk-vk (https://skillmd.com/u/hk-vk)
- Updated: 2026-09-21
- Page: https://skillmd.com/skills/hk-vk/zod

---


# 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**
  - URL: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax

- **a TypeScript limitation**
  - URL: https://github.com/microsoft/TypeScript/pull/61505

### Recursive objects

### Arrays

### Tuples

### Unions

### Exclusive unions (XOR)

### Discriminated unions

### Intersections

### Records

### Maps

### Sets

### Files

### Promises

### Instanceof

### Refinements

### Codecs

- ****`stringToNumber`****
  - URL: /codecs#stringtonumber

- ****`stringToInt`****
  - URL: /codecs#stringtoint

- ****`stringToBigInt`****
  - URL: /codecs#stringtobigint

- ****`numberToBigInt`****
  - URL: /codecs#numbertobigint

- ****`isoDatetimeToDate`****
  - URL: /codecs#isodatetimetodate

- ****`epochSecondsToDate`****
  - URL: /codecs#epochsecondstodate

- ****`epochMillisToDate`****
  - URL: /codecs#epochmillistodate

- ****`jsonCodec`****
  - URL: /codecs#jsoncodec

- ****`utf8ToBytes`****
  - URL: /codecs#utf8tobytes

- ****`bytesToUtf8`****
  - URL: /codecs#bytestoutf8

- ****`base64ToBytes`****
  - URL: /codecs#base64tobytes

- ****`base64urlToBytes`****
  - URL: /codecs#base64urltobytes

- ****`hexToBytes`****
  - URL: /codecs#hextobytes

- ****`stringToURL`****
  - URL: /codecs#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**
  - URL: https://www.totaltypescript.com/tutorials/zod

- **Fixing TypeScript's Blindspot: Runtime Typechecking**
  - URL: https://www.youtube.com/watch?v=rY_XqfSHock

- **Validate Environment Variables With Zod**
  - URL: https://catalins.tech/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**
  - URL: https://trpc.io

- **React Hook Form**
  - URL: https://react-hook-form.com

- **zshy**
  - URL: https://github.com/colinhacks/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

- **Auth.js**
  - URL: https://authjs.dev/getting-started

### 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.
