add-notification
Add an email users receive (a code, an alert, a notice). Use when the user wants to notify, remind, alert or email someone about something.
SKILL.md.claude/skills/add-notification/SKILL.md
GitHubAdd a notification
A notification is an email template in apps/notifications, queued as a job or asked for through the outbox.
- Payload. Add a
z.object({ template: z.literal("<area>.<name>"), to, data })tonotificationPayloadinpackages/jobs/src/queues.ts.tois{ email, locale }. - Copy. Every string in
packages/i18n/messages/en.json, underemail.<camelCaseName>(compareauth.security-alert:email.securityAlert). - Email. A component in
packages/email/src/templates/with its subject, exported frompackages/email/src/index.ts, and a preview inpackages/email/src/previews/(bun run --cwd packages/email devserves them on http://localhost:3030). - Template. An entry in
templatesinapps/notifications/src/dispatch/templates.tsthat renders it. Thesatisfiesclause failscheck-typesuntil it exists. - Trigger. From a service: a producer for
notifications-criticalandadd("send", payload, { jobId }). When it must go out with a change, and never without it:requestNotification(tx, …)(apps/api/src/notifications.ts) in the change's transaction. From a domain event: route the event toevents-notificationsineventSubscribersand map it inapps/notifications/src/events/events.processor.ts. - Tests.
bun run test(i18n completeness, email rendering inpackages/email/src/render.test.tsx), thenbun run test:integration(apps/notifications/test/notifications.integration.test.tssends through Mailpit). - Finish. The verify skill, then the
i18n-checkeragent on the new copy and therevieweragent on the change (delivery throughDeliveryLog.claim(), the suppression list).