form-stack

Create type-safe Next.js forms with React Hook Form, Zod, and shadcn/ui.

Updated May 5, 2026
One-click install
npx skills add https://github.com/nabinkhair42/nk-skills --skill form-stack
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: form-stack
Source: https://github.com/nabinkhair42/nk-skills/tree/main/skills/form-stack
Command: npx skills add https://github.com/nabinkhair42/nk-skills --skill form-stack

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Building forms in product apps is repetitive, error-prone, and hard to keep in sync with the API. This pattern provides a repeatable approach that uses a single Zod schema to drive validation, TypeScript types, and the API contract, reducing boilerplate and drift.

Core Features & Use Cases

  • One source of truth: a single Zod schema validates inputs, infers types, and represents the API payload.
  • UI wiring with RHF and shadcn/ui: near-zero boilerplate for form fields, error messages, and accessibility.
  • End-to-end form lifecycle: supports create/edit flows, multi-step wizards, server actions, or React Query mutations, with robust error handling and loading states.

Quick Start

Set up a single Zod-based schema and wire it to a React Hook Form instance using the provided Form components to build a full-featured, type-safe form.

Frequently Asked Questions about form-stack

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

FAQPage Schema
How do I build type-safe forms in Next.js using a single Zod schema?

Build type-safe forms by defining a single Zod schema to validate inputs, infer TypeScript types, and represent the API payload. Wire this schema directly into React Hook Form and shadcn/ui components to eliminate boilerplate and ensure end-to-end type safety.

Can I use React Hook Form with server actions for form submissions?

Yes, React Hook Form integrates directly with server actions for form submissions. This architecture supports end-to-end form lifecycle management, handling loading states, server error mapping, and robust error handling across client and server contracts.

What is the best way to keep form validation and API contracts in sync?

The best way to keep form validation and API contracts in sync is using a single Zod schema as the source of truth. This schema drives input validation, infers TypeScript types, and represents the API payload, reducing boilerplate and drift.

Does this form architecture support multi-step wizards and field arrays?

Yes, this form architecture supports multi-step wizards and field arrays. It provides a reusable, type-safe pattern for Next.js apps that handles create/edit flows, server actions, and React Query mutations with proper loading and error states.

How do I map server errors to client form fields using Zod and React Hook Form?

Map server errors to client form fields by leveraging the single Zod schema architecture. This pattern supports server error mapping and robust error handling, ensuring API validation errors are correctly displayed on the corresponding form fields.