Realtime subscriptions
Guardrails, skills, loops, hooks & review agents for database + website builders on Claude Code (Next.js + Supabase).
npx -y skills add m-binimran/dev-pack --skill realtime-subscriptionsAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Add Supabase Realtime to a Next.js app — Postgres Changes, Broadcast, and Presence — with proper cleanup and RLS-aware channels. Use when building live updates, presence indicators, or collaborative features.
SKILL.md
1.6 KB, as published. Nobody here has run it
realtime-subscriptions
Live data is a client concern (it needs a persistent connection). Wire it carefully and always clean up.
Pick the mechanism
| Need | Use |
|---|---|
| React to DB inserts/updates/deletes | Postgres Changes |
| Ephemeral messages (cursors, typing) | Broadcast |
| Who's online / shared state | Presence |
Process
- Subscribe in a client component, inside
useEffect. Realtime can't live in a server component. - Always unsubscribe in the effect cleanup (
supabase.removeChannel(channel)) — leaked channels pile up and cause duplicate handlers. - RLS applies to Realtime. A client only receives change events for rows it's allowed to read. Enable Realtime on the table and confirm the policies.
- Reconcile with your cache: on an event, update the query cache (
state-architect) rather than keeping a parallel copy. Handle reconnects (refetch onSUBSCRIBEDafter a drop). - Don't over-subscribe: scope channels narrowly (filter by id); a firehose channel is a performance and cost problem.
Output
- The channel setup, the cleanup, the RLS/Realtime enablement note, and how events update the UI/cache.
Guardrails
- Every subscription has a matching cleanup — no exceptions (memory + duplicate-event bugs).
- Realtime is not your security layer; RLS is. Don't broadcast data the user can't already read.