writing-error-messages
Skill49 starsChanged 6 months agoMITView on GitHub
Use when writing, reviewing, or rewriting user-facing error messages, validation messages, form errors, empty/error states, auth errors, failure notifications, retry/support copy, CLI errors, or API errors humans will read. Helps make errors specific, actionable, non-blaming, accessible, and safe without leaking sensitive details.
In this repository26 other files it gives its agents.
- AGENTS.mdAGENTS.md
- coding-standardsSkill
- coolify-composeSkill
- crafting-effective-readmesSkill
- diataxisSkill
- english-pleaseSkill
- feature-planning-artifactsSkill
- frontend-design-principlesSkill
- grug-brained-devSkill
- html-artifactsSkill
- improveSkill
- improving-promptsSkill
- jjSkill
- reducing-entropySkill
- researching-codebasesSkill
- roadmapSkill
- roadmap-to-improve-plansSkill
- rustSkill
- salsaSkill
- skill-authoringSkill
- strategic-roadmapSkill
- svelte5Skill
- sveltekitSkill
- writing-cli-skillsSkill
- writing-plansSkill
- writingSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
13 rules. About 0 are common, 13 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈13
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 46
Use only the pieces the situation needs.
- Distinctive: line 56
Keep UI body copy to 1-2 sentences when possible.
- Distinctive: line 67
Put the message next to the field and summarize errors at the top for long forms.
- Distinctive: line 71
Do not validate before the user has had a fair chance to finish typing.
- Distinctive: line 93
Put the error where the reader is looking: near the field, control, toast source, or failed item.
- Distinctive: line 94
Do not rely on color alone.
- Distinctive: line 97
Do not turn an empty result into an error.
- Distinctive: line 103
Use generic copy for login and account recovery:
- Distinctive: line 118
If the user needs help, give a safe path: support, recovery instructions, request ID, or an audit-safe explanation.
- Distinctive: line 122
When the reader can act on technical details, include them in a structured way:
- Distinctive: line 141
Do not accept "just write a generic error" without checking whether the product can do better.
- Distinctive: line 150
If the cause is truly unknown, use a generic-but-actionable fallback:
- Distinctive: line 159
Before shipping, verify the message answers the reader's questions:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Writing Error Messages
Quick Start
Before writing, identify:
- Audience: end user, admin, developer, support agent, or operator.
- Failure: what action failed and what still happened successfully.
- Cause: known, unknown, user-correctable, service-side, third-party, or security-sensitive.
- Recovery: what the reader can do now, what the system will do next, and where they can get help.
Then write this shape:
[What happened]
[Reassurance if useful]. [Why it happened, if known and safe]. [Specific next action]. [Backup path if it keeps happening].Example:
Unable to connect your account
Your changes were saved, but we couldn't connect the account because of an issue on our end. Try connecting again. If this keeps happening, contact support.Core Rules
| Rule | Do | Avoid |
| Say what happened | "We couldn't save your file." | "Something went wrong." |
| Say what was not affected | "Your draft was saved." | Leaving the user to wonder if data was lost |
| Give the next action | "Check the card number and try again." | "OK" / "Close" as the only path |
| Use plain language | "We couldn't connect to Dropbox." | "Fetch failed" / "credentials denied" |
| Avoid blame | "Store name is required." | "You forgot to enter a store name." |
| Match the stakes | Calm, direct, respectful | "Oops!" / jokes / cutesy tone |
| Be specific when safe | "Enter a date in the past." | "Invalid input." |
| Be generic when security requires it | "Invalid email or password." | "That email exists, but the password is wrong." |
Message Anatomy
Use only the pieces the situation needs.
| Piece | Purpose | Pattern |
| Title | Summarize the failed action | "Couldn't save changes" |
| Body | Explain consequence and cause | "Your changes are still open, but we couldn't save them because the connection dropped." |
| Primary action | Tell the reader what to do | "Try again", "Update details", "Choose another file" |
| Backup path | Provide a way out | "If this keeps happening, contact support." |
| Diagnostic detail | Help technical readers or support | Error code, request ID, expected/received values, log location |
Keep UI body copy to 1-2 sentences when possible. Put longer diagnostic details in expandable text, logs, or support context.
References
- Open
references/source-backed-patterns.mdwhen auditing many messages, resolving wording tradeoffs, or checking source-backed rationale. - Open
references/rewrite-examples.mdwhen rewriting multiple messages or testing whether the skill is producing the right shape.
Validation and Form Errors
For field-level errors:
- Put the message next to the field and summarize errors at the top for long forms.
- Match the field label or question so the reader can connect the message to the control.
- Say how to fix it, not only that it is wrong.
- Preserve the user's input so they can correct it.
- Do not validate before the user has had a fair chance to finish typing.
Good patterns:
Enter an email address
Enter a date in the past
Password must be at least 12 characters
Choose a file smaller than 10 MBAvoid:
This field is required
Invalid input
You entered an illegal value
Validation failedPlacement, Accessibility, and Empty States
- Put the error where the reader is looking: near the field, control, toast source, or failed item.
- Do not rely on color alone. Include visible text, icons or labels, and machine-readable semantics when working in UI code.
- For form pages, move focus to the error summary or first error according to the product's accessibility pattern.
- Preserve the user's work whenever possible.
- Do not turn an empty result into an error. If nothing failed, write an empty state: "No invoices found" plus the next useful action.
Security and Privacy Gate
Specificity is not always better. Use a generic message when detail could reveal account existence, permissions, private data, system internals, fraud signals, or security policy.
Use generic copy for login and account recovery:
Invalid email or password
If an account exists for that email address, we'll send password reset instructions.Do not reveal:
That email exists, but the password is wrong
This account is locked
No account found for this emailIf the user needs help, give a safe path: support, recovery instructions, request ID, or an audit-safe explanation.
Developer-Facing and CLI Errors
When the reader can act on technical details, include them in a structured way:
Could not read config file
Expected TOML at ./app.config.toml, but found invalid syntax on line 12: missing closing quote.
Fix the syntax and run `app deploy` again.Useful details:
- What command, file, field, or resource failed.
- What was expected and what was received.
- The smallest fix or next diagnostic command.
- A request ID, error code, or log path when support/debugging needs it.
Still avoid stack traces, raw exception names, and internal service names unless the audience can use them.
When Asked for a Generic Error
Do not accept "just write a generic error" without checking whether the product can do better. Ask:
- What action was the user trying to complete?
- What triggered this error in the code or service?
- Is the cause known, unknown, intermittent, or security-sensitive?
- Was anything saved, sent, charged, deleted, or left unchanged?
- Can the user fix it, retry, wait, use another path, or contact support?
- How often does it happen, and does it block the main flow?
If the cause is truly unknown, use a generic-but-actionable fallback:
Something went wrong
Refresh the page and try again. If this keeps happening, contact support with request ID {request_id}.Final Check
Before shipping, verify the message answers the reader's questions:
- What happened?
- Did I lose anything or create a duplicate?
- Why did this happen, if it is safe to say?
- What can I do next?
- What happens if I do nothing?
- Where can I get help if the fix does not work?
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

