react-hook-form
Guide for setting up react-hook-form with Zod validation in React.
Skill by Lichens-Innovation
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/lichens-innovation-react-hook-form
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: design, frontend, data
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/react-hook-form
What's inside
- Skill name
react-hook-form- Description
- Guide for setting up react-hook-form with Zod validation in React. Use this skill whenever the user wants to create a form component, add form validation, wire up Zod schemas to a form, use react-hook-form's Controller, handle form submission, display field errors, or reset/pre-populate a form with existing data. Also use when the user asks how to integrate react-hook-form with a UI component library (Ant Design, MUI, shadcn, etc.) or how to type form values with TypeScript.
- License
- MIT
- Instructions
- 208 lines in SKILL.md · view on GitHub
Files (2)
- README.md
- SKILL.md
SKILL.md (first lines)
# React Hook Form + Zod
A pattern for building validated form components in React using `react-hook-form` and `zod`.
## Installation
```bash
npm install react-hook-form zod @hookform/resolvers
```
## 1. Define a Zod Schema and Infer the Type
Define the schema once and derive the TypeScript type from it — no duplication.
```typescript
import { z } from "zod";
const userSchema = z.object({
name: z.string().min(1),
email: z.string().email(),
role: z.string().optional(),
});
type UserForm = z.infer<typeof userSchema>;
```
## 2. Initialize useForm
Pass the schema to `zodResolver` and type the form with the inferred type.
```typescript
import { useForm } from "react-hook-form";
import { zodResolver } from "@hookform/resolvers/zod";
const {
control,
handleSubmit,
reset,
formState: { errors },
} = useForm<UserForm>({ resolver: zodResolver(userSchema) });
```
Key destructured values:
| Value | Purpose |
|-------|---------|
| `control` | Passed to `<Controller>` to connect inputs |
| `handleSubmit` | Wraps your submit handler; validates before calling it |
| `reset` | Clears the form or populates it with new values |
| `errors` | Object with validation errors per field |
## 3. Render Fields with Controller
Use `<Controller>` to connect any input — native HTML or a UI library component — to the form.
```tsx
import { Controller } from "react-hook-form";
<Controller
name="name"
control={control}
render={({ field }) => <input {...field} />}
/>
```
The `field` object contains `value`, `onChange`, `onBlur`, and `ref`. Spread it directly onto the input.
## 4. Display Validation Errors
Check `errors.fieldName` to conditionally show error messages.
```tsx
<div>
<Controller
name="email"
control={control}
render={({ field }) => <input type="email" {...field} />}
/>
{errors.email && <span>{errors.email.message}</span>}
</div>
```
For UI libraries that accept `validateStatus` / `help` props (e.g. Ant Design):
```tsx
<Form.Item
validateStatus={errors.email ? "error" : ""}
help={errors.email?.message}
>
<Controller name="email" control={control} render={({ field }) => <Input {...field} />} />
</Form.Item>
```
## 5. Handle Submission
Pass your handler to `handleSubmit`. The handler receives fully-typed, validated values.
```typescript
const onSubmit = (values: UserForm) => {
// values is typed and validated — safe to use directly
saveUser(values);
};
// Wire to a button or form element:
<button onClick={handleSubmit(onSubmit)}>Save</button>
// or
<form onSubmit={handleSubmit(onSubmit)}>...</form>
```
## 6. Reset and Pre-populate
Call `reset()` to clear the form, or `reset(values)` to fill it with existing data (useful for edit forms).
```typescript
// Clear on cancel
const handleCancel = () => {
reset();
onClose();
};From Lichens-Innovation/ai-dev-tools, MIT.
More from Lichens-Innovation/ai-dev-tools
- 0.570score
claude-light
Lichens-Innovation
Applies a lightweight Claude Code configuration to this project's .claude/settings.local.json: optional auto-compact window, connectors, workflows, bundled…
SkillAFreshness: AClaude Code +9 - 0.570score
setup-claude-auto-lint-format
Lichens-Innovation
Installs a PostToolUse hook that runs the project's linter and formatter on every file Claude Code or one of its subagents writes or edits, and speaks up only…
SkillAFreshness: AClaude Code +9 - 0.570score
setup-claude-just-usage
Lichens-Innovation
Reads the justfiles of a repository and, for each level that has one (root, apps/frontend, packages/ui, ...), writes a .claude/rules/use-just-commands.md…
SkillAFreshness: AClaude Code +9 - 0.570score
chromatic-init
Lichens-Innovation
Adds Chromatic visual testing to a Storybook project.
SkillAFreshness: AClaude Code +9 - 0.570score
design-loop
Lichens-Innovation
Runs the Claude Design -> React implementation loop: takes an approved component or screen proposal (or the palette card) from a Claude Design project…
SkillAFreshness: AClaude Code +9 - 0.570score
design-palette
Lichens-Innovation
Creates or migrates the canonical CSS theme palette: light/dark inputs, generated scales, semantic tokens shared by web and React Native, hand-authored…
SkillAFreshness: AClaude Code +9 - 0.570score
design-refresh
Lichens-Innovation
The one skill for updating Claude Design from the code: checks whether the synced components are behind their code, rebuilds stale screen mockups, offers…
SkillAFreshness: AClaude Code +9 - 0.570score
react-flow-canvas-geometry
Lichens-Innovation
Compute React Flow (@xyflow) canvas geometry correctly — edge label anchors, bezier control points, handle coordinates, node bounds — so labels and edges land…
SkillAFreshness: AClaude Code +9 - 0.570score
react-coding-standards
Lichens-Innovation
Enforces internal React and TypeScript coding standards using avoid/prefer rules.
SkillAFreshness: AClaude Code +9 - 0.566score
setup-claude-guardrails
Lichens-Innovation
Installs guardrails in this project's .claude/ (and its git worktrees) that keep Claude Code from reading, writing or running commands on paths outside a…
SkillAFreshness: AClaude Code +9 - 0.566score
storybook-init
Lichens-Innovation
Installs and configures Storybook in a React or React Native project.
SkillAFreshness: AClaude Code +9 - 0.565score
generate-pr-description
Lichens-Innovation
Generates pull request descriptions by comparing current branch with parent branch.
SkillAFreshness: AClaude Code +9
Signals
- Stars
- 0
- Forks
- 0
- Open issues
- 6
- Last commit (this folder)
- Oct 11, 2026 (18 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from Lichens-Innovation
- 0.570score
setup-claude-auto-lint-format
Lichens-Innovation
Installs a PostToolUse hook that runs the project's linter and formatter on every file Claude Code or one of its subagents writes or edits, and speaks up only…
SkillAFreshness: AClaude Code +9 - 0.570score
design-loop
Lichens-Innovation
Runs the Claude Design -> React implementation loop: takes an approved component or screen proposal (or the palette card) from a Claude Design project…
SkillAFreshness: AClaude Code +9 - 0.570score
setup-claude-just-usage
Lichens-Innovation
Reads the justfiles of a repository and, for each level that has one (root, apps/frontend, packages/ui, ...), writes a .claude/rules/use-just-commands.md…
SkillAFreshness: AClaude Code +9 - 0.570score
chromatic-init
Lichens-Innovation
Adds Chromatic visual testing to a Storybook project.
SkillAFreshness: AClaude Code +9 - 0.570score
claude-light
Lichens-Innovation
Applies a lightweight Claude Code configuration to this project's .claude/settings.local.json: optional auto-compact window, connectors, workflows, bundled…
SkillAFreshness: AClaude Code +9 - 0.570score
design-palette
Lichens-Innovation
Creates or migrates the canonical CSS theme palette: light/dark inputs, generated scales, semantic tokens shared by web and React Native, hand-authored…
SkillAFreshness: AClaude Code +9
Cite this page
react-hook-form skill. Agent Mart. https://agentmart.dev/skills/lichens-innovation-react-hook-form (last updated 2026-10-24)