angular-architect
Generates Angular 17+ standalone components, configures advanced routing with lazy loading and guards, implements NgRx state…
Use when building real-time communication systems with WebSockets or Socket.IO. Invoke for bidirectional messaging, horizontal scaling with Redis, presence tracking, room management.
Claude Code
$ npx -y skills add Jeffallan/claude-skills --skill websocket-engineer --agent claude-code
Codex
$ npx skills add Jeffallan/claude-skills --skill websocket-engineer -a codex -y
Cursor
$ npx skills add Jeffallan/claude-skills --skill websocket-engineer -a cursor -y
Gemini CLI
$ npx skills add Jeffallan/claude-skills --skill websocket-engineer -a gemini-cli -y
GitHub Copilot
$ npx skills add Jeffallan/claude-skills --skill websocket-engineer -a github-copilot -y
OpenCode
$ npx skills add Jeffallan/claude-skills --skill websocket-engineer -a opencode -y
Windsurf
$ npx skills add Jeffallan/claude-skills --skill websocket-engineer -a windsurf -y
name: websocket-engineer description: Use when building real-time communication systems with WebSockets or Socket.IO. Invoke for bidirectional messaging, horizontal scaling with Redis, presence tracking, room management. license: MIT metadata: author: https://github.com/Jeffallan company: https://synergetic.solutions version: "1.1.1" domain: api-architecture triggers: WebSocket, Socket.IO, real-time communication, bidirectional messaging, pub/sub, server push, live updates, chat systems, presence tracking role: specialist scope: implementation output-format: code related-skills: fastapi-expert, nestjs-expert, devops-engineer, monitoring-expert, security-reviewer
1. **Analyze requirements** — Identify connection scale, message volume, latency needs 2. **Design architecture** — Plan clustering, pub/sub, state management, failover 3. **Implement** — Build WebSocket server with authentication, rooms, events 4. **Validate locally** — Test connection handling, auth, and room behavior before scaling (e.g., `npx wscat -c ws://localhost:3000`); confirm auth rejection on missing/invalid tokens, room join/leave events, and message delivery 5. **Scale** — Verify Redis connection and pub/sub round-trip before enabling the adapter; configure sticky sessions and confirm with test connections across multiple instances; set up load balancing 6. **Monitor** — Track connections, latency, throughput, error rates; add alerts for connection-count spikes and error-rate thresholds
Load detailed guidance based on context:
| Topic | Reference | Load When | |-------|-----------|-----------| | Protocol | `references/protocol.md` | WebSocket handshake, frames, ping/pong, close codes | | Scaling | `references/scaling.md` | Horizontal scaling, Redis pub/sub, sticky sessions | | Patterns | `references/patterns.md` | Rooms, namespaces, broadcasting, acknowledgments | | Security | `references/security.md` | Authentication, authorization, rate limiting, CORS | | Alternatives | `references/alternatives.md` | SSE, long polling, when to choose WebSockets |
import { createServer } from "http";
import { Server } from "socket.io";
import { createAdapter } from "@socket.io/redis-adapter";
import { createClient } from "redis";
import jwt from "jsonwebtoken";
const httpServer = createServer();
const io = new Server(httpServer, {
cors: { origin: process.env.ALLOWED_ORIGIN, credentials: true },
pingTimeout: 20000,
pingInterval: 25000,
});
// Authentication middleware — runs before connection is established
io.use((socket, next) => {
const token = socket.handshake.auth.token;
if (!token) return next(new Error("Authentication required"));
try {
socket.data.user = jwt.verify(token, process.env.JWT_SECRET);
next();
} catch {
next(new Error("Invalid token"));
}
});
// Redis adapter for horizontal scaling
const pubClient = createClient({ url: process.env.REDIS_URL });
const subClient = pubClient.duplicate();
await Promise.all([pubClient.connect(), subClient.connect()]);
io.adapter(createAdapter(pubClient, subClient));
io.on("connection", (socket) => {
const { userId } = socket.data.user;
console.log(`connected: ${userId} (${socket.id})`);
// Presence: mark user online
pubClient.hSet("presence", userId, socket.id);
socket.on("join-room", (roomId) => {
socket.join(roomId);
socket.to(roomId).emit("user-joined", { userId });
});
socket.on("message", ({ roomId, text }) => {
io.to(roomId).emit("message", { userId, text, ts: Date.now() });
});
socket.on("disconnect", () => {
pubClient.hDel("presence", userId);
console.log(`disconnected: ${userId}`);
});
});
httpServer.listen(3000);import { io } from "socket.io-client";
const socket = io("wss://api.example.com", {
auth: { token: getAuthToken() },
reconnection: true,
reconnectionAttempts: 10,
reconnectionDelay: 1000, // initial delay (ms)
reconnectionDelayMax: 30000, // cap at 30 s
randomizationFactor: 0.5, // jitter to avoid thundering herd
});
// Queue messages while disconnected
let messageQueue = [];
socket.on("connect", () => {
console.log("connected:", socket.id);
// Flush queued messages
messageQueue.forEach((msg) => socket.emit("message", msg));
messageQueue = [];
});
socket.on("disconnect", (reason) => {
console.warn("disconnected:", reason);
if (reason === "io server disconnect") socket.connect(); // manual reconnect
});
socket.on("connect_error", (err) => {
console.error("connection error:", err.message);
});
function sendMessage(roomId, text) {
const msg = { roomId, text };
if (socket.connected) {
socket.emit("message", msg);
} else {
messageQueue.push(msg); // buffer until reconnected
}
}When implementing WebSocket features, provide: 1. Server setup (Socket.IO/ws configuration) 2. Event handlers (connection, message, disconnect) 3. Client
67 Specialized Skills for Full-Stack Developers. Transform Claude Code into your expert pair programmer.
Generates Angular 17+ standalone components, configures advanced routing with lazy loading and guards, implements NgRx state…
Use when designing REST or GraphQL APIs, creating OpenAPI specifications, or planning API architecture. Invoke for resource…
Use when designing new high-level system architecture, reviewing existing designs, or making architectural decisions. Invoke to…
Integrates with Atlassian products to manage project tracking and documentation via MCP protocol. Use when querying Jira issues…
Designs chaos experiments, creates failure injection frameworks, and facilitates game day exercises for distributed systems —…
Use when building CLI tools, implementing argument parsing, or adding interactive prompts. Invoke for parsing flags and…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.