pubnub-app-developer/SKILL.md
Build real-time applications with PubNub pub/sub messaging. Covers SDK initialization, persistent userId, channel design and naming, publish/subscribe basics, message listeners, and connection state. Use when bootstrapping a PubNub project, adding pub/sub to an app, designing channel hierarchies, or working out userId / channel naming rules.
npx skillsauth add pubnub/skills pubnub-app-developerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are a PubNub application development specialist. Your role is to help developers build real-time applications using PubNub's publish/subscribe messaging platform.
Invoke this skill when:
userId and keys (sdk-patterns.md).get_sdk_documentation, write_pubnub_app) and skill, see intent-to-tool routing.| Reference | Purpose |
|-----------|---------|
| sdk-patterns.md | Cross-platform SDK initialization, userId requirements, configuration knobs |
| publish-subscribe.md | Core pub/sub patterns, message flow, listener patterns |
| channels.md | Channel naming rules, hierarchies, design patterns |
| message-filters.md | Server-side filtering with subscribeFilterExpression |
| sdk-upgrades.md | Major-version migrations, breaking changes, enableEventEngine |
| rest-api.md | When to use the raw REST API vs the SDK |
const pubnub = new PubNub({
publishKey: process.env.PN_PUBLISH_KEY,
subscribeKey: process.env.PN_SUBSCRIBE_KEY,
userId: getUserId() // REQUIRED — must be persistent per user
});
For per-environment key sourcing see pubnub-keyset-management/references/keysets-and-environments.md.
pubnub.addListener({
message: (event) => {
console.log('Channel:', event.channel);
console.log('Message:', event.message);
},
status: (statusEvent) => {
if (statusEvent.category === 'PNConnectedCategory') {
console.log('Connected to PubNub');
}
}
});
For full status-event semantics including disconnect categories see pubnub-presence/references/dropped-connections.md.
await pubnub.publish({
channel: 'my-channel',
message: { text: 'Hello', timestamp: Date.now() }
});
For idempotent publish with message_id — strongly recommended for any publish that can retry — see the canonical owner.
userId for SDK initialization (see sdk-patterns.md).. is reserved: maximum 3 dot-separated levels (a.b.c). a.b.c.d is always invalid and causes publish/subscribe failures. This applies to every channel name the agent generates — in SDK calls, Functions, and Illuminate Decisions.When this skill is active, prefer:
get_sdk_documentation — pull canonical SDK docs for the user's languagewrite_pubnub_app — scaffold a new PubNub project with this skill's patterns baked insend_pubnub_message — synthetic publish for verificationsubscribe_and_receive_pubnub_messages — synthetic subscribe for verificationWhen providing implementations:
tools
Builds real-time analytics and automation with PubNub Illuminate. Covers Business Objects (schema), Metrics (aggregations), Decisions (threshold-triggered actions with the 4-step PUT workflow), Queries (ad-hoc vs saved pipelines), and Dashboards. Use when tracking KPIs, building threshold alerts, automating mute/publish/App-Context-update actions, detecting spam or anomalies, or visualizing live activity.
testing
Scale PubNub applications for high-volume real-time events using channel groups, wildcard subscriptions, sharding, and large-event readiness. Covers Stream Controller add-on, hard caps, payload coalescing referenced into pubnub-observability, and the engagement model for 10K+ concurrent live events. Persistence/history is owned by pubnub-history.
tools
Deliver real-time sports scores, play-by-play, and scoreboards with PubNub
development
Create, configure, and deploy PubNub Functions 2.0 event handlers, triggers, and serverless endpoints. Covers Before/After Publish, On Request, On Interval; built-in modules (kvstore, xhr, vault, pubnub, crypto, jwt, ugc, jsonpath, advanced_math, codec/*); chaining (3 hops, 5 consecutive, Chaining vs Forking, kvstore state sharing); runtime quirks (3-call external cap, 10-call vault cap, cold start, request.path normalization, vault availability, sendFile message); DB-trigger patterns; and bundling/TypeScript workflow (esbuild externals, 64KB guard, __require shim stripping, default-export shape). Use when building real-time message transformations, edge data processing, REST endpoints backed by PubNub, webhook integrations, or shipping bundled/transpiled TypeScript Functions from inside the message pipeline.