Field Validation & Error Messages
Defines the validation rule, the exact user-facing error message, and the test cases that prove both are correct and consistent with the rest of the product.
Process
- State the rule precisely — type, required/optional, length/range, format (regex if relevant), allowed characters, uniqueness constraints, cross-field dependencies (e.g. "end date must be after start date").
- Write the error message to this standard, unless the project has its own error-message style guide (check
references/message-style-guide.mdand defer to it if filled in):- States what's wrong, not just "invalid input"
- Tells the user what to do, when possible ("Enter a date after the start date" not "Invalid date")
- No technical jargon, stack traces, or internal field names exposed to the user
- Consistent tone and punctuation with the rest of the product's error messages
- Specific to the actual violated rule — a length error and a format error should read differently
- Check for consistency — if the user is reviewing existing messages, flag cases where the same violation type is worded differently in different places (e.g. "Email is required" vs "Please enter an email" for the same rule elsewhere).
- Generate the verifying test cases — one per distinct violation of the rule (missing, too short, too long, wrong format, duplicate/not-unique, cross-field violation), each checking both that the error triggers and that the exact expected message appears.
Output format
Field: [field name]
Rule: [precise validation rule]
Error Message: "[exact user-facing text]"
Trigger Conditions: [what input(s) produce this exact message]
Followed by test cases in this project's standard test-case-design format (10-column Qase format — see the test-case-design skill) with type = Negative and type = UI as applicable, one row per violation condition.
See references/examples.md for a worked example across several validation types.
What not to do
- Don't write a generic "Invalid input" message when the specific problem is knowable — specificity is the entire point of this skill.
- Don't expose internal details (field IDs, backend error codes, stack traces) in user-facing text.
- Don't assume a style guide — check
references/message-style-guide.mdfirst, and ask if it's empty and the project clearly has an existing tone to match.