# safe-action-forms

This skill guides next-safe-action form integrations, from native HTML submission to React Hook Form, optimistic updates, and file uploads.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 1200 installs · ★ 1
- Author: next-safe-action
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/next-safe-action/skills/tree/HEAD/skills/safe-action-forms/SKILL.md
- Updated: 2026-09-03
- HTML: https://affpapa.org/en/nevibecode/skills/safe-action-forms

## What it does

The skill maps out ways to use `next-safe-action` with forms. It covers `useAction`, `useStateAction`, the React Hook Form adapter through `useHookFormAction` and `useHookFormOptimisticAction`, field-level validation errors, bound arguments, and uploads.

For a native form, the action can receive `FormData` through `formAction`, or the submit handler can build an input object before calling the action. The React Hook Form route connects a schema resolver, registered fields, and the action result. With `useStateAction`, the server action must use `.stateAction()`, while its input schema must parse `FormData`, such as with `zfd.formData` from `zod-form-data`.

The skill also points to material on native form patterns, the React Hook Form adapter, and file uploads. A project using `useStateAction` without `.stateAction()` will fail at this integration point.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add next-safe-action/skills --skill safe-action-forms -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/safe-action-forms/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/safe-action-forms/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add next-safe-action/skills --skill safe-action-forms -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/safe-action-forms/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add next-safe-action/skills --skill safe-action-forms -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/safe-action-forms/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install next-safe-action/skills safe-action-forms
```

2. **Manually: put the files in place**
- File: `.github/skills/safe-action-forms/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add next-safe-action/skills --skill safe-action-forms -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/next-safe-action/skills --path skills/safe-action-forms
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/safe-action-forms/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add next-safe-action/skills --skill safe-action-forms -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/next-safe-action/skills/tree/HEAD/skills/safe-action-forms/SKILL.md

## When to use it
- connect next-safe-action to a native HTML form
- render validation messages beside individual fields
- wire React Hook Form to a server action
- add optimistic updates to a form
- handle bound arguments or file uploads

## Example prompts
- Connect `next-safe-action` to a contact form with `useStateAction` and render its validation errors.
- Build a React Hook Form integration with `useHookFormAction`, a `zod` schema, and field messages.
- Show how to handle a file upload with `next-safe-action` and choose the matching form submission pattern.

## Similar
- [frontend-design](https://affpapa.org/en/nevibecode/skills/frontend-design.md) — skill · 1025790 installs
- [design-taste-frontend](https://affpapa.org/en/nevibecode/skills/design-taste-frontend.md) — skill · 678700 installs
- [prototype](https://affpapa.org/en/nevibecode/skills/prototype.md) — skill · 986201 installs
- [hyperframes](https://affpapa.org/en/nevibecode/skills/heygen-com-hyperframes.md) — skill · 1200000 installs
- [hyperframes-cli](https://affpapa.org/en/nevibecode/skills/heygen-com-hyperframes-cli.md) — skill · 1300000 installs
- [webapp-testing](https://affpapa.org/en/nevibecode/skills/webapp-testing.md) — skill · 186758 installs

From the same set: [next-safe-action/skills](https://affpapa.org/en/nevibecode/by/next-safe-action/skills.md) — 6 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
