frontend-forms

Coordinate React Hook Form and Zod forms with automatic API error mapping.

Updated Feb 25, 2026
One-click install
npx skills add https://github.com/chinomartinez/SmartPocket --skill frontend-forms
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: frontend-forms
Source: https://github.com/chinomartinez/SmartPocket/tree/main/.agents/skills/frontend-forms
Command: npx skills add https://github.com/chinomartinez/SmartPocket --skill frontend-forms

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

React Hook Form + Zod patterns for SmartPocket forms, enabling consistent validation, error handling, and API integration across create/edit flows with a modern, low-boilerplate pattern.

Core Features & Use Cases

  • useFormErrorHandler to auto-map API errors to fields and display via FormMessage.
  • activeMutation to unify create/edit flows and manage loading and reset in a single place.
  • values-based syncing (no useEffect) with watch() to align edit data and reactive data updates.
  • Three-layer error display: field-level, inline, and toast for user-friendly feedback.
  • Real-world use: quickly build product forms with name, amount, and category validations, handling server-side errors gracefully.

Quick Start

Configure a new form using the Modern Form Pattern to validate with Zod, map API errors to fields automatically, and coordinate create/edit workflows with a single form state.

Frequently Asked Questions about frontend-forms

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

FAQPage Schema
How do I handle API errors in React Hook Form automatically?

You can handle API errors in React Hook Form by integrating a useFormErrorHandler hook that auto-maps server-side validation errors to specific form fields. This pattern automatically displays API errors via FormMessage components without requiring manual field updates.

What is the best way to sync React Hook Form values with external data without useEffect?

The best way to sync React Hook Form values without useEffect is using the watch() function for value-based synchronization. This approach aligns reactive data updates and edit data directly within the form state, avoiding side-effect boilerplate.

How do I unify create and edit form mutations with TanStack Query?

You can unify create and edit form mutations with TanStack Query by using an activeMutation pattern. This approach manages loading states and form resets in a single place, allowing one form state to coordinate both creation and editing workflows.

How do I set up Zod validation with React Hook Form for type-safe forms?

To set up Zod validation with React Hook Form, you configure a schema resolver that connects Zod type-safety rules to the form state. This pattern enforces consistent validation across create and edit flows while maintaining strict type-safety.

Why does my form reset not work when closing a React modal?

Form reset issues when closing a React modal usually occur due to uncentralized state management. Implementing a centralized reset on modal close pattern ensures the form state is properly cleared and synchronized with the activeMutation lifecycle.

Can I display form errors at the field, inline, and toast levels simultaneously?

Yes, you can display form errors across three layers simultaneously. This pattern routes API errors to field-level FormMessage components, inline notifications, and toast popups, providing comprehensive user feedback for both client-side and server-side validation failures.