add-form-validation

Validate React forms end-to-end with Zod schemas.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/PeterCowling/base-shop --skill add-form-validation
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: add-form-validation
Source: https://github.com/PeterCowling/base-shop/tree/main/.claude/skills/add-form-validation
Command: npx skills add https://github.com/PeterCowling/base-shop --skill add-form-validation

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill enables end-to-end type-safe form validation in React apps by modeling the form data with Zod schemas and enforcing validation on both the client and server sides.

Core Features & Use Cases

  • Schema-driven validation: define shared Zod schemas in schemas/<formName>.ts to ensure consistency between client and server.
  • Form integration: use react-hook-form with zodResolver to provide real-time validation, errors, and accessible form controls.
  • Server-side validation: validate inputs in server actions or endpoints before processing.
  • Progressive enhancement: client-side validation enhances usability while server-side validation ensures security.

Quick Start

Create a schemas/<formName>.ts with a Zod schema, build a form component using useForm and zodResolver, and implement a server action to process validated data.

Frequently Asked Questions about add-form-validation

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

FAQPage Schema
How do I set up type-safe form validation with Zod and react-hook-form?▼

Type-safe form validation with Zod and react-hook-form is set up by defining a shared Zod schema and integrating it into your form component using useForm and the zodResolver. This provides real-time client-side validation and accessible error handling.

What is the best way to share validation schemas between client and server in React?▼

Sharing validation schemas between client and server involves defining reusable Zod schemas in a shared file like schemas/formName.ts. This ensures consistency between client-side form state and server-side validation logic across your React application.

Do I need TypeScript to use Zod schemas with react-hook-form?▼

TypeScript is required to achieve end-to-end type-safe form validation with Zod and react-hook-form. It allows the inferred types from your Zod schemas to automatically propagate through your form controls and server action handlers.

How does progressive enhancement work with React form validation?▼

Progressive enhancement in React form validation works by using client-side validation to enhance usability with real-time feedback, while relying on server-side validation via server actions to enforce security and data integrity when JavaScript is unavailable.

Can I reuse a single Zod schema for both client-side hooks and server action validation?▼

You can reuse a single Zod schema for both client-side react-hook-form integration and server action validation. Defining schemas in shared modules ensures your validation rules remain consistent and type-safe across the entire data flow.