zod

Validates TypeScript data with Zod schemas, safe parsing, and structured error handling.

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

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 established patterns leads to unsafe type handling, unhandled parse exceptions, cryptic error messages, and duplicated schemas that drift out of sync across a TypeScript codebase. ## Core Features & Use Cases - Schema Definition Guidance: 43 rules across 8 prioritized categories covering primitives, enums, coercion, string validations, and avoiding z.any() in favor of z.unknown(). - Parsing & Error Handling Patterns: Correct use of safeParse(), parseAsync() for async refinements, flatten() for form errors, and custom or internationalized error messages. - Composition & Performance: Rules for pick/omit/partial/extend, discriminated unions, recursive schemas with z.lazy(), schema caching, and Zod Mini for bundle-sensitive apps. - Use Case: When building an API endpoint that accepts user registration data, apply these rules to define a strict schema with coercion, validate with safeParse at the boundary, and return flattened field-level errors to the client. ## Quick Start Ask the agent to review or write a Zod schema for your form or API payload following the zod best practices rules.

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 or result.error.flatten() to display field-level errors.

What is the difference between z.any() and z.unknown() in Zod?

z.any() bypasses TypeScript's type system entirely, while z.unknown() accepts any value but forces type narrowing before use. Prefer z.unknown() to preserve type safety when the input shape is not yet known.

Should I use parse() or parseAsync() for async refinements?

Use parseAsync() or safeParseAsync() whenever a schema includes async refine or transform functions, such as database lookups. Calling synchronous parse() with async refinements throws an error at runtime.

How do I create an update schema from an existing Zod object?

Call .partial() on the base schema to make all fields optional, which keeps the update schema in sync automatically. Use .pick() and .omit() to derive variants like public views or create inputs without duplicating field definitions.

Does Zod support recursive schemas for nested data?

Yes, use z.lazy() with an explicit TypeScript type annotation to define self-referential schemas such as trees, nested comments, or arbitrary JSON. Direct self-reference without z.lazy() fails because the variable is used before declaration.

When should I use Zod Mini instead of full Zod?

Use Zod Mini for bundle-sensitive frontend applications where size matters; it is about 1.9kb gzipped versus roughly 17kb for full Zod. The tradeoff is a reduced API surface, so verify the methods you need are included.