--- id: curiositech/some_claude_skills/real-time-collaboration-engine version: "dac13018" license: MIT install: manual updated: 2026-07-14 --- # real-time-collaboration-engine — This skill guides you through building multiplayer editing experiences like Google Docs, handling the full stack from WebSocket transport to conflict resolution strategies. It covers when to use Operational Transform versus CRDTs, how to batch updates efficiently, manage offline queues, and track user presence—plus common pitfalls like broadcasting every keystroke or losing concurrent edits. Publisher: curiositech · Stars: 164 · Updated: 2026-07-14 Install (manual): `git clone https://github.com/curiositech/some_claude_skills` ## SKILL.md # Real-Time Collaboration Engine Expert in building Google Docs-style collaborative editing with WebSockets, conflict resolution, and presence awareness. ## When to Use ✅ **Use for**: - Collaborative text/code editors - Shared whiteboards and design tools - Multi-user video editing timelines - Real-time data dashboards - Multiplayer game state sync ❌ **NOT for**: - Simple chat applications (use basic WebSocket) - Request-response APIs (use REST/GraphQL) - Single-user applications - Read-only data streaming (use Server-Sent Events) ## Quick Decision Tree ``` Need real-time collaboration? ├── Text editing? → Operational Transform (OT) ├── JSON data structures? → CRDTs ├── Cursor tracking only? → Simple WebSocket + presence ├── Offline-first? → CRDTs (better offline merge) └── No conflicts possible? → Basic broadcast ``` --- ## Technology Selection ### Conflict Resolution Strategies (2024) | Strategy | Best For | Complexity | Offline Support | |----------|----------|------------|-----------------| | Operational Transform (OT) | Text, ordered sequences | High | Limited | | CRDTs | JSON objects, sets | Medium | Excellent | | Last-Write-Wins | Simple state | Low | Basic | | Three-Way Merge | Git-style editing | High | Good | **Timeline**: - 2010: Google Wave uses OT - 2014: Figma adopts CRDTs - 2019: Yjs (CRDT library) released - 2022: Automerge 2.0 (CRDT library) released - 2024: PartyKit simplifies real-time infrastructure --- ## Common Anti-Patterns ### Anti-Pattern 1: Broadcasting Every Keystroke **Novice thinking**: "Send every change immediately for real-time feel" **Problem**: Network floods with tiny messages, poor performance. **Wrong approach**: ```typescript // ❌ Sends message on every keystroke function Editor() { const handleChange = (text: string) => { socket.emit('text-change', { text }); // Every keystroke! }; return