form-validation
Installation
SKILL.md
Form Validation
Schema-first validation using Zod as the single source of truth for both runtime validation and TypeScript types.
Quick Start
import { z } from 'zod';
// 1. Define schema (validation + types in one place)
const schema = z.object({
email: z.string().min(1, 'Required').email('Invalid email'),
age: z.number().positive().optional()
});
// 2. Infer TypeScript types (never manually define)
type FormData = z.infer<typeof schema>;