react-hook-form
React Hook Form performance optimization for client-side form validation using useForm, useWatch, useController, useFieldArray, and the v7.55+ subscribe() API. This skill should be used when building client-side controlled forms with React Hook Form library. This skill does NOT cover React 19 Server Actions, useActionState, or server-side form handling (use react-19 skill for those).
Security Assessment
Detected risks:
About react-hook-form
react-hook-form is a performance optimization guide for building client-side controlled forms with the React Hook Form library. It packages community best practices into 45 rules across 8 categories, prioritized by impact, to steer form development, automated refactoring, and code generation. The skill targets a recurring pain point in React forms: unnecessary re-renders and misconfigured subscriptions that degrade performance as forms grow. It applies when writing new forms, configuring useForm options, subscribing to values with watch, useWatch, or the v7.55+ subscribe() API, integrating controlled UI components, and reviewing forms for performance issues.
The rules are organized by priority prefix. Form Configuration (formcfg-) and Field Subscription (sub-) are marked CRITICAL, covering guidance such as using onSubmit validation mode, providing defaultValues, enabling shouldUnregister for dynamic forms, preferring useWatch over watch for isolated re-renders, and using subscribe() for non-UI side effects like analytics and autosave. HIGH-priority categories cover Controlled Components (ctrl-, e.g. isolating inputs, avoiding double registration with useController) and Validation Patterns (valid-, e.g. defining schemas outside the component for resolver caching, surfacing server errors via setError('root.serverError', ...)). Lower-priority categories address Field Arrays (using field.id as key), State Management, Integration Patterns for MUI and shadcn, and Advanced Patterns like wrapping FormProvider children with React.memo. Each rule has a dedicated reference file under references/{prefix}-{slug}.md with explanations and code examples, and a full compiled guide lives in AGENTS.md.
The skill is aimed at frontend developers already committed to React Hook Form who need reliable, performance-conscious patterns. It explicitly does not cover React 19 Server Actions, useActionState, or server-side form handling (deferring to a react-19 skill), and notes that TanStack Form may fit deeply nested type-safe forms better, while trivial single-input forms may be simpler with uncontrolled form plus FormData. It references companion skills for Zod schema validation and UI/UX form design.
FAQ
When should I use this skill?
Reference it when writing new React Hook Form forms, configuring useForm options (mode, defaultValues, validation), subscribing to values with watch/useWatch/subscribe, integrating controlled UI components like MUI or shadcn, managing dynamic field arrays with useFieldArray, handling async submit and server errors, or reviewing existing forms for performance issues.
How are the rules organized?
There are 45 rules across 8 categories prioritized by impact: Form Configuration and Field Subscription are CRITICAL, Controlled Components and Validation Patterns are HIGH, Field Arrays are MEDIUM-HIGH, and State Management, Integration Patterns, and Advanced Patterns are lower. Each rule has a reference file at references/{prefix}-{slug}.md, and AGENTS.md holds the full compiled guide.
What does this skill NOT cover?
It does not cover React 19 Server Actions, useActionState, or server-side form handling, which are directed to the react-19 skill. It also notes TanStack Form may be a better fit for deeply nested, fully type-safe forms, and that trivial single-input forms may not need any library.
Does it help with schema validation libraries or UI integrations?
Yes. It includes validation patterns such as resolver caching and dynamic schema factories, and integration rules for Material-UI and shadcn (e.g., verifying the shadcn Form import source and wiring shadcn Select with onValueChange). For Zod resolver specifics it points to the separate zod skill.
All Files
51 filesInstall react-hook-form
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
pproenca/dot-skills