pubnub-app-context/SKILL.md
Manages PubNub App Context (Objects API) for users, channels, and memberships. Covers user/channel metadata, custom fields, membership management, querying with filters, and referential integrity. Use when storing user profiles, channel metadata (name, topic, mute flags), tracking who is in which channel, or working with the Objects/App Context API.
npx skillsauth add pubnub/skills pubnub-app-contextInstall 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 the App Context specialist. Your role is to help developers store and query metadata about users, channels, and memberships using PubNub's Objects API.
Invoke this skill when:
uuid, channel, membership event types)Do not use App Context for:
custom fields on users, channels, and memberships.includeCustomFields: true whenever you need custom data.Every keyset that uses App Context must have:
For keyset configuration in general, see pubnub-keyset-management/references/keysets-and-environments.md.
| Object | API surface | Identifier | Holds |
|---|---|---|---|
| User (UUID Metadata) | setUUIDMetadata, getUUIDMetadata, getAllUUIDMetadata, removeUUIDMetadata | userId (== UUID) | name, email, externalId, profileUrl, custom fields |
| Channel (Channel Metadata) | setChannelMetadata, getChannelMetadata, getAllChannelMetadata, removeChannelMetadata | channel name | name, description, custom fields |
| Membership (User-in-Channel) | setMemberships, getMemberships, getChannelMembers, removeMemberships | (userId, channelId) pair | custom fields per relationship |
The custom field on each object holds your application-specific data. Use scalar values (strings, numbers, booleans). Nested objects are supported but keep them shallow.
await pubnub.objects.setUUIDMetadata({
uuid: 'user-123',
data: {
name: 'Alice',
email: '[email protected]',
custom: {
role: 'admin',
avatar: 'https://cdn.example.com/u/123.jpg',
timezone: 'America/Los_Angeles',
app_version: '2.1.0'
}
}
});
includeCustomFields: true Is Required to Read Custom DataThe single most common App Context bug: forgetting to opt in to custom fields on read.
const result = await pubnub.objects.getUUIDMetadata({
uuid: 'user-123',
include: { customFields: true }
});
console.log(result.data.custom);
Without customFields: true, the custom object is omitted from the response.
include.customFields: true when reading if your code touches custom.When this skill is active, prefer:
manage_app_context — create, read, update, delete users, channels, and memberships from the Admin Portal APInew PubNub(...) initialization and userId requirements (the same userId is the App Context user identifier)APPCONTEXT_SET_USER_METADATA, APPCONTEXT_SET_CHANNEL_METADATA, APPCONTEXT_SET_MEMBERSHIP_METADATA)When providing implementations:
include: { customFields: true } on read operations that touch custom.tools
Cross-cutting reliability patterns for PubNub apps. Covers reconnect with exponential backoff + jitter, idempotent publish with client-generated message IDs, dedup-on-merge for live + history streams, queue-and-retry for offline writes, and schema versioning of message envelopes. Use during design reviews, when planning offline support, or during incident response when network or delivery reliability is the concern.
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.
development
Build real-time multiplayer games with PubNub game state sync
development
Build real-time voting and polling systems with PubNub