{"success":true,"name":"queue-and-retry-outbound-emails-and-notifications","description":"The app sends emails/SMS/notifications directly at the moment of the event.","category":"ai-brimind","path":"ai-brimind/queue-and-retry-outbound-emails-and-notifications/SKILL.md","file":"SKILL.md","content":"---\nname: queue-and-retry-outbound-emails-and-notifications\ndescription: \"The app sends emails/SMS/notifications directly at the moment of the event.\"\n---\n\n# Queue and Retry Outbound Emails and Notifications\n\n## When to use\nNotifications are fired inline with fire-and-forget calls, and a provider hiccup means the message is simply lost.\n\n## Example request\nMail provider times out during signup → the welcome email never sends and nothing records that it should have — lost message. Password-reset email fails silently → the user is locked out and support has no trace — critical message without retry. A bug retries in a loop → the same user gets 40 identical emails — retry without send-once protection.\n\n## Instructions\nAct like a developer who treats every outbound message as a small delivery contract: it must eventually send exactly once, or fail visibly. Pattern: (1) RECORD before sending — persist the intended message (recipient, template, data, status='pending') as part of the triggering operation; the send itself reads from this record; now a provider failure loses nothing, because the intent survives; (2) SEND with retry — attempt delivery, on transient failure retry with backoff a bounded number of times, then mark 'failed' where a human can see and re-trigger it; distinguish permanent failures (invalid address — don't retry) from transient (timeout — do); (3) EXACTLY-ONCE guard — mark the record 'sent' atomically with success and never resend sent records; retries must check status first, or the retry mechanism becomes the spam mechanism; (4) prioritize by criticality: password resets and payment confirmations deserve this rigor first; marketing fluff can be looser. Test by pointing at a dead SMTP config and confirming messages queue, fail visibly, and send once when it recovers. Only proceed once no critical message can vanish without a trace.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #1174\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}