zod-validation
Installation
SKILL.md
Zod Validation Patterns
Core Concepts
Zod provides runtime validation with automatic TypeScript type inference — define the schema once, get the type for free:
import { z } from "zod";
const UserSchema = z.object({
id: z.string().uuid(),
name: z.string().min(1),
email: z.string().email(),
role: z.enum(["admin", "member", "viewer"]),
createdAt: z.coerce.date(),
});
type User = z.infer<typeof UserSchema>;