agentsclimarketplace

Realtime subscriptions

Skill m-binimran/dev-pack/skills/realtime-subscriptions

Guardrails, skills, loops, hooks & review agents for database + website builders on Claude Code (Next.js + Supabase).

Install
npx -y skills add m-binimran/dev-pack --skill realtime-subscriptions

Assembled 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

NeedUse
React to DB inserts/updates/deletesPostgres Changes
Ephemeral messages (cursors, typing)Broadcast
Who's online / shared statePresence

Process

  1. Subscribe in a client component, inside useEffect. Realtime can't live in a server component.
  2. Always unsubscribe in the effect cleanup (supabase.removeChannel(channel)) — leaked channels pile up and cause duplicate handlers.
  3. 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.
  4. Reconcile with your cache: on an event, update the query cache (state-architect) rather than keeping a parallel copy. Handle reconnects (refetch on SUBSCRIBED after a drop).
  5. 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.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.