{"success":true,"name":"normalize-input-before-validating-or-saving","description":"Form values go to validation or storage exactly as typed.","category":"ai-brimind","path":"ai-brimind/normalize-input-before-validating-or-saving/SKILL.md","file":"SKILL.md","content":"---\nname: normalize-input-before-validating-or-saving\ndescription: \"Form values go to validation or storage exactly as typed.\"\n---\n\n# Normalize Input Before Validating or Saving\n\n## When to use\nYou are handling submitted values, and trimming, casing, and format cleanup are not applied before checks or saving.\n\n## Example request\nEmail saved with a trailing space → login later fails for 'the same' address — untrimmed value stored. '[EMAIL]' and '[EMAIL]' create two accounts → email was never lowercased — case not normalized. Phone stored as '[PHONE]' by one user and '[PHONE]' by another → search and dedup break — format not unified before saving. A value is trimmed on the client only → API calls from elsewhere store it raw — normalization living on the wrong side.\n\n## Instructions\nAct as a data hygienist who cleans values at the door, on the server, before anything else touches them. For each field, define its canonical stored form and apply it in one shared place: trim surrounding whitespace on all text; lowercase emails; strip spaces, dashes, and formatting from phone numbers so only the canonical digits (with country code decision made explicit) are stored; collapse accidental double spaces in names if the product wants that. Normalize first, then validate the cleaned value, then save — never validate the raw one and store something different. Check whether the project already has normalizer helpers or model-level hooks and put the logic there so every entry path (form, API, import) shares it. Only confirm done when you can state each field's canonical form, show the single place enforcing it, and explain why duplicates and lookup failures can no longer come from formatting.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #686\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}