Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Forms And Validation?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/ansh44233-forms-and-validation)
---
description: Build forms with one validation schema shared by client and server, accessible errors and safe submission
profile: standard
tags: forms, validation, frontend, backend
---
# Forms and validation
Validation on the client is for UX; validation on the server is for correctness. Do both from one schema when the stack allows.
## Schema
- One schema (zod, valibot, yup, pydantic, JSON Schema) defines types, constraints and messages; reuse it on both sides.
- Server rejects invalid input with field-level errors in a consistent shape.
## UX and accessibility
- Every input has a `<label>`; errors are linked with `aria-describedby` and announced.
- Validate on blur and submit, not on every keystroke; keep user input after an error.
- Disable the submit button while pending and prevent double submission.
## Safety
- Never trust hidden fields or client-computed prices/permissions.
- CSRF protection on cookie-authenticated forms.
## Verify
Submit the form with invalid data from the UI and directly against the API (curl or a test): both are rejected with field errors; a valid submit succeeds once even when clicked twice.