react-forms

Implements and reviews React forms using React Hook Form, Zod schemas, and accessible error handling.

1|Updated Apr 3, 2026
One-click install
npx skills add https://github.com/TierOne-Studio/spa-velocity --skill react-forms-tierone-studio
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: react-forms
Source: https://github.com/TierOne-Studio/spa-velocity/tree/main/.ruler/skills/react-forms
Command: npx skills add https://github.com/TierOne-Studio/spa-velocity --skill react-forms-tierone-studio

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building forms in React often leads to duplicated validation logic, inconsistent error display, and accessibility gaps. This Skill encodes a single, consistent form pattern — React Hook Form for state, Zod for schemas, and a shared Field component compound — so every form in the codebase behaves the same way and avoids common failure modes. ## Core Features & Use Cases - Schema-driven validation: Zod schemas in schemas/<feature>Schemas.ts act as the single source of truth for shape and error messages, bridged to React Hook Form via zodResolver. - Accessible error handling: Field-level errors render next to inputs with aria-invalid and aria-describedby, while server-side failures surface as toasts or top-of-form alerts with role="alert". - Submit lifecycle management: Mutations handle async submission, disable the submit button while pending, reset the form on success, and map server field errors back via form.setError. - Use Case: When adding a "Create Project" form, define a Zod schema, wire it into useForm with zodResolver, render fields with the <Field>/<FieldLabel>/<Input>/<FieldError> compound, and submit through a useMutation hook — no manual useState per field. ## Quick Start Ask the AI to create a new form for your feature using the react-forms pattern with a Zod schema, React Hook Form, and the existing Field component compound.

Frequently Asked Questions about react-forms

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

FAQPage Schema
How do I validate React Hook Form with Zod?

Define a Zod schema in a schemas file, infer the input type with z.infer, and pass the schema to useForm via zodResolver from @hookform/resolvers. The schema becomes the single source of truth for both shape and error messages.

How do I show field-level validation errors in React Hook Form?

Read errors from form.formState.errors and render them next to each input using a FieldError component. Set aria-invalid and aria-describedby on the input so screen readers announce the error.

Should I validate forms on every keystroke or on submit?

Use mode: 'onSubmit' as the default, since live validation on every keystroke can be hostile UX. Only switch to onChange validation when the field semantics require it, such as a password strength meter.

How do I handle server-side validation errors in React Hook Form?

When the API rejects with a field-specific error, call form.setError with the field name and message to surface it on that field. For general failures, show a toast or a top-of-form alert with role="alert".

When should I use Controller instead of register in React Hook Form?

Use Controller for non-native inputs like Radix Select or DatePicker that do not expose a native ref. Use register for standard HTML inputs, and avoid mirroring field values with useState.

When should I not use React Hook Form for an input?

Skip it for search or filter inputs that have no submit action and no validation schema, and for one-off controlled inputs outside form contexts. Those cases do not need a form state machine.