Add client-side and server-side form validation with a shared schema and clear error UX
Scanned 9/3/2026
Install to Claude Code
npx -y skills add black141312/ada --skill form-validation --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Form Validation?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/black141312-form-validation)More formats (shields.io, HTML) on the badges page.
---
name: form-validation
description: Add client-side and server-side form validation with a shared schema and clear error UX
category: frontend
---
# Form Validation
Use when a form accepts user input that must be validated — required fields, formats, ranges — on both the client and the server.
1. Define one validation schema (e.g. Zod/Yup/Valibot) as the source of truth for field rules, and share it between client and server so they can't drift.
2. Validate on the client for fast feedback: validate a field on blur/change and the whole form on submit; disable submit while invalid or in-flight.
3. Show errors inline next to each field, tie them to the input via `aria-describedby`/`aria-invalid`, and move focus to the first error on failed submit.
4. Re-validate on the server with the same schema — treat client validation as UX only and never trust the incoming payload.
5. Return structured field-level errors from the server and map them back onto the matching inputs, plus a form-level message for non-field failures.
6. Cover edge cases: trimming/normalizing input, duplicate submits, async checks (e.g. unique email), and preserving entered values after a failed submit.
## Rules
- Server validation is mandatory; client validation can be bypassed and is for UX only.
- Keep one schema as the single source of truth — don't duplicate rules in two places.
- Associate every error message with its input via ARIA so it's announced and reachable.
- Validate format AND business rules (uniqueness, allowed values), not just "non-empty".
- Don't block typing or wipe the user's input on error; show the problem and let them fix it.
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!