safe-action-forms — Claude Code skill: forms and setup
This skill guides next-safe-action form integrations, from native HTML submission to React Hook Form, optimistic updates, and file uploads.
npx skills add next-safe-action/skills --skill safe-action-forms -a claude-codeWhat safe-action-forms 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.
What it helps with
- 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 for the agent
- Connect
next-safe-actionto a contact form withuseStateActionand render its validation errors. - Build a React Hook Form integration with
useHookFormAction, azodschema, and field messages. - Show how to handle a file upload with
next-safe-actionand choose the matching form submission pattern.
How to install safe-action-forms
1Skills CLI (Vercel)
npx skills add next-safe-action/skills --skill safe-action-forms -a claude-code2Manually: put the files in place
~/.claude/skills/safe-action-forms/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/safe-action-forms/
1Skills CLI (Vercel)
npx skills add next-safe-action/skills --skill safe-action-forms -a codex2Manually: put the files in place
.agents/skills/safe-action-forms/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add next-safe-action/skills --skill safe-action-forms -a cursor2Manually: put the files in place
.cursor/skills/safe-action-forms/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install next-safe-action/skills safe-action-forms2Manually: put the files in place
.github/skills/safe-action-forms/SKILL.md1Skills CLI (Vercel)
npx skills add next-safe-action/skills --skill safe-action-forms -a gemini-cli2Platform CLI
gemini skills install https://github.com/next-safe-action/skills --path skills/safe-action-formsManually: put the files in place
.devin/skills/safe-action-forms/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add next-safe-action/skills --skill safe-action-forms -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about safe-action-forms
How do I install safe-action-forms in Claude Code?
Run npx skills add next-safe-action/skills --skill safe-action-forms -a claude-code, then check ~/.claude/skills/safe-action-forms/SKILL.md.
What does safe-action-forms do?
It explains how to connect next-safe-action with native forms and React Hook Form, including field errors, optimistic updates, bound arguments, and uploads.
What does useStateAction require?
The server action must be created with .stateAction(). Its input schema must parse FormData, for instance through zfd.formData from zod-form-data.