zod

Define and apply Zod validation best practices for TypeScript type safety.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

Zod best practices help developers build robust schemas, catch invalid data at boundaries, and maintain strong type safety in TypeScript apps.

Core Features & Use Cases

  • Comprehensive guidance across categories like Schema Definition, Parsing & Validation, Type Inference, Error Handling, Object Schemas, Schema Composition, Refinements & Transforms, and Performance.
  • Promotes safeParse usage, z.infer, discriminated unions, precise error reporting, and consistent error maps for multi-language UX.
  • Provides actionable patterns for production-grade validation and scalable data validation at API boundaries.

Quick Start

Read the quick reference in SKILL.md and the full compiled guide in AGENTS.md, then start applying the top-priority Zod practices to your schemas.

Frequently Asked Questions about zod

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

FAQPage Schema
How do I validate API boundaries with Zod in TypeScript?

Define Zod validation schemas using z.object and apply safeParse at API boundaries to catch invalid data flows without throwing exceptions. This approach ensures type safety and enables precise error reporting across your TypeScript application.

When should I use safeParse vs parse for schema validation in TypeScript?

Use safeParse instead of parse when handling untrusted API boundary data to avoid unhandled exceptions. SafeParse returns a structured success or error object, enabling robust error handling and precise error reporting for invalid data flows.

How do I infer TypeScript types from Zod schemas?

Infer TypeScript types from Zod schemas by applying z.infer to your schema definitions. This ensures your TypeScript types remain perfectly synchronized with runtime validation logic, eliminating manual type duplication across data flows.

What is the best way to handle complex object schemas with discriminated unions in Zod?

Handle complex object schemas by leveraging Zod discriminated unions to validate objects with shared fields and distinct variants. This approach ensures type-safe parsing and precise error handling for multi-shape data structures at API boundaries.

How do I customize error handling for Zod schema parsing?

Customize Zod error handling by implementing consistent error maps to format precise error reporting for multi-language user experiences. This standardizes validation feedback across API boundaries and data flows when parsing fails.

Does this Zod guidance cover schema composition and performance optimization?

The Zod guidance covers schema composition and performance optimization by providing actionable patterns for scalable data validation. It includes rules for composing schemas, applying transforms, and optimizing parsing performance in TypeScript apps.