notifications-and-toasts
Skill3 starsChanged 6 months agoMITView on GitHub
Use when giving users feedback — toasts (sonner), inline alerts, and a notification center. Covers when to use which, accessible announcements, promise/loading toasts, and not overusing notifications.
In this repository14 other files it gives its agents.
- accessible-componentsSkill
- auth-screensSkill
- billing-and-pricingSkill
- component-architectureSkill
- dashboard-layoutSkill
- data-tablesSkill
- design-tokens-themingSkill
- empty-and-loading-statesSkill
- forms-and-validationSkill
- modals-and-dialogsSkill
- navigation-patternsSkill
- onboarding-flowsSkill
- responsive-layoutSkill
- settings-pagesSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 49
Add an undo action instead of a confirm dialog for reversible actions:
- Very specific: line 57
When the message belongs to a place on the page (a failed section, a plan limit), use an Alert, not a toast — it stays visible and doesn't …
- Very specific: line 70
Use assertive for errors, polite for success.
- Distinctive: line 71
Never convey status by color only — include an icon and text.
- Distinctive: line 75
Don't toast on every keystroke or trivial state change.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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
Notifications & Toasts
Overview
Feedback tells users their action worked (or didn't). Pick the right channel for the message's importance and persistence: toasts for transient confirmations, inline alerts for contextual or blocking info, and a notification center for a history of async events. Overusing toasts trains users to ignore them.
When to use
- Confirming an action (saved, deleted, copied).
- Surfacing a recoverable error or important context.
- Async/background events users should be able to review later.
Pick the channel
| Channel | For | Persistence |
| Toast (sonner) | Transient success/error of a user action | Auto-dismiss (~4s) |
Inline Alert | Contextual, blocking, or persistent info | Stays until resolved |
| Notification center | Async events, history | Until read/cleared |
Toasts with sonner
// app root
import { Toaster } from "@/components/ui/sonner";
<Toaster richColors closeButton />
// anywhere
import { toast } from "sonner";
toast.success("Invoice sent");
toast.error("Couldn’t send invoice", { description: "Check the email and try again." });Promise toast for async work — one call covers loading → success/error:
toast.promise(saveSettings(values), {
loading: "Saving…",
success: "Settings saved",
error: (e) => e.message ?? "Save failed",
});Add an undo action instead of a confirm dialog for reversible actions:
toast("Invoice deleted", { action: { label: "Undo", onClick: () => restore(id) } });Inline alerts for context
When the message belongs to a place on the page (a failed section, a plan limit), use an Alert, not a toast — it stays visible and doesn't disappear before it's read:
<Alert variant="destructive">
<AlertCircle className="h-4 w-4" />
<AlertTitle>Payment failed</AlertTitle>
<AlertDescription>Update your card to keep your subscription active.</AlertDescription>
</Alert>Accessibility
- Toasts must live in an
aria-liveregion so screen readers announce them — sonner/shadcn do this; don't roll your own silent toast. - Use
assertivefor errors,politefor success. - Never convey status by color only — include an icon and text.
Don't over-notify
- Don't toast on every keystroke or trivial state change.
- One toast per action; collapse bulk results ("3 invoices sent").
- Critical/irreversible decisions need a dialog (
modals-and-dialogs), not a toast. - Errors the user must fix belong inline next to the cause, not in a toast that vanishes.
Pitfalls
- Toast for everything — noise users learn to ignore.
- Errors-only-as-toasts that auto-dismiss before being read — use inline
Alert. - Non-accessible custom toasts with no live region.
- Color-only status (green/red with no icon/text).
- No undo for reversible destructive actions — friendlier than a confirm modal.
- Stacking dozens of toasts — throttle/dedupe.
Hand-off
The feedback layer for forms-and-validation, data-tables bulk actions, and settings-pages; escalate critical decisions to modals-and-dialogs.
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.

