# CLAUDE.md - Class Generator 2.0 ## πŸ“‹ Overview Educational platform with ultra-modular vanilla JS/HTML/CSS architecture. Strict separation, sealed modules, dependency injection. ## πŸ—οΈ Status **Core βœ…**: Module.js, EventBus.js, ModuleLoader.js, Router.js, Application.js, Dev Server **DRS βœ…**: ContentLoader, IAEngine (OpenAIβ†’DeepSeek), LLMValidator, AI Reports, UnifiedDRS **Exercises βœ…**: VocabularyModule, TextAnalysis, GrammarAnalysis, Translation, OpenResponse **AI βœ…**: Production ready, strict scoring (wrong: 0-20, correct: 70-100), no mock fallbacks ## ⚠️ Critical Rules ### Architecture (NON-NEGOTIABLE) 1. **Single responsibility** per module 2. **EventBus only** for communication (no direct deps) 3. **Object.seal()** prevents modification 4. **WeakMap** for private state 5. **Abstract enforcement** - missing methods = fatal error 6. **Dependency injection** - no globals ### DRS vs Games - NEVER MIX - **DRS** (`src/DRS/`) = Educational exercises with strict interfaces - **Games** (`src/games/`) = Entertainment, different architecture - ❌ NEVER `import FlashcardLearning from '../games/'` in DRS - βœ… ALWAYS `import VocabularyModule from './exercise-modules/'` in DRS ### Technical Constraints - Vanilla JS/HTML/CSS only (no frameworks) - ES6 modules, HTTP protocol (never file://) - **NO SCROLL** - all UI fits viewport height - Mobile-first, compact headers, vertical space precious ### Development DO's/DON'Ts βœ… Extend Module base, use EventBus, validate deps, seal objects, simple solutions first ❌ Never access internals, globals, skip validation, hardcode paths, overcomplicate positioning ## πŸš€ Quick Start ```bash start.bat # or: node server.js # http://localhost:3000 ``` ## πŸ“ Structure ``` src/ β”œβ”€β”€ core/ # Module, EventBus, ModuleLoader, Router, Application β”œβ”€β”€ DRS/ # Exercise modules, services, interfaces β”œβ”€β”€ games/ # Independent game modules (NOT DRS) β”œβ”€β”€ styles/ # base.css, components.css └── Application.js # Bootstrap ``` ## πŸ“š Documentation **Core Guides:** - `docs/architecture.md` - Architecture principles and patterns - `docs/creating-new-module.md` - How to create new modules (Game, DRS, Progress) - `docs/interfaces.md` - Interface system (C++ style contracts) - `docs/progress-system.md` - Progress tracking and prerequisites ## πŸ” Debug ```javascript // F12 toggles debug panel window.app.getStatus() window.app.getCore().eventBus.getEventHistory() window.app.getCore().router.navigate('/games') ``` ## πŸ—„οΈ AI Cache Cache currently disabled for testing. See `IAEngine.js` lines 165-170. **Why**: 100-char cache key too short. **Fix**: Improve to 200+ chars with language/exerciseType/contentHash. ## 🎯 Success Metrics - **<100ms** module loading - **<50ms** event propagation - **<200ms** startup - **Zero** memory leaks - **Zero** direct coupling ## 🚧 Next Phase 1. Component-based UI system 2. Example game module 3. Content system integration 4. Testing framework --- **High-quality, maintainable educational software that scales.**