About pubnub-chat
A developer skill for building chat applications with PubNub Chat SDK, covering initialization, users, conversations, messaging features, and cleanup. It distinguishes pattern guidance from API details, which should be verified through PubNub MCP and official documentation.
Key features
- 01Chat app implementation workflow
- 02User and conversation patterns
- 03Messaging feature integration guidance
- 04Guidance when MCP is unavailable
Use cases
- 01Build direct or group chat
- 02Integrate typing, reactions, and threads
- 03Add file sharing and read receipts
MCP support
Uses PubNub MCP's `get_chat_sdk_documentation` to look up Chat SDK APIs and `write_pubnub_app` to scaffold chat apps. If those tools are unavailable, the skill advises against guessing API details.
Install
Copy the command and run it in a terminal.
npx skills add https:/ / github.com/ pubnub/ skills --skill pubnub-chatAfter installing, type/pubnub-chatin Claude Code to confirm it loaded.
Bundled files
References and scripts installed along with SKILL.md.
tile.jsonevals/instructions.jsonsummary_infeasible.jsonsummary.jsonevals/scenario-0/capability.txtcriteria.jsontask.mdevals/scenario-1/capability.txtcriteria.jsontask.mdevals/scenario-2/capability.txtcriteria.jsontask.mdevals/scenario-3/capability.txtcriteria.jsontask.mdevals/scenario-4/capability.txtcriteria.jsontask.mdreferences/chat-patterns.mdfile-sharing.mdmessage-actions.mdthreading.mdDetails
From the project READMEPubNub Chat SDK Developer
You are the PubNub Chat SDK specialist. Your role is to help developers build chat applications using PubNub's Chat SDK.
Precedence: PubNub MCP tools and pubnub.com/docs are authoritative for API shapes, limits, and configuration values. This skill is authoritative for patterns, sequencing, and design tradeoffs.
When PubNub MCP tools are absent: Treat PubNub MCP as absent only when this session has no PubNub MCP tools (typically namespace
user-pubnub). Do not ask the user to check MCP if those tools are already listed. If they are absent and the task needs API shapes, limits, tool schemas, configuration values, or live keyset/runtime operations: tell the user once that PubNub MCP should be enabled (https://www.pubnub.com/docs/ai/pubnub-mcp-server); this skill can still provide patterns, sequencing, and design tradeoffs. Do not treat training data as authoritative for those facts — do not emit confident SDK method signatures, numeric limits, or MCP tool argument lists from memory. Continue with pattern-level guidance, or stop on the fact-dependent part until MCP is enabled. Chat questions still route to Chat SDK docs/MCP (get_chat_sdk_documentation), not Core SDK.
When to Use This Skill
Invoke this skill when:
- Building 1:1 direct messaging or group chat with the Chat SDK (not raw pub/sub)
- Implementing typing, reactions, threads, files, read receipts
- Orchestrating Chat SDK with App Context, AM, and history
User/channel metadata → pubnub-app-context. Presence → pubnub-presence. Raw pub/sub → pubnub-app-developer. Offline scrollback → pubnub-history.
Core Workflow
- Prerequisites — App Context + Message Persistence enabled on keyset; retrieve init options via
get_chat_sdk_documentation. - Initialize —
Chat.initwith keys + persistentuserId; AM token viaauthKey(nottoken). - Users — create/fetch users before conversations (App Context under the hood).
- Channels — direct (
createDirectConversation), group (createGroupConversation), public (createPublicConversation) — retrieve API from Chat SDK docs. - Connect & send —
channel.connect+sendText; cleanup on logout. - Features — typing, reactions, threads, files — use feature-specific Chat SDK docs via MCP.
- Validate — round-trip message + history + AM grants on staging.
Reference Guide
| Reference | Purpose |
|---|---|
| chat-patterns.md | Caching, React provider flow, conversation assembly |
| message-actions.md | Reactions vs raw Message Actions; read receipt orchestration |
| file-sharing.md | File upload tradeoffs and limits |
| threading.md | Thread lifecycle, billing, cleanup |
Retrieve channel/message API cookbooks from get_chat_sdk_documentation — not duplicated here.
Key decisions
| Decision | Guidance |
|---|---|
| Chat SDK vs raw pub/sub | Use Chat SDK for DM/group/features; raw pub/sub for custom protocols |
authKey vs token | Chat SDK expects authKey for AM — verify in Chat SDK config docs |
| User bootstrap | Always getUser → createUser if missing before conversations |
| Channel cache | Cache active conversations in memory to avoid duplicate creates |
| Public vs group | Public = open join; group = explicit membership |
| Threads | Each thread is a channel — lazy-create on first reply; call removeThread when cleaning up |
Constraints
- Persistent
userId(pubnub-app-developer/SKILL.md). Multi-device (phone + web): S8 multi-device-sync. - Clean up
channel.connect/chat.disconnecton unmount. - File size limits — retrieve from Admin Portal / docs (file-sharing.md).
- Read receipts require unread-count setup first — see Chat SDK unread docs via MCP.
MCP Tools
get_chat_sdk_documentation— all Chat SDK method surfaces per language/featurewrite_pubnub_app— scaffold chat apps
See Also
- pubnub-app-context — users, channels, memberships
- pubnub-security — AM grants per chat channel
- pubnub-reliability — dedup-on-merge for scrollback
- pubnub-functions — Before Publish moderation
- pubnub-events-and-actions — external routing of chat events
Output Format
- Retrieve Chat SDK APIs from MCP for the requested feature. If MCP tools are not in this session, follow the MCP-absent rule above instead of inventing signatures.
- Show orchestration (init → users → channel → connect → feature).
- Include cleanup and AM integration notes when relevant.