/api-contracts-and-zod-validation:api-contracts-and-zod-validationfrom api-contracts-and-zod-validation
Generates Zod schemas and TypeScript types for forms, API routes, and Server Actions with runtime validation. Includes an automated TypeScript-to-Zod schema generator script.
Ships in api-contracts-and-zod-validation. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
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.
When creating API contracts or form validations:
z.infer<typeof schema> for automatic type inferenceTo create form validation with Zod:
references/zod_patterns.md for common validation patternsTo add validation to API endpoints or Server Actions:
.parse() or .safeParse()Use scripts/generate_zod_schema.py to automate schema generation:
python scripts/generate_zod_schema.py --input types/entities.ts --output schemas/entities.ts
The script:
Automated TypeScript-to-Zod schema generator. Parses TypeScript AST and generates equivalent Zod schemas.
Common Zod validation patterns including:
Pre-built Zod schema templates:
form_schema_template.ts - Basic form validationapi_route_schema_template.ts - API route request/responseserver_action_schema_template.ts - Server Action input/outputentity_schema_template.ts - Database entity validationscripts/generate_zod_schema.py or templates.safeParse() at the beginning of the action.safeParse() instead of .parse() to avoid throwing exceptionsz.infer<typeof schema> for automatic TypeScript typesCommon use cases for worldbuilding applications:
Consult references/zod_patterns.md for specific validation patterns applicable to worldbuilding entities.
assets/schema_templates/api_route_schema_template.ts (opens in a new tab)assets/schema_templates/entity_schema_template.ts (opens in a new tab)assets/schema_templates/form_schema_template.ts (opens in a new tab)assets/schema_templates/server_action_schema_template.ts (opens in a new tab)references/zod_patterns.md (opens in a new tab)scripts/generate_zod_schema.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
npx claudepluginhub hopeoverture/worldbuilding-app-skills --plugin api-contracts-and-zod-validation