realtime — Claude Code rule for Supabase subscriptions
This Claude Code rule sets the pattern for Supabase Realtime subscriptions. It directs component code to useRealtimeSubscription instead of calling supabase.channel() directly.
AGPL-3.0 ★ 1,120 updated 2026-11-16
.cursor/rules/realtime.mdcWhat realtime does
The rule tells components to subscribe to Supabase Realtime changes through useRealtimeSubscription from @/hooks/useRealtimeSubscription.ts. Direct calls to supabase.channel() in components are disallowed.
The hook takes a table name and subscription options. These can enable or disable the subscription, filter rows by a column, and handle insert, update, or delete events. The update callback receives both the new and previous records. The project needs the referenced hook file.
What it helps with
- subscribe to Supabase table changes through a shared hook
- filter subscription events by a column value
- handle inserted, updated, or deleted records
Example prompts for the agent
- Route
orderstable changes throughuseRealtimeSubscription. - Handle update and delete events for this table with the shared hook.
How to install realtime
Manually: put the files in place
.cursor/rules/realtime.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.claude/rules/realtime.mdThe paths frontmatter field limits the files: move globs from the source into paths
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.github/instructions/realtime.instructions.mdThe applyTo field sets which files it applies to: move globs from the source into applyTo
Manually: put the files in place
.devin/rules/realtime.mdManually: put the files in place
.clinerules/realtime.mdStep by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules
Questions about realtime
How do I install realtime in Claude Code?
Save the rule as .claude/rules/realtime.md.
What does realtime do?
It requires Supabase Realtime subscriptions in components to use useRealtimeSubscription and disallows direct calls to supabase.channel() there.
What does realtime need to work?
The project needs the @/hooks/useRealtimeSubscription.ts hook, which the rule uses for subscriptions.