Skip to main content
rule CX Codex

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

Install into Cursor · Manually: put the files in place All methods and platforms ↓
.cursor/rules/realtime.mdc
Open on GitHub

What 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 orders table changes through useRealtimeSubscription.
  • 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.mdc

Frontmatter: description, globs, alwaysApply

Step 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.

Similar IDE rules

All IDE rules for Backend and APIs →

From the same set25

The whole set →
server-actions This Claude Code rule guides the choice between Server Actions and API routes for reading or changing data. It applies when an agent writes server-side application logic. CX Codex +1 ★ 1,120repo stars input-label The input-label Claude Code rule sets how fields get their captions through the Input component. It applies to *.tsx files and disallows a separate caption above the field. CX Codex +1 ★ 1,120repo stars supabase-typed-mutations The supabase-typed-mutations Claude Code rule adds Database types to Supabase insert, update, and upsert calls. It applies while an agent works with these mutations. CX Codex +1 ★ 1,120repo stars use-shadcn This rule for Claude Code, Codex, and Cursor guides agents to reuse shadcn/ui components. When building UI, it directs them to look for existing project components first. CX Codex +1 ★ 1,120repo stars one-component-per-file The one-component-per-file Claude Code rule keeps each React component in its own file. It applies to *.tsx files. CX Codex +1 ★ 1,120repo stars dialog-trigger-pattern The dialog-trigger-pattern Claude Code rule defines how dialog components receive their trigger. It applies to .tsx files. CX Codex +1 ★ 1,120repo stars ai-sdk This Claude Code rule covers structured data generation with the Vercel AI SDK. It applies to TypeScript and TSX files. CX Codex +1 ★ 1,120repo stars trigger.basic trigger.basic is a Claude Code rule for writing Trigger.dev tasks. It applies to TypeScript files matching **/trigger/**/*.ts. CX Codex +1 ★ 1,120repo stars

Project sponsors

Companies that keep this analytics open