type-driven-zod-boundaries

Pair TypeScript domain types with Zod v4 schemas to validate module boundaries.

1|Updated Jan 13, 2023
One-click install
npx skills add https://github.com/theodrosyimer/.dotfiles --skill type-driven-zod-boundaries
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: type-driven-zod-boundaries
Source: https://github.com/theodrosyimer/.dotfiles/tree/main/claude/skills/dev__type-driven-zod-boundaries
Command: npx skills add https://github.com/theodrosyimer/.dotfiles --skill type-driven-zod-boundaries

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill helps developers enforce type-safe boundary contracts by pairing plain TypeScript domain types with Zod boundary schemas, ensuring a clean separation between business rules and external input validation.

Core Features & Use Cases

  • Boundary schemas validate external input at module edges and derive boundary types automatically with z.infer.
  • Operation-specific schemas (Create/Update) provide structured input for use cases without duplicating fields.
  • Form integration guidance and sample schemas support UI frameworks like React Hook Form.
  • Schema evolution guidance covers additive changes and versioned migrations to keep backwards compatibility.

Quick Start

Define your domain types as plain TypeScript, create Zod boundary schemas using zod/v4, and derive boundary types with z.infer to parse incoming data at the boundary.

Frequently Asked Questions about type-driven-zod-boundaries

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I validate external input at module boundaries using Zod?

You validate external input at module boundaries by pairing plain TypeScript domain types with Zod boundary schemas. This enforces type-safe boundary contracts, ensuring a clean separation where business logic lives in entities while boundaries validate structure.

What is the best way to separate business rules from input validation in TypeScript?

Separating business rules from input validation in TypeScript is best achieved by defining plain domain types for entities and using Zod boundary schemas at module edges. Boundary schemas validate external data, while entities retain business logic.

How do I create operation-specific schemas for Create and Update flows with Zod?

You create operation-specific schemas for Create and Update flows by defining distinct Zod boundary schemas for each operation. This provides structured input for use cases without duplicating fields across your domain types.

Does this type-driven boundary schema approach work with React Hook Form?

Yes, this type-driven boundary schema approach works with React Hook Form. The skill provides form integration guidance and sample schemas to support UI frameworks, allowing you to derive form types directly from your Zod boundary schemas.

Do I need Zod v4 to use type-driven boundary schemas?

Yes, you need Zod v4 to implement type-driven boundary schemas. The skill requires Zod v4 alongside TypeScript domain types to derive boundary types automatically with z.infer and validate inputs at feature boundaries.

How do I handle schema evolution and backwards compatibility with Zod boundary schemas?

You handle schema evolution with Zod boundary schemas by following the provided schema evolution guidance, which covers additive changes and versioned migrations to ensure backwards compatibility as your feature boundaries expand.