zod

Solid

TypeScript-first schema validation and type inference. Use for validating API requests/responses, form data, env vars, configs, defining type-safe schemas with runtime validation, transforming data, generating JSON Schema for OpenAPI/AI, or encountering missing validation errors, type inference issues, validation error handling problems. Zero dependencies (2kb gzipped).

Data & Documents 162 stars 25 forks Updated 2 weeks ago MIT

Install

View on GitHub

Quality Score: 88/100

Stars 20%
74
Recency 20%
90
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# Zod: TypeScript-First Schema Validation ## Overview Zod is a TypeScript-first validation library that enables developers to define schemas for validating data at runtime while automatically inferring static TypeScript types. With zero dependencies and a 2kb core bundle (gzipped), Zod provides immutable, composable validation with comprehensive error handling. ## Installation ```bash bun add zod # or bun add zod # or bun add zod # or yarn add zod ``` **Requirements**: - TypeScript v5.5+ with `"strict": true` in `tsconfig.json` - Zod 4.x (4.1.12+) **Important**: This skill documents **Zod 4.x** features. The following APIs require Zod 4 and are NOT available in Zod 3.x: - `z.codec()` - Bidirectional transformations - `z.iso.date()`, `z.iso.time()`, `z.iso.datetime()`, `z.iso.duration()` - ISO format validators - `z.toJSONSchema()` - JSON Schema generation - `z.treeifyError()`, `z.prettifyError()`, `z.flattenError()` - New error formatting helpers - `.meta()` - Enhanced metadata (Zod 3.x only has `.describe()`) - Unified `error` parameter - Replaces `message`, `invalid_type_error`, `required_error`, `errorMap` For Zod 3.x compatibility or migration guidance, see https://zod.dev ## Migrating from Zod v3 to v4 **Load `references/migration-guide.md` for complete v3 to v4 migration documentation.** ### Quick Summary Zod v4 introduces breaking changes for better performance: - **Error customization**: Use unified `error` parameter (replaces `message`, `invalid_type_erro...

Details

Author
secondsky
Repository
secondsky/claude-skills
Created
6 months ago
Last Updated
2 weeks ago
Language
TypeScript
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category