One-click install
npx skills add https://github.com/recca0120/code-quest --skill socket-io-recca0120
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: socket-io
Source: https://github.com/recca0120/code-quest/tree/main/.claude/skills/socket-io
Command: npx skills add https://github.com/recca0120/code-quest --skill socket-io-recca0120

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It solves the confusion and bugs caused by inconsistent Socket.IO event names, namespaces, payload shapes, and handler registration across the server and web client.

Core Features & Use Cases

  • Event naming contract: Uses a consistent type:subtype convention with strict directionality (C→S vs S→C) to avoid mismatches between client and server.
  • Session workflow guidance: Documents the end-to-end lifecycle for session:launch, session:join, session:resume, and the session:states broadcast, including expected payloads and callback behavior.
  • Server handler patterns: Establishes a repeatable apps/server/src/socket/handlers/<domain>-handler.ts registration structure and DI-backed handler context usage.
  • Client handler patterns: Provides a matching approach for apps/web/src/contexts/socket/handlers/<domain>.ts and how action hooks emit events (including callback usage).
  • Validation and type safety: Recommends Zod schema validation at handler entry and typed Socket.IO event definitions via packages/shared/src/socket-events.ts for reliable integration.
  • Testing strategy: Includes a FakeClaude-based flow to validate that client requests trigger the expected server-to-client event sequence.

Quick Start

Use the socket-io skill as your reference when adding or updating a new Socket.IO event so you implement the correct namespace, payload schema validation, and typed client/server handlers consistently.

Frequently Asked Questions about socket-io

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I standardize Socket.IO event naming and payload contracts between client and server?

Standardize Socket.IO event naming by enforcing a strict `type:subtype` convention with clear C→S and S→C directionality. Define typed event signatures and Zod schema validation in a shared package to ensure payload contracts match exactly between the server and web client.

What is the recommended structure for Socket.IO session lifecycle events like launch and resume?

The Socket.IO session lifecycle structure defines specific events for `session:launch`, `session:join`, `session:resume`, and `session:states` broadcasts. Each event requires consistent payload shapes, callback behaviors, and typed handler wiring to manage real-time session flows reliably.

How do I set up Socket.IO handlers with dependency injection and Zod validation?

Set up Socket.IO handlers by creating a repeatable directory structure for domain handlers and using DI-backed context. Apply Zod schema validation at handler entry to verify incoming payloads before processing real-time messaging events on both server and client sides.

Can I use this Socket.IO event contract pattern with existing TypeScript project structures?

Yes, the Socket.IO event contract pattern applies to existing TypeScript project structures by placing shared typed event definitions in a common package and mapping handler files to standard server and web context directories to match your current project patterns.

How do I validate that Socket.IO client requests trigger the correct server-to-client event sequence?

Validate the Socket.IO event sequence by running a targeted testing flow that confirms client requests trigger the expected server-to-client event broadcasts. This ensures the real-time messaging contract and handler wiring function correctly across the session lifecycle.

Why do my Socket.IO real-time events have mismatched payloads and handler errors?

Mismatched Socket.IO payloads and handler errors usually stem from inconsistent event names, untyped signatures, and missing validation. Enforcing a shared typed event contract with Zod schema validation at handler entry resolves these integration bugs across client and server.