Build type-safe validated forms in React using React Hook Form and Zod. Single schema can validate on client and server with TypeScript inference via z.infer.
Use when building forms with validation, integrating project Field/Input patterns, multi-step wizards, useFieldArray, fixing uncontrolled/controlled warnings, resolver errors, or async validation.
설치
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
Build type-safe validated forms in React using React Hook Form and Zod. Single schema can validate on client and server with TypeScript inference via z.infer.
Use when building forms with validation, integrating project Field/Input patterns, multi-step wizards, useFieldArray, fixing uncontrolled/controlled warnings, resolver errors, or async validation.
user-invocable
false
allowed-tools
Bash(npm *), Bash(pnpm *), Bash(bun *)
React Hook Form + Zod
Suggested versions (verify against your lockfile): react-hook-form, zod, @hookform/resolvers.
Register with contacts.${index}.name (or equivalent) and read nested errors with optional chaining.
Server validation
Reuse the same schema (or a stricter server variant) on the API. Client validation is not a security boundary.
Map API field errors with setError from useForm.
UI in this repo
Prefer project Field, Input, and related primitives from @/shared/components/ui per existing patterns. Wire them with Controller or register depending on whether the component forwards a ref.
Performance
Avoid watch() without arguments; prefer watch("fieldName") when you need one value.
Prefer register over Controller for plain inputs.
Rules of thumb
Always provide defaultValues for fields you register (avoids uncontrolled → controlled warnings).
Never skip server-side validation for persisted or privileged actions.
One primary resolver (zodResolver); merge Zod schemas instead of stacking competing resolvers.
Do not use array index as React key for useFieldArray rows.