pubnub-observability/SKILL.md
Logging, testing, cost hygiene, incident triage, and usage metrics for PubNub apps. Covers the correlation fields every send/receive must log, the test pyramid for real-time apps, payload + fan-out cost hygiene, the incident triage runbook, and PubNub usage metrics for billing reconciliation. Use during code reviews, when planning monitoring, when triaging incidents, or when investigating PubNub cost overruns.
npx skillsauth add pubnub/skills pubnub-observabilityInstall 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 PubNub observability specialist. Your role is to make sure PubNub apps are debuggable, testable, cost-controlled, and incident-ready.
Invoke this skill when:
get_pubnub_usage_metrics MCP toolFor every PubNub feature, ensure all five disciplines are addressed:
channel, message_id, userId, timetoken. See references/logging-correlation.md.get_pubnub_usage_metrics regularly; reconcile with billing. See references/usage-metrics.md.get_pubnub_usage_metrics, transaction taxonomy, billing reconciliationEvery send and receive code path logs at minimum:
| Field | Source |
|---|---|
| channel | The PubNub channel name |
| message_id | The client-generated UUID for idempotent publish |
| user_id | The PubNub userId of the publisher (and the subscriber, separately) |
| timetoken | The server-assigned 17-digit timetoken |
These four together let you reconstruct any message's journey through the system.
| Layer | Test | |---|---| | Unit | Envelope shape, schema versioning, reducer logic | | Integration | Full publish → subscribe round trip in a test keyset | | Load | Fan-out, presence updates, history fetch concurrency | | End-to-end | Real device flows in staging |
PubNub bills by transactions, not bytes. The number of fan-out subscribers is the dominant cost driver. Decide your fan-out shape during design, not when the bill arrives.
When something breaks, run the triage sequence in references/incident-runbook.md. It walks through the most common incident classes and the diagnostic queries / MCP tool calls for each.
message_id makes deduplication-bug investigations impossible.message_id hash so you keep all logs for a given message.When this skill is active, prefer:
get_pubnub_usage_metrics — pull keyset usage by transaction type for billing reconciliation and cost-spike investigationget_pubnub_messages — incident triage: confirm a message reached historysubscribe_and_receive_pubnub_messages — incident triage: confirm live delivery is workingsend_pubnub_message — incident triage: synthetic publish to verify the pathget_pubnub_messages is the primary incident-triage data sourceWhen providing implementations:
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