[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6WZ1ZVG6PJ4PVN9RTK0BX7Z":3,"skill-same:01M6WZ1ZVG6PJ4PVN9RTK0BX7Z":74},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":52,"commitSha":53,"skillDirectory":54,"forksCount":55,"repositoryHtmlUrl":56,"repositoryHomepageUrl":6,"ownerHtmlUrl":57,"ownerBlogUrl":58,"ownerDescription":6,"updatedAt":59,"install":60,"resources":73},"01M6WZ1ZVG6PJ4PVN9RTK0BX7Z","websocket-engineer",null,"Use when building real-time communication systems with WebSockets or Socket.IO. Invoke for bidirectional messaging, horizontal scaling with Redis, presence tracking, room management.","PIXARTSeu\u002FSynapse","PIXARTSeu","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F274446381?v=4","01M6RB4XPN9YBZCRY4FVN9PJCT","Pixarts ","01M6RB4XTF8G9KHQEMC21FGDKD",12,"MIT","https:\u002F\u002Fgithub.com\u002FPIXARTSeu\u002FSynapse\u002Fblob\u002Fmain\u002Fpackages\u002Fcodegraph\u002Fdata\u002Flifecycle-skills\u002Fwebsocket-engineer\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"websocket","engineer","websocket engineer","when","architecture","invoke","socket","updates","presence","communication systems","io","scaling","time","expert","fastapi","reviewer","api","monitoring","messaging","code","2026-11-10 10:12:30",false,"---\nname: websocket-engineer\ndescription: Use when building real-time communication systems with WebSockets or Socket.IO. Invoke for bidirectional messaging, horizontal scaling with Redis, presence tracking, room management.\nlicense: MIT\nmetadata:\n  author: https:\u002F\u002Fgithub.com\u002FJeffallan\n  version: \"1.1.0\"\n  domain: api-architecture\n  triggers: WebSocket, Socket.IO, real-time communication, bidirectional messaging, pub\u002Fsub, server push, live updates, chat systems, presence tracking\n  role: specialist\n  scope: implementation\n  output-format: code\n  related-skills: fastapi-expert, nestjs-expert, devops-engineer, monitoring-expert, security-reviewer\n---\n\n# WebSocket Engineer\n\n## Core Workflow\n\n1. **Analyze requirements** — Identify connection scale, message volume, latency needs\n2. **Design architecture** — Plan clustering, pub\u002Fsub, state management, failover\n3. **Implement** — Build WebSocket server with authentication, rooms, events\n4. **Validate locally** — Test connection handling, auth, and room behavior before scaling (e.g., `npx wscat -c ws:\u002F\u002Flocalhost:3000`); confirm auth rejection on missing\u002Finvalid tokens, room join\u002Fleave events, and message delivery\n5. **Scale** — Verify Redis connection and pub\u002Fsub round-trip before enabling the adapter; configure sticky sessions and confirm with test connections across multiple instances; set up load balancing\n6. **Monitor** — Track connections, latency, throughput, error rates; add alerts for connection-count spikes and error-rate thresholds\n\n## Reference Guide\n\nLoad detailed guidance based on context:\n\n| Topic | Reference | Load When |\n|-------|-----------|-----------|\n| Protocol | `references\u002Fprotocol.md` | WebSocket handshake, frames, ping\u002Fpong, close codes |\n| Scaling | `references\u002Fscaling.md` | Horizontal scaling, Redis pub\u002Fsub, sticky sessions |\n| Patterns | `references\u002Fpatterns.md` | Rooms, namespaces, broadcasting, acknowledgments |\n| Security | `references\u002Fsecurity.md` | Authentication, authorization, rate limiting, CORS |\n| Alternatives | `references\u002Falternatives.md` | SSE, long polling, when to choose WebSockets |\n\n## Code Examples\n\n### Server Setup (Socket.IO with Auth and Room Management)\n\n```js\nimport { createServer } from \"http\";\nimport { Server } from \"socket.io\";\nimport { createAdapter } from \"@socket.io\u002Fredis-adapter\";\nimport { createClient } from \"redis\";\nimport jwt from \"jsonwebtoken\";\n\nconst httpServer = createServer();\nconst io = new Server(httpServer, {\n  cors: { origin: process.env.ALLOWED_ORIGIN, credentials: true },\n  pingTimeout: 20000,\n  pingInterval: 25000,\n});\n\n\u002F\u002F Authentication middleware — runs before connection is established\nio.use((socket, next) => {\n  const token = socket.handshake.auth.token;\n  if (!token) return next(new Error(\"Authentication required\"));\n  try {\n    socket.data.user = jwt.verify(token, process.env.JWT_SECRET);\n    next();\n  } catch {\n    next(new Error(\"Invalid token\"));\n  }\n});\n\n\u002F\u002F Redis adapter for horizontal scaling\nconst pubClient = createClient({ url: process.env.REDIS_URL });\nconst subClient = pubClient.duplicate();\nawait Promise.all([pubClient.connect(), subClient.connect()]);\nio.adapter(createAdapter(pubClient, subClient));\n\nio.on(\"connection\", (socket) => {\n  const { userId } = socket.data.user;\n  console.log(`connected: ${userId} (${socket.id})`);\n\n  \u002F\u002F Presence: mark user online\n  pubClient.hSet(\"presence\", userId, socket.id);\n\n  socket.on(\"join-room\", (roomId) => {\n    socket.join(roomId);\n    socket.to(roomId).emit(\"user-joined\", { userId });\n  });\n\n  socket.on(\"message\", ({ roomId, text }) => {\n    io.to(roomId).emit(\"message\", { userId, text, ts: Date.now() });\n  });\n\n  socket.on(\"disconnect\", () => {\n    pubClient.hDel(\"presence\", userId);\n    console.log(`disconnected: ${userId}`);\n  });\n});\n\nhttpServer.listen(3000);\n```\n\n### Client-Side Reconnection with Exponential Backoff\n\n```js\nimport { io } from \"socket.io-client\";\n\nconst socket = io(\"wss:\u002F\u002Fapi.example.com\", {\n  auth: { token: getAuthToken() },\n  reconnection: true,\n  reconnectionAttempts: 10,\n  reconnectionDelay: 1000,       \u002F\u002F initial delay (ms)\n  reconnectionDelayMax: 30000,   \u002F\u002F cap at 30 s\n  randomizationFactor: 0.5,      \u002F\u002F jitter to avoid thundering herd\n});\n\n\u002F\u002F Queue messages while disconnected\nlet messageQueue = [];\n\nsocket.on(\"connect\", () => {\n  console.log(\"connected:\", socket.id);\n  \u002F\u002F Flush queued messages\n  messageQueue.forEach((msg) => socket.emit(\"message\", msg));\n  messageQueue = [];\n});\n\nsocket.on(\"disconnect\", (reason) => {\n  console.warn(\"disconnected:\", reason);\n  if (reason === \"io server disconnect\") socket.connect(); \u002F\u002F manual reconnect\n});\n\nsocket.on(\"connect_error\", (err) => {\n  console.error(\"connection error:\", err.message);\n});\n\nfunction sendMessage(roomId, text) {\n  const msg = { roomId, text };\n  if (socket.connected) {\n    socket.emit(\"message\", msg);\n  } else {\n    messageQueue.push(msg); \u002F\u002F buffer until reconnected\n  }\n}\n```\n\n## Constraints\n\n### MUST DO\n- Use sticky sessions for load balancing (WebSocket connections are stateful — requests must route to the same server instance)\n- Implement heartbeat\u002Fping-pong to detect dead connections (TCP keepalive alone is insufficient)\n- Use rooms\u002Fnamespaces for message scoping rather than filtering in application logic\n- Queue messages during disconnection windows to avoid silent data loss\n- Plan connection limits per instance before scaling horizontally\n\n### MUST NOT DO\n- Store large state in memory without a clustering strategy (use Redis or an external store)\n- Mix WebSocket and HTTP on the same port without explicit upgrade handling\n- Forget to handle connection cleanup (presence records, room membership, in-flight timers)\n- Skip load testing before production — connection-count spikes behave differently from HTTP traffic spikes\n\n## Output Templates\n\nWhen implementing WebSocket features, provide:\n1. Server setup (Socket.IO\u002Fws configuration)\n2. Event handlers (connection, message, disconnect)\n3. Client library (connection, events, reconnection)\n4. Brief explanation of scaling strategy\n\n## Knowledge Reference\n\nSocket.IO, ws, uWebSockets.js, Redis adapter, sticky sessions, nginx WebSocket proxy, JWT over WebSocket, rooms\u002Fnamespaces, acknowledgments, binary data, compression, heartbeat, backpressure, horizontal pod autoscaling\n","# WebSocket Engineer\n\n## Core Workflow\n\n1. **Analyze requirements** — Identify connection scale, message volume, latency needs\n2. **Design architecture** — Plan clustering, pub\u002Fsub, state management, failover\n3. **Implement** — Build WebSocket server with authentication, rooms, events\n4. **Validate locally** — Test connection handling, auth, and room behavior before scaling (e.g., `npx wscat -c ws:\u002F\u002Flocalhost:3000`); confirm auth rejection on missing\u002Finvalid tokens, room join\u002Fleave events, and message delivery\n5. **Scale** — Verify Redis connection and pub\u002Fsub round-trip before enabling the adapter; configure sticky sessions and confirm with test connections across multiple instances; set up load balancing\n6. **Monitor** — Track connections, latency, throughput, error rates; add alerts for connection-count spikes and error-rate thresholds\n\n## Reference Guide\n\nLoad detailed guidance based on context:\n\n| Topic | Reference | Load When |\n|-------|-----------|-----------|\n| Protocol | `references\u002Fprotocol.md` | WebSocket handshake, frames, ping\u002Fpong, close codes |\n| Scaling | `references\u002Fscaling.md` | Horizontal scaling, Redis pub\u002Fsub, sticky sessions |\n| Patterns | `references\u002Fpatterns.md` | Rooms, namespaces, broadcasting, acknowledgments |\n| Security | `references\u002Fsecurity.md` | Authentication, authorization, rate limiting, CORS |\n| Alternatives | `references\u002Falternatives.md` | SSE, long polling, when to choose WebSockets |\n\n## Code Examples\n\n### Server Setup (Socket.IO with Auth and Room Management)\n\n```js\nimport { createServer } from \"http\";\nimport { Server } from \"socket.io\";\nimport { createAdapter } from \"@socket.io\u002Fredis-adapter\";\nimport { createClient } from \"redis\";\nimport jwt from \"jsonwebtoken\";\n\nconst httpServer = createServer();\nconst io = new Server(httpServer, {\n  cors: { origin: process.env.ALLOWED_ORIGIN, credentials: true },\n  pingTimeout: 20000,\n  pingInterval: 25000,\n});\n\n\u002F\u002F Authentication middleware — runs before connection is established\nio.use((socket, next) => {\n  const token = socket.handshake.auth.token;\n  if (!token) return next(new Error(\"Authentication required\"));\n  try {\n    socket.data.user = jwt.verify(token, process.env.JWT_SECRET);\n    next();\n  } catch {\n    next(new Error(\"Invalid token\"));\n  }\n});\n\n\u002F\u002F Redis adapter for horizontal scaling\nconst pubClient = createClient({ url: process.env.REDIS_URL });\nconst subClient = pubClient.duplicate();\nawait Promise.all([pubClient.connect(), subClient.connect()]);\nio.adapter(createAdapter(pubClient, subClient));\n\nio.on(\"connection\", (socket) => {\n  const { userId } = socket.data.user;\n  console.log(`connected: ${userId} (${socket.id})`);\n\n  \u002F\u002F Presence: mark user online\n  pubClient.hSet(\"presence\", userId, socket.id);\n\n  socket.on(\"join-room\", (roomId) => {\n    socket.join(roomId);\n    socket.to(roomId).emit(\"user-joined\", { userId });\n  });\n\n  socket.on(\"message\", ({ roomId, text }) => {\n    io.to(roomId).emit(\"message\", { userId, text, ts: Date.now() });\n  });\n\n  socket.on(\"disconnect\", () => {\n    pubClient.hDel(\"presence\", userId);\n    console.log(`disconnected: ${userId}`);\n  });\n});\n\nhttpServer.listen(3000);\n```\n\n### Client-Side Reconnection with Exponential Backoff\n\n```js\nimport { io } from \"socket.io-client\";\n\nconst socket = io(\"wss:\u002F\u002Fapi.example.com\", {\n  auth: { token: getAuthToken() },\n  reconnection: true,\n  reconnectionAttempts: 10,\n  reconnectionDelay: 1000,       \u002F\u002F initial delay (ms)\n  reconnectionDelayMax: 30000,   \u002F\u002F cap at 30 s\n  randomizationFactor: 0.5,      \u002F\u002F jitter to avoid thundering herd\n});\n\n\u002F\u002F Queue messages while disconnected\nlet messageQueue = [];\n\nsocket.on(\"connect\", () => {\n  console.log(\"connected:\", socket.id);\n  \u002F\u002F Flush queued messages\n  messageQueue.forEach((msg) => socket.emit(\"message\", msg));\n  messageQueue = [];\n});\n\nsocket.on(\"disconnect\", (reason) => {\n  console.warn(\"disconnected:\", reason);\n  if (reason === \"io server disconnect\") socket.connect(); \u002F\u002F manual reconnect\n});\n\nsocket.on(\"connect_error\", (err) => {\n  console.error(\"connection error:\", err.message);\n});\n\nfunction sendMessage(roomId, text) {\n  const msg = { roomId, text };\n  if (socket.connected) {\n    socket.emit(\"message\", msg);\n  } else {\n    messageQueue.push(msg); \u002F\u002F buffer until reconnected\n  }\n}\n```\n\n## Constraints\n\n### MUST DO\n- Use sticky sessions for load balancing (WebSocket connections are stateful — requests must route to the same server instance)\n- Implement heartbeat\u002Fping-pong to detect dead connections (TCP keepalive alone is insufficient)\n- Use rooms\u002Fnamespaces for message scoping rather than filtering in application logic\n- Queue messages during disconnection windows to avoid silent data loss\n- Plan connection limits per instance before scaling horizontally\n\n### MUST NOT DO\n- Store large state in memory without a clustering strategy (use Redis or an external store)\n- Mix WebSocket and HTTP on the same port without explicit upgrade handling\n- Forget to handle connection cleanup (presence records, room membership, in-flight timers)\n- Skip load testing before production — connection-count spikes behave differently from HTTP traffic spikes\n\n## Output Templates\n\nWhen implementing WebSocket features, provide:\n1. Server setup (Socket.IO\u002Fws configuration)\n2. Event handlers (connection, message, disconnect)\n3. Client library (connection, events, reconnection)\n4. Brief explanation of scaling strategy\n\n## Knowledge Reference\n\nSocket.IO, ws, uWebSockets.js, Redis adapter, sticky sessions, nginx WebSocket proxy, JWT over WebSocket, rooms\u002Fnamespaces, acknowledgments, binary data, compression, heartbeat, backpressure, horizontal pod autoscaling\n",{"name":5,"license":15,"metadata":44,"description":7},{"role":45,"scope":46,"author":47,"domain":48,"version":49,"triggers":50,"output-format":38,"related-skills":51},"specialist","implementation","https:\u002F\u002Fgithub.com\u002FJeffallan","api-architecture","1.1.0","WebSocket, Socket.IO, real-time communication, bidirectional messaging, pub\u002Fsub, server push, live updates, chat systems, presence tracking","fastapi-expert, nestjs-expert, devops-engineer, monitoring-expert, security-reviewer","main","c19c0bc0a04d25a849ce749fe88250e688f06437","packages\u002Fcodegraph\u002Fdata\u002Flifecycle-skills\u002Fwebsocket-engineer",1,"https:\u002F\u002Fgithub.com\u002FPIXARTSeu\u002FSynapse","https:\u002F\u002Fgithub.com\u002FPIXARTSeu","https:\u002F\u002Fpixarts.eu\u002F","2026-09-24 06:30:45",{"source":8,"skillName":5,"commands":61,"prompt":71,"zipAvailable":72},[62,65,68],{"tool":63,"command":64},"npx","npx skills add PIXARTSeu\u002FSynapse --skill websocket-engineer",{"tool":66,"command":67},"bunx","bunx skills add PIXARTSeu\u002FSynapse --skill websocket-engineer",{"tool":69,"command":70},"pnpm","pnpm dlx skills add PIXARTSeu\u002FSynapse --skill websocket-engineer","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FPIXARTSeu\u002FSynapse\u002Fblob\u002Fmain\u002Fpackages\u002Fcodegraph\u002Fdata\u002Flifecycle-skills\u002Fwebsocket-engineer\u002FSKILL.md",true,[],[75,100,105,125,149,165],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":39},"01M6X0ECZKGP44NP2JW588B9RG","vercel-react-best-practices","React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React\u002FNext.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.","https:\u002F\u002Fgithub.com\u002FPIXARTSeu\u002FSynapse\u002Fblob\u002Fmain\u002Fskills\u002Fvercel-react-best-practices\u002FSKILL.md",[],[82,83,84,85,86,87,88,89,90,91,92,38,93,94,95,96,97,98,99,22],"react","vercel react best practices","best practices","react best practices","vercel","writing","performance","components","react components","guidelines","tasks","Optimization","data","refactoring","patterns","next","triggers","data fetching",{"skillNo":101,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":39},"01M6X05WCVH879XKZEAQ15PHQX","https:\u002F\u002Fgithub.com\u002FPIXARTSeu\u002FSynapse\u002Fblob\u002Fmain\u002Fpackages\u002Fcodegraph\u002Fdata\u002Fskill\u002Fvercel-react-best-practices\u002FSKILL.md",[],[82,83,84,85,86,87,88,89,90,91,92,38,93,94,95,96,97,98,99,22],{"skillNo":106,"name":107,"nameZh":6,"description":108,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":109,"categories":110,"keywords":111,"publishedAt":39},"01M6WZ286AR2SYE9GZYVW0CNYG","wordpress-pro","Develops custom WordPress themes and plugins, creates and registers Gutenberg blocks and block patterns, configures WooCommerce stores, implements WordPress REST API endpoints, applies security hardening (nonces, sanitization, escaping, capability checks), and optimizes performance through caching and query tuning. Use when building WordPress themes, writing plugins, customizing Gutenberg blocks, extending WooCommerce, working with ACF, using the WordPress REST API, applying hooks and filters, or improving WordPress performance and security.","https:\u002F\u002Fgithub.com\u002FPIXARTSeu\u002FSynapse\u002Fblob\u002Fmain\u002Fpackages\u002Fcodegraph\u002Fdata\u002Flifecycle-skills\u002Fwordpress-pro\u002FSKILL.md",[],[112,113,114,87,115,88,38,116,35,117,34,118,119,32,120,121,122,123,124,22],"wordpress","wordpress pro","pro","security","tuning","laravel","hooks","filters","query","woocommerce","caching","themes","sanitization",{"skillNo":126,"name":127,"nameZh":6,"description":128,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":129,"categories":130,"keywords":131,"publishedAt":39},"01M6WZ1G86ZR73H0WNM6CGNRGF","vue-expert","Builds Vue 3 components with Composition API patterns, configures Nuxt 3 SSR\u002FSSG projects, sets up Pinia stores, scaffolds Quasar\u002FCapacitor mobile apps, implements PWA features, and optimises Vite builds. Use when creating Vue 3 applications with Composition API, writing reusable composables, managing state with Pinia, building hybrid mobile apps with Quasar or Capacitor, configuring service workers, or tuning Vite configuration and TypeScript integration.","https:\u002F\u002Fgithub.com\u002FPIXARTSeu\u002FSynapse\u002Fblob\u002Fmain\u002Fpackages\u002Fcodegraph\u002Fdata\u002Flifecycle-skills\u002Fvue-expert\u002FSKILL.md",[],[132,32,133,134,87,135,89,136,137,138,139,140,141,142,143,144,145,146,147,148],"vue","vue expert","frontend","typescript","config","applications","Composition","projects","pinia","use","router","workers","mobile","reusable","worker","apps","hybrid",{"skillNo":150,"name":151,"nameZh":6,"description":152,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":153,"categories":154,"keywords":155,"publishedAt":39},"01M6WZ1AP3GFCBAMD712X8KRP7","vue-expert-js","Creates Vue 3 components, builds vanilla JS composables, configures Vite projects, and sets up routing and state management using JavaScript only — no TypeScript. Generates JSDoc-typed code with @typedef, @param, and @returns annotations for full type coverage without a TS compiler. Use when building Vue 3 applications with JavaScript only (no TypeScript), when projects require JSDoc-based type hints, when migrating from Vue 2 Options API to Composition API in JS, or when teams prefer vanilla JavaScript, .mjs modules, or need quick prototypes without TypeScript setup.","https:\u002F\u002Fgithub.com\u002FPIXARTSeu\u002FSynapse\u002Fblob\u002Fmain\u002Fpackages\u002Fcodegraph\u002Fdata\u002Flifecycle-skills\u002Fvue-expert-js\u002FSKILL.md",[],[132,156,32,157,133,134,135,89,38,35,138,139,158,159,160,161,162,163,164,22],"js","vue expert js","coverage","only","up","modules","options","jsdoc","quick",{"skillNo":166,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":167,"categories":168,"keywords":169,"publishedAt":39},"01M6WZ127DV7RTQA917MKYB755","https:\u002F\u002Fgithub.com\u002FPIXARTSeu\u002FSynapse\u002Fblob\u002Fmain\u002Fpackages\u002Fcodegraph\u002Fdata\u002Flifecycle-skills\u002Fvercel-react-best-practices\u002FSKILL.md",[],[82,83,84,85,86,87,88,89,90,91,92,38,93,94,95,96,97,98,99,22]]