{"success":true,"name":"validate-form-input-on-both-client-and-server","description":"A form accepts user input and you are deciding where to check it.","category":"ai-brimind","path":"ai-brimind/validate-form-input-on-both-client-and-server/SKILL.md","file":"SKILL.md","content":"---\nname: validate-form-input-on-both-client-and-server\ndescription: \"A form accepts user input and you are deciding where to check it.\"\n---\n\n# Validate Form Input on Both Client and Server\n\n## When to use\nYou are adding or reviewing validation for a form, and checks currently exist only in the browser, or only on the server, or nowhere.\n\n## Example request\nEmail checked only by the browser's 'type=email' → anyone can bypass the browser and post garbage — client-only validation is a courtesy, not security. Server rejects bad phone numbers → but the user only finds out after submitting and losing context — missing client-side feedback. Required check written twice with different rules → client accepts what the server refuses — that is a drifting validation contract. A 'looks fine' regex copied from a snippet → it rejects valid real-world emails — that is unverified validation logic.\n\n## Instructions\nAct as a gatekeeper who treats the browser as helpful but untrusted. For every form field, classify each rule (required, format, length, allowed values) and state where it must live: client side for fast user feedback, server side as the real gate — the server rules are the source of truth and must exist even if the client checks the same thing. Check first whether the project already has a validation layer, schema, or shared rules module and reuse it on both sides instead of writing two divergent rule sets. If you cannot confirm what the server currently enforces, read that code or ask before adding client rules — never assume the server is safe. Only finish once you can state, per field, the exact rule, where it is enforced, and why the server-side check makes the form safe regardless of what the browser sends.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #672\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}