zod

Validates TypeScript data with Zod schemas using 43 prioritized best-practice rules.

Updated Jun 8, 2026
One-click install
npx skills add https://github.com/raulisai/eva02 --skill zod-raulisai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: zod
Source: https://github.com/raulisai/eva02/tree/main/.agents/skills/zod
Command: npx skills add https://github.com/raulisai/eva02 --skill zod-raulisai

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires zod, and includes references (resource) and assets (resource) components.

What problem does it solve? Writing Zod validation code without guidance leads to unsafe schemas, unhandled parse exceptions, cryptic error messages, and duplicated type definitions that drift out of sync with validation logic. ## Core Features & Use Cases - Prioritized Rule Set: 43 rules across 8 categories (schema definition, parsing, type inference, error handling, object schemas, composition, refinements, performance), each ranked by impact from CRITICAL to LOW-MEDIUM. - Incorrect vs. Correct Examples: Every rule shows real TypeScript code comparing the wrong approach with the right one, plus impact explanations and guidance on when not to apply the pattern. - Use Case: When building a NestJS API endpoint that accepts user registration data, apply the safeParse, custom error messages, and boundary validation rules to reject invalid input with actionable feedback instead of crashing the server. ## Quick Start Ask the agent to review your Zod schema file and apply the validation best practices, such as converting parse() calls to safeParse() for user input.

Frequently Asked Questions about zod

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I validate user input with Zod safeParse?

Use safeParse() instead of parse() for user input so validation failures return a result object instead of throwing exceptions. Check result.success, then read result.error.issues to display all validation problems to the user at once.

What is the difference between z.infer and z.input in Zod?

z.infer (z.output) captures the post-transform type of a schema, while z.input captures the pre-transform shape. Use z.input when a function accepts raw data before transforms run, and z.infer for validated output.

Should I use z.any() or z.unknown() in TypeScript schemas?

Use z.unknown() instead of z.any(). z.any() bypasses TypeScript's type system entirely, while z.unknown() forces type narrowing before the value can be used, preserving type safety.

Why does Zod parse() throw with async refinements?

Synchronous parse() cannot execute async refine or transform functions and throws an error. Use parseAsync() or safeParseAsync() whenever a schema includes asynchronous validation such as database lookups.

When should I use strict() vs strip() on Zod objects?

Use strict() to reject unknown keys when enforcing API contracts or catching schema mismatches. Use strip() (the default) to silently remove extra keys when cleaning data, and passthrough() only when proxying unvalidated fields.

How do I reduce Zod bundle size for frontend apps?

Use Zod Mini, which is about 1.9kb gzipped compared to roughly 17kb for full Zod. Also cache schema instances at module level and lazy-load large schemas to reduce initial bundle and parse time.