What problem does it solve?
Zod eliminates the risk of accepting malformed data by giving you a single source of truth for both runtime validation and TypeScript types, so your forms, APIs, and data boundaries stay consistent.
Core Features & Use Cases
- Runtime validation + static type inference: define schemas once and reuse the inferred types across your codebase (e.g., request bodies, form inputs, DB-adjacent objects).
- Composable schema building: create complex structures with objects, arrays, unions, intersections, discriminated unions, and reusable primitives.
- Transformations and refined constraints: normalize inputs (trim, parse numbers/dates) and enforce custom rules with refine and superRefine, including object-level and async validations.
- Ergonomic error handling: use parse/safeParse patterns and ZodError details (including flattening) to produce actionable validation feedback.
- Integration-ready patterns: works naturally with typical app layers such as React form validation, tRPC inputs/outputs, Express middleware, and environment variable parsing.
Quick Start
Use the zod skill to validate incoming data against a Zod schema and automatically get a typed result when validation succeeds.