.claude/skills/add-websocket-event/SKILL.md
Add a real-time WebSocket event with server emit, client hook, and org-scoped rooms. Use when adding live updates like new leads, deal changes, or chat messages.
npx skillsauth add malhajri07/real-estate-CRM-project add-websocket-eventInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Adds a new real-time event to the socket.io infrastructure. Creates the server-side emit, client-side listener hook, and ensures proper org/user room scoping.
lead:new, deal:stage-changed, message:new{ leadId, name, score })user (single user), org (all org members), room (specific deal/conversation)Check socket infrastructure exists. Read apps/api/socket.ts. If missing, create:
socket.io server attached to Express HTTP serveruser:{userId} and org:{orgId} rooms on connectDefine the event type in packages/shared/src/socket-events.ts:
export interface ServerToClientEvents {
"lead:new": (payload: { leadId: string; name: string; score: number }) => void;
}
Emit from the API route. In the mutation handler (e.g., POST /api/leads):
io.to(`org:${orgId}`).emit("lead:new", { leadId: lead.id, name, score });
Create client hook at apps/web/src/hooks/useSocketEvent.ts:
export function useSocketEvent<T>(event: string, handler: (data: T) => void) { ... }
Consume in the component:
useSocketEvent("lead:new", (data) => {
queryClient.invalidateQueries({ queryKey: ["/api/leads"] });
toast({ title: `عميل جديد: ${data.name}` });
});
Run /typecheck to verify shared types compile.
/typecheck passestesting
Create and edit Obsidian Flavored Markdown with wikilinks, embeds, callouts, properties, and other Obsidian-specific syntax. Use when working with .md files in Obsidian, or when the user mentions wikilinks, callouts, frontmatter, tags, embeds, or Obsidian notes.
tools
Interact with Obsidian vaults using the Obsidian CLI to read, create, search, and manage notes, tasks, properties, and more. Also supports plugin and theme development with commands to reload plugins, run JavaScript, capture errors, take screenshots, and inspect the DOM. Use when the user asks to interact with their Obsidian vault, manage notes, search vault content, perform vault operations from the command line, or develop and debug Obsidian plugins and themes.
data-ai
Create and edit Obsidian Bases (.base files) with views, filters, formulas, and summaries. Use when working with .base files, creating database-like views of notes, or when the user mentions Bases, table views, card views, filters, or formulas in Obsidian.
tools
Create and edit JSON Canvas files (.canvas) with nodes, edges, groups, and connections. Use when working with .canvas files, creating visual canvases, mind maps, flowcharts, or when the user mentions Canvas files in Obsidian.