safe-action-validation-errors — Claude Code skill: setup guide
Guides coding assistants on handling input and manual validation errors in next-safe-action. Useful when writing server actions and UI error displays.
npx skills add next-safe-action/skills --skill safe-action-validation-errors -a claude-codeWhat safe-action-validation-errors does
The skill provides coding agents with conventions for server mutations created with the next-safe-action package. It explains how to report issues originated by schema checks alongside custom business logic triggered directly in backend functions.
The material details how returnValidationErrors interrupts execution. Because this helper throws an internal ActionServerValidationError, any code placed beneath it will not run.
The guide also outlines data structures returned to client components. It contrasts standard nested trees containing _errors properties with flat maps using fieldErrors and formErrors, ensuring the agent renders error text accurately.
What it helps with
- send custom validation messages from server actions
- render nested field errors in form markup
- attach root-level errors to an entire form
- handle flattened error payloads on the client
Example prompts for the agent
- Write a Next.js registration action with next-safe-action and reject duplicate emails via returnValidationErrors
- Show how to display nested error messages from result.validationErrors in a form
- Add a top-level form error to my server action without targeting a specific input
How to install safe-action-validation-errors
1Skills CLI (Vercel)
npx skills add next-safe-action/skills --skill safe-action-validation-errors -a claude-code2Manually: put the files in place
~/.claude/skills/safe-action-validation-errors/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/safe-action-validation-errors/
1Skills CLI (Vercel)
npx skills add next-safe-action/skills --skill safe-action-validation-errors -a codex2Manually: put the files in place
.agents/skills/safe-action-validation-errors/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add next-safe-action/skills --skill safe-action-validation-errors -a cursor2Manually: put the files in place
.cursor/skills/safe-action-validation-errors/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install next-safe-action/skills safe-action-validation-errors2Manually: put the files in place
.github/skills/safe-action-validation-errors/SKILL.md1Skills CLI (Vercel)
npx skills add next-safe-action/skills --skill safe-action-validation-errors -a gemini-cli2Platform CLI
gemini skills install https://github.com/next-safe-action/skills --path skills/safe-action-validation-errorsManually: put the files in place
.devin/skills/safe-action-validation-errors/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add next-safe-action/skills --skill safe-action-validation-errors -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-validation-errors
How do I install safe-action-validation-errors in Claude Code?
Run npx skills add next-safe-action/skills --skill safe-action-validation-errors -a claude-code in your terminal.
What is safe-action-validation-errors used for?
It teaches AI models proper patterns for emitting and displaying validation issues in next-safe-action. It covers both automated schema mismatches and manual server-side checks.
Does returnValidationErrors allow execution to continue?
No, calling this helper halts execution immediately by raising an internal exception. The framework catches it and passes the payload to result.validationErrors on the client.