safe-action-advanced — Claude Code skill: use and install
This skill covers advanced next-safe-action patterns for bound inputs, metadata, framework errors, inferred types, and server callbacks.
npx skills add next-safe-action/skills --skill safe-action-advanced -a claude-codeWhat safe-action-advanced does
The skill covers extra values passed to actions with .bind(), typed metadata for middleware, and the InferSafeActionFnInput and InferSafeActionFnResult helpers. It also explains how actions can handle redirect, notFound, forbidden, and unauthorized.
A separate section describes the callbacks accepted by .action(): onSuccess, onError, onSettled, and onNavigation. These run on the server, while callbacks supplied to useAction belong to the browser. The material also separates throwServerError from returnServerError().
Server callbacks run in Node.js, so browser hook behavior should not be assumed for this part of an action.
What it helps with
- pass extra values to an action with
.bind() - attach typed metadata for middleware
- handle
redirect,notFound,forbidden, andunauthorized - derive types from action functions and middleware
- configure server callbacks for success and failure
Example prompts for the agent
- Show how to pass a
resourceIdinto an action with.bind()while keeping the types intact. - Set up
onSuccess,onError, andonSettledin the second argument of.action(). - Explain when to use
throwServerErrorinstead ofreturnServerError()for a handled error.
How to install safe-action-advanced
1Skills CLI (Vercel)
npx skills add next-safe-action/skills --skill safe-action-advanced -a claude-code2Manually: put the files in place
~/.claude/skills/safe-action-advanced/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/safe-action-advanced/
1Skills CLI (Vercel)
npx skills add next-safe-action/skills --skill safe-action-advanced -a codex2Manually: put the files in place
.agents/skills/safe-action-advanced/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add next-safe-action/skills --skill safe-action-advanced -a cursor2Manually: put the files in place
.cursor/skills/safe-action-advanced/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install next-safe-action/skills safe-action-advanced2Manually: put the files in place
.github/skills/safe-action-advanced/SKILL.md1Skills CLI (Vercel)
npx skills add next-safe-action/skills --skill safe-action-advanced -a gemini-cli2Platform CLI
gemini skills install https://github.com/next-safe-action/skills --path skills/safe-action-advancedManually: put the files in place
.devin/skills/safe-action-advanced/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add next-safe-action/skills --skill safe-action-advanced -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-advanced
How do I install safe-action-advanced in Claude Code?
Run npx skills add next-safe-action/skills --skill safe-action-advanced -a claude-code, then check ~/.claude/skills/safe-action-advanced/SKILL.md.
What does safe-action-advanced do?
It explains bound action arguments, typed metadata, framework errors, type inference helpers, and callbacks that run on the server.
Where do the .action() callbacks run?
They run on the server in Node.js. The callbacks passed to useAction run in the browser instead.