
Zod Schema Validation
Practical Zod guidance for TypeScript schemas, type inference, parsing, forms, and API validation.
- skills.sh installs
- 1.2K
- GitHub stars
- 313
- last updated
- Aug 21, 2026
What it does
- Covers basic schema design,
z.infertype derivation, and composing schemas with.extend(),.merge(),.pick(), and.omit() - Includes safe parsing with
.safeParse(),.transform()and.refine()patterns, and structured errors via.format() - Provides form integration with react-hook-form through
@hookform/resolvers/zodand API validation for bodies, query, and path params - Designed for TypeScript applications that need validation at system boundaries and advanced patterns like discriminated unions
Install
$ npx -y skills add mindrally/skills --skill zod-schema-validation -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Zod Schema Validation
You are an expert in Zod schema validation and type inference for TypeScript applications.
Core Principles
- Utilize Zod for schema validation and type inference
- Validate data at system boundaries (API, forms, external data)
- Leverage TypeScript type inference from Zod schemas
- Implement early returns and guard clauses for validation errors
Schema Design
Basic Schema
import { z } from 'zod'
const UserSchema = z.object({
id: z.string().uuid(),
email: z.string().email(),
name: z.string().min(1).max(100),
age: z.number().int().positive().optional(),
role: z.enum(['admin', 'user', 'guest']),
createdAt: z.date(),
})
type User = z.infer<typeof UserSchema>
Best Practices
- Define schemas close to where they're used
- Use
.inferto derive TypeScript types - Compose schemas using
.extend(),.merge(),.pick(),.omit() - Create reusable base schemas for common patterns
Validation Patterns
Safe Parsing
const result = UserSchema.safeParse(data)
if (!result.success) {
console.error(result.error.format())
return
}
// result.data is typed as User
Details
- Repository
- github.com/mindrally/skills
- Categories
- Frontend & UI Code, Backend & APIs
- First seen
- Jun 3, 2026
More from mindrally/skills
All 240- Rabbitmq Development1.2K
- Analytics Data Analysis1.2K
- Docker1.2K
- Nextauth Authentication1.2K
- Lottie1.2K
- Ux Design1.2K
- Gitlab Workflow1.1K
- Playwright1.1K
- Php Development1.1K
- Fpga1.1K
- Python Testing1.1K
- Systemverilog1.1K
- Mqtt Development1.1K
- Html1.1K
- Drizzle Orm1.1K
- Vuejs Typescript Best Practices1.1K
- Matplotlib Best Practices1.1K
- Kubernetes1.1K
- Prisma1.1K
- Quarkus1.1K
- Clean Architecture1.1K
- Numpy Best Practices1.1K
- Python1.1K
- Optimized Nextjs Typescript1.1K
Similar to Zod Schema Validation
More Frontend & UI Code
zod-validation-utilitiesgiuseppe-trisciuoglio/developer-kit4K installsReusable Zod v4 schema patterns for type-safe validation of APIs, forms, and config with inferred types.
zodpproenca/dot-skills7.3K installsBest-practice rules for Zod schema definition, safe parsing, type inference, and error handling in TypeScript.
zod-4gentleman-programming/gentleman-skills236 installsZod 4 schema validation patterns with migration guidance for the breaking changes from Zod 3.
fastify-typescriptmindrally/skills899 installsOpinionated Fastify and TypeScript guidance for typed APIs with schema validation, Prisma, and testing.
typescript-best-practicesalleneubank/claude-code2.9K installsType-first TypeScript idioms covering discriminated unions, branded types, Zod runtime validation, and type-fest utilities.