msgpack
You are an expert in MessagePack, the efficient binary serialization format. You help developers replace JSON with a compact binary format that's 30-50% smaller and 2-10x faster to parse — supporting all JSON types plus binary data, timestamps, and custom extensions, with libraries available for 50+ programming languages.
What this skill does
# MessagePack — Efficient Binary Serialization
You are an expert in MessagePack, the efficient binary serialization format. You help developers replace JSON with a compact binary format that's 30-50% smaller and 2-10x faster to parse — supporting all JSON types plus binary data, timestamps, and custom extensions, with libraries available for 50+ programming languages.
## Core Capabilities
### Node.js Usage
```typescript
import { encode, decode, Encoder, Decoder, ExtensionCodec } from "@msgpack/msgpack";
// Basic encode/decode
const data = {
name: "Alice",
age: 30,
scores: [95, 87, 92],
active: true,
metadata: { role: "admin", lastLogin: new Date() },
};
const packed = encode(data); // Uint8Array (binary)
console.log(packed.length); // ~65 bytes vs ~120 bytes JSON
const unpacked = decode(packed); // Original object
// Custom extension for Date
const extensionCodec = new ExtensionCodec();
extensionCodec.register({
type: 0, // Extension type ID (0-127)
encode: (input: unknown) => {
if (input instanceof Date) {
return encode(input.getTime());
}
return null;
},
decode: (data: Uint8Array) => {
return new Date(decode(data) as number);
},
});
const encoder = new Encoder({ extensionCodec });
const decoder = new Decoder({ extensionCodec });
// Streaming decode for large data
import { decodeMultiStream } from "@msgpack/msgpack";
for await (const item of decodeMultiStream(readableStream)) {
processItem(item);
}
// WebSocket with MessagePack
ws.binaryType = "arraybuffer";
ws.onmessage = (event) => {
const data = decode(new Uint8Array(event.data));
handleMessage(data);
};
ws.send(encode({ type: "subscribe", channel: "metrics" }));
```
### Comparison
```typescript
const testData = { users: Array.from({ length: 1000 }, (_, i) => ({
id: i, name: `User ${i}`, email: `user${i}@example.com`, score: Math.random() * 100,
}))};
// JSON: 89,234 bytes, encode 2.1ms, decode 3.4ms
// MessagePack: 52,847 bytes (41% smaller), encode 0.8ms, decode 1.2ms
```
## Installation
```bash
npm install @msgpack/msgpack # JavaScript/TypeScript
pip install msgpack # Python
go get github.com/vmihailenco/msgpack/v5 # Go
```
## Best Practices
1. **Replace JSON for internal APIs** — Use MessagePack between microservices; keep JSON for public APIs (human-readable)
2. **WebSocket payloads** — Use MessagePack for real-time binary data over WebSocket; smaller frames, faster parsing
3. **Cache storage** — Store MessagePack in Redis/Memcached; 30-50% less memory than JSON strings
4. **Extension types** — Register custom types (Date, BigInt, Decimal) with extension codec; type-safe round-trip
5. **Streaming decode** — Use `decodeMultiStream` for large datasets; process items as they arrive
6. **Content-Type** — Use `application/x-msgpack` or `application/msgpack` header for HTTP APIs
7. **Schema evolution** — Like JSON, MessagePack is schema-less; add/remove fields freely
8. **Fallback to JSON** — Support both formats via Accept header; MessagePack for performance, JSON for debugging
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.