Skip to content

feat: realtime agent reference#21

Merged
gregnr merged 29 commits intofeature/supabase-skillfrom
feature/realtime-agent-reference
Feb 6, 2026
Merged

feat: realtime agent reference#21
gregnr merged 29 commits intofeature/supabase-skillfrom
feature/realtime-agent-reference

Conversation

@Rodriguespn
Copy link
Collaborator

What kind of change does this PR introduce?

Adds comprehensive Realtime reference documentation to the Supabase skill.

What is the current behavior?

The Supabase skill lacks detailed guidance for Realtime features. Developers using the skill had no reference material for Broadcast messaging, Presence tracking, or Postgres Changes subscriptions.

What is the new behavior?

Added a complete set of 8 reference files organized in skills/supabase/references/realtime/ covering:

  • Channel Setup (2 files): Channel creation with structured naming conventions (scope:entity:id pattern), configuration options, and authentication setup including RLS policies on realtime.messages
  • Broadcast Messaging (2 files): Client-to-client pub/sub patterns and database-triggered broadcasts using realtime.broadcast_changes() and realtime.send()
  • Presence Tracking (1 file): Online status tracking, shared state synchronization, custom presence keys, and quota awareness
  • Postgres Changes (1 file): Database change listeners with clear guidance on when to use (prototyping, low scale) vs. when to migrate to Broadcast (production, high scale)
  • Implementation Patterns (2 files): Critical React cleanup patterns to prevent memory leaks and connection quota exhaustion, plus error handling and connection status management

The SKILL.md resources table was updated to reflect the new Realtime categories, and AGENTS.md was regenerated to include navigation to the new reference files.

Decisions

Key architectural and content decisions made during development:

  1. Organized by feature prefix: Adopted the existing db/ pattern with prefixes (setup-, broadcast-, presence-, postgres-, patterns-) to enable predictable file discovery and maintain consistency with other reference categories.

  2. Broadcast over Postgres Changes: References consistently recommend Broadcast for new production applications due to scalability advantages. Postgres Changes is positioned as useful for prototyping but limited by per-subscriber RLS checks (100 subscribers = 100 DB reads per change). This guidance came from Supabase's own documentation and the kiro-powers steering file.

  3. Security-first approach: Private channels and RLS policies on realtime.messages are emphasized throughout. All examples use private: true and include authentication setup with supabase.realtime.setAuth(). The setup-auth.md reference is marked CRITICAL impact.

  4. React cleanup patterns emphasized: Memory leak prevention through proper channel cleanup is given CRITICAL impact rating. The patterns-cleanup.md file includes detailed useRef and useEffect patterns to prevent duplicate subscriptions and ensure channels are removed on unmount.

  5. Structured naming convention: Introduced scope:entity:id topic naming pattern (e.g., room:123:messages) to enable topic-based RLS policies and make channel purposes clear and filterable.

  6. Database-triggered broadcasts: Highlighted realtime.broadcast_changes() as the scalable alternative to postgres_changes subscriptions, with complete examples of trigger setup and client subscription patterns.

Additional context

Sources consulted:

  • Supabase Realtime documentation: concepts, broadcast, presence, postgres-changes, authorization
  • Supabase Realtime quotas and pricing documentation
  • Supabase Realtime troubleshooting guides
  • kiro-powers [supabase-prompts-use-realtime.md](https://github.com/supabase-community/kiro-powers/blob/main/shared/supabase-prompts-use-realtime.md) steering file

Impact ratings:

  • CRITICAL: setup-auth.md, broadcast-database.md, patterns-cleanup.md (security and stability)
  • HIGH: setup-channels.md, broadcast-basics.md, patterns-errors.md (core functionality)
  • MEDIUM: presence-tracking.md, postgres-changes.md (optional features with usage caveats)

Trade-offs considered:

  • Postgres Changes is included despite scalability limitations because it's useful for prototyping and appears in existing Supabase projects. Clear guidance directs users to Broadcast for production scenarios.
  • Presence is marked MEDIUM impact because it has computational overhead and lower message rate quotas, making it appropriate only for specific use cases (online indicators, typing status) rather than general state synchronization.

@Rodriguespn Rodriguespn self-assigned this Jan 27, 2026
@Rodriguespn Rodriguespn added the new-rule Adding a new rule(s) to a skill label Jan 27, 2026
Copy link
Member

@edgurgel edgurgel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a few comments!

@Rodriguespn Rodriguespn force-pushed the feature/realtime-agent-reference branch 2 times, most recently from 124e570 to 78de1af Compare January 28, 2026 12:25
The CLAUDE.md symlink causes installation errors when using
`npx skills add` as it tries to copy AGENTS.md to itself.

- Remove createClaudeSymlink function from build.ts
- Remove claudeSymlink from SkillPaths interface
- Remove CLAUDE.md references from AGENTS.md structure documentation
- Delete existing CLAUDE.md symlink from skills directory

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Rodriguespn Rodriguespn force-pushed the feature/supabase-skill branch from 4cdb582 to 7a861d9 Compare January 28, 2026 15:56
@Rodriguespn Rodriguespn force-pushed the feature/realtime-agent-reference branch from 78de1af to d978409 Compare January 28, 2026 15:57
Rodriguespn and others added 2 commits January 28, 2026 16:29
Add a sanity test that verifies the skills CLI installation works:
- Runs `npx skills add . -a claude-code -y` using current directory
- Checks command doesn't fail (exit code 0)
- Verifies .claude/skills directory is created
- Dynamically discovers skills in the repo and verifies they're installed
- Checks SKILL.md exists in each installed skill

The test runs on every push to main and pull requests.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Rodriguespn and others added 14 commits January 28, 2026 16:46
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: supabase db references

* refactor: move database references to db subdirectory

Move all database reference files to references/db/ to organize
by product area and take advantage of the new subdirectory support
in the build system.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
The build system now correctly preserves subdirectory paths when
generating the Available References section. For example, files in
references/db/ are now listed as references/db/file.md instead of
just references/file.md.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Rodriguespn Rodriguespn force-pushed the feature/supabase-skill branch from 7a861d9 to f5587cb Compare January 28, 2026 16:47
@Rodriguespn Rodriguespn force-pushed the feature/realtime-agent-reference branch from d978409 to bbeb790 Compare January 28, 2026 16:47
Rodriguespn and others added 5 commits January 28, 2026 16:52
Co-authored-by: Filipe Cabaço <filipecabaco@gmail.com>
Co-authored-by: Filipe Cabaço <filipecabaco@gmail.com>
Co-authored-by: Filipe Cabaço <filipecabaco@gmail.com>
Co-authored-by: Filipe Cabaço <filipecabaco@gmail.com>
Co-authored-by: Filipe Cabaço <filipecabaco@gmail.com>
@Rodriguespn Rodriguespn force-pushed the feature/supabase-skill branch from a450ab6 to 2f78f8f Compare January 30, 2026 13:41
Rodriguespn and others added 3 commits January 30, 2026 14:09
- Merge feature/supabase-skill
- Move realtime/* files to realtime-* prefix in references/
- Remove .claude from git tracking
- Update SKILL.md with flat paths
- Rebuild AGENTS.md

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@gregnr gregnr marked this pull request as ready for review February 5, 2026 23:32
@gregnr gregnr merged commit 0cad768 into feature/supabase-skill Feb 6, 2026
3 checks passed
@gregnr gregnr deleted the feature/realtime-agent-reference branch February 6, 2026 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-rule Adding a new rule(s) to a skill

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants