Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/cass-2003/local-workflow-skill/websocket-implnpx skills add cass-2003/local-workflow-skill --skill websocket-implgit clone --depth 1 https://github.com/cass-2003/local-workflow-skillWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00186 | $0.04021 |
| Opus 5 | $0.00093 | $0.02011 |
| Sonnet 5 | $0.00037 | $0.00804 |
| Haiku 4.5 | $0.00019 | $0.00402 |
Grade A, and why
websocket-impl scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 446 lines — stays where its author put it; the contents beside it link to each section on GitHub.
WebSocket Implementation Skill — WS 实战
何时使用
- 实现实时双向通信(聊天 / 协作 / 推送 / 在线游戏)
- 排查"客户端莫名断线"/ 重连风暴
- 设计多实例部署的消息广播
- WebSocket vs SSE vs Long Polling 选型
- 评估 Socket.IO / 原生 ws / uWebSockets
一、何时选 WS 何时不选
| 需求 | 推荐 |
|---|---|
| 服务端 → 客户端单向推送 | SSE(更简单、自动重连、HTTP/2 多路复用) |
| 双向 / 低延迟 | WebSocket |
| 客户端 → 服务端低频提交 | HTTP POST(普通 API) |
| 实时性 < 1s 即可 | Long polling / SSE |
| 多设备同步 | WebSocket / 推送服务(FCM / APNs) |
| 文件 / 大数据流 | HTTP/2 streaming 或 WebTransport |
WS 是"双向 + 低延迟"的工具,不是默认选项。
二、协议基础
握手(HTTP Upgrade)
GET /ws HTTP/1.1
Host: example.com
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
Sec-WebSocket-Version: 13
Sec-WebSocket-Protocol: chat.v1
Sec-WebSocket-Extensions: permessage-deflate
HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=
Sec-WebSocket-Protocol: chat.v1
Frame 结构
OPCODE 类型:
0x0 continuation (分片)
0x1 text (UTF-8 字符串)
0x2 binary (任意字节)
0x8 close
0x9 ping
0xA pong
0xB-0xF reserved
最大消息体:协议无硬限,实现限(多数 16-64 MB)。
三、Node.js (ws 库) 服务端
import { WebSocketServer } from 'ws'
import http from 'node:http'
const server = http.createServer()
const wss = new WebSocketServer({ noServer: true })
server.on('upgrade', (req, socket, head) => {
// 自家鉴权(cookie / token)
if (!authenticate(req)) {
socket.write('HTTP/1.1 401 Unauthorized\r\n\r\n')
socket.destroy()
return
}
wss.handleUpgrade(req, socket, head, (ws) => {
wss.emit('connection', ws, req)
})
})
wss.on('connection', (ws, req) => {
ws.userId = extractUserId(req)
ws.isAlive = true
ws.on('pong', () => { ws.isAlive = true })
ws.on('message', (data, isBinary) => {
const msg = isBinary ? data : data.toString()
handleMessage(ws, msg)
})
ws.on('close', (code, reason) => {
cleanup(ws)
})
})
// 心跳:每 30s 发 ping,对方未 pong 则断开
setInterval(() => {
for (const ws of wss.clients) {
if (!ws.isAlive) { ws.terminate(); continue }
ws.isAlive = false
ws.ping()
}
}, 30_000).unref()
server.listen(8080)
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2d ago First seen · 446 lines · 186 tokens per session scan A b2fb179e8cce
websocket-impl is a skill published in the GitHub repository cass-2003/local-workflow-skill (12 stars, last pushed 1mo ago), licensed MIT. It adds 186 tokens to every session and 4,021 once invoked, about $0.0009 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
systematic-debugging
Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.
chat-pet-sprite-creation
Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.
cpu-profile-analysis
Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…
babysit-pr
Babysit a GitHub pull request after creation by continuously polling review comments, CI checks/workflow runs, and mergeability state until the PR is merged/closed or user help is required. Diagnose failures, retry likely flaky failures up to 3 times, auto-fix/push branch-related issues when appropriate, and keep…
imagegen
Generate or edit raster images when the task benefits from AI-created bitmap visuals such as photos, illustrations, textures, sprites, mockups, or transparent-background cutouts. Use when Codex should create a brand-new image, transform an existing image, or derive visual variants from references, and the output…