**Problem:**
- player-ownership.ts imported drizzle-orm and @/db at top level
- When RoomMemoryPairsProvider imported client-safe utilities, Webpack bundled ALL imports including database code
- This caused hydration error: "The 'original' argument must be of type Function"
- Node.js util.promisify was being called in browser context
**Solution:**
1. Created player-ownership.client.ts with ONLY client-safe utilities
- No database imports
- Safe to import from 'use client' components
- Contains: buildPlayerOwnershipFromRoomData(), buildPlayerMetadata(), helper functions
2. Updated player-ownership.ts to re-export client utilities and add server-only functions
- Re-exports everything from .client.ts
- Adds buildPlayerOwnershipMap() (async, database-backed)
- Safe to import from server components/API routes
3. Updated RoomMemoryPairsProvider to import from .client.ts
**Result:**
- No more hydration errors on /arcade/room
- Client bundle doesn't include database code
- Server code can still use both client and server utilities
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Added detailed documentation covering:
## System Overview
- Skill-based problem generation concept
- Core principle: difficulty based on required abacus techniques
- Integration with tutorial progression
## Skill Definitions
- Five complements (5-column operations)
- Ten complements (multi-column carrying)
- Basic operations hierarchy
## Technical Implementation
- TypeScript interfaces and skill sets
- Problem generation algorithm
- Validation process
## Editor Integration
- Practice step creation workflow
- UI components and skill selection
- Problem preview and validation
## Examples
- Configuration examples for different skill levels
- Implementation code samples
- Benefits for learners and educators
This serves as both developer reference and educator guide for
the skill-based practice problem generation system.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>