Skip to content
Back to skills

Forms

ASecurity

Forms and auth — validation, RHF + Zod, error states, checkout, login/signup, OTP/MFA, payments. Use when the UI collects input — contact, newsletter, checkout, login, signup, password reset, OTP/MFA, multi-step wizards, settings panels. React Hook Form, Zod, aria-describedby or Stripe PaymentElement route here.

  • 11 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added October 22, 2026
ai-agentstypescriptrustgoreactnextjsapi

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 16 files and shows the line behind each finding

Scanned October 22, 2026

npx -y skills add Krishna-Modi12/frontend-design-pro --skill forms --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Forms?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Forms
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/krishna-modi12-forms/badge)](https://www.skillsdirectory.com/skills/krishna-modi12-forms)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: forms
description: Forms and auth — validation, RHF + Zod, error states, checkout, login/signup, OTP/MFA, payments. Use when the UI collects input — contact, newsletter, checkout, login, signup, password reset, OTP/MFA, multi-step wizards, settings panels. React Hook Form, Zod, aria-describedby or Stripe PaymentElement route here.
metadata:
  version: "15.0.0"
  core-deps:
    - core/component-api.md
    - core/accessibility-baseline.md
---

# Forms

## When to Use
Any input-collecting UI: contact, newsletter, checkout, login, signup, password reset, OTP/MFA, multi-step wizards, settings panels. Mentions of React Hook Form, Zod, validation, `aria-describedby`, or Stripe PaymentElement route here.

## Stack
React 19 · TypeScript strict · Tailwind v4 · React Hook Form + Zod · Next.js App Router (default)

## Core Rules
1. **Label everything.** Every input is wired via `htmlFor`/`id` or wraps its control. Placeholders never replace labels — they end with `…` and show an example pattern.
2. **Errors live beside their field**, linked with `aria-describedby`, marked with `aria-invalid`, announced with `role="alert"`. Focus the first invalid field on submit.
3. **Validate on blur**, not on every keystroke. Re-validate on change only after the first error appears.
4. **Error copy is a fix, not a verdict.** "Enter a valid email — for example ana@arclight.io", never "Invalid input".
5. **Submit stays enabled** until the request starts; then disable and show a spinner *inside* the button. Never block paste.
6. **Correct input semantics.** `type` + `inputMode` + `autocomplete` on every field. `spellCheck={false}` on emails, codes and usernames. `autocomplete="off"` on non-auth fields so password managers stay quiet.
7. **Schema-first.** Zod schema is the single source of truth; infer the TS type from it, resolve with `zodResolver`. Discriminated unions for conditional branches.
8. **Four states always.** Loading skeleton (from a real `isLoading` input, never `setTimeout`), empty, error, success.
9. **Unsaved-changes guard** on any form a user can navigate away from.
10. **Touch targets ≥44×44px**, including checkbox/radio hit areas — label and control share one target with no dead zones.

## Patterns
- **RHF + Zod** — `useForm({ resolver: zodResolver(schema) })`, `Controller` for non-native inputs.
- **Multi-step wizard** — one decision per step, 3–5 steps, progress as an `<ol>` with `aria-current="step"`, Back never destroys data.
- **OTP input** — six inputs, `autoComplete="one-time-code"`, paste distributes across boxes, backspace walks backwards, resend countdown in an `aria-live` region.
- **Checkout** — PaymentElement + sticky order summary, trust strip, four states.
- **Server Actions** — `useActionState` for pending/error without client state.

## Examples
`examples/good-form.tsx` (contact, file upload, all states) · `examples/good-rhf.tsx` (multi-step wizard) · `examples/good-auth.tsx` (login/signup/magic link/OAuth) · `examples/good-checkout.tsx` (Stripe) · `examples/good-storybook.tsx` (form with CSF3 stories).

## Reference Index
Load only for the specific task:

| Task | Load |
|---|---|
| RHF API, resolvers, field arrays, Server Actions | `references/react-hook-form.md` |
| Login/OAuth/magic link/OTP/MFA/protected routes | `references/auth-patterns.md` |
| Optimistic UI, rollback, axe checks, error boundaries | `references/verification-loops.md` |

## Constraints
Every input labelled · errors linked via `aria-describedby` · `A11Y-02` focus-visible on interactive elements · four states, no mount-time fake delays · OKLCH tokens · TypeScript strict with exported prop interfaces · WCAG 2.2 AA including §3.3.7 (never re-ask session data).

Files in this skill

  • SKILL.md3.7 KB
  • examples/_r3f-jsx.d.ts1.6 KB
  • examples/_stubs.d.ts3.6 KB
  • examples/good-auth.test.tsx1.5 KB
  • examples/good-auth.tsx23.5 KB
  • examples/good-checkout.test.tsx1.6 KB
  • examples/good-checkout.tsx20.7 KB
  • examples/good-form.test.tsx1.5 KB
  • examples/good-form.tsx12 KB
  • examples/good-rhf.test.tsx1.4 KB
  • examples/good-rhf.tsx31.5 KB
  • examples/good-storybook.test.tsx1.4 KB
  • examples/good-storybook.tsx19.6 KB
  • references/auth-patterns.md44.7 KB
  • references/react-hook-form.md46.2 KB
  • references/verification-loops.md20.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.