api-contracts-and-zod-validation
Installation
SKILL.md
API Contracts and Zod Validation
Generate Zod schemas with TypeScript type inference for forms, API routes, and Server Actions. Validate inputs in Server Actions or route handlers with runtime type checking.
Core Capabilities
1. Generate Zod Schemas from TypeScript Types
When creating API contracts or form validations:
- Analyze existing TypeScript interfaces or types
- Generate equivalent Zod schemas with proper validation rules
- Ensure bidirectional type compatibility (Zod -> TypeScript)
- Use
z.infer<typeof schema>for automatic type inference
2. Form Validation Schemas
To create form validation with Zod: