starwards-debugging
БесплатноБез исполняемых скриптовНе проверенSystematic debugging for Starwards - four-phase framework (root cause investigation, pattern analysis, hypothesis testing, implementation) with Colyseus state…
от starwards★ 44 звезды на GitHubОб этом скилле
Systematic Debugging for Starwards
Overview
Random fixes waste time. Quick patches mask underlying issues.
Core principle: ALWAYS find root cause before attempting fixes.
Starwards-specific: Debug state sync issues, decorator problems, UI/server mismatches, and multiplayer race conditions.
The Iron Law
NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST
If you haven't completed Phase 1, you cannot propose fixes.
When to Use
Any technical issue:
- Test failures (Jest, Playwright)
- State sync problems (Colyseus)
- UI not updating (Tweakpane, React)
- Build failures (webpack, tsup, tsc)
- Decorator issues (@gameField, @range, @tweakable)
- Multiplayer race conditions
The Four Phases
Phase 1: Root Cause Investigation
1. Read Error Messages Carefully
TypeScript errors:
npm run test:types
# Read FULL error including file:line
# Check @gameField decorator order (must be last)
# Verify @range types match property type
Jest test failures:
npm test
# Read expected vs actual values
# Check if float precision issue (use toBeCloseTo)
# Verify async operations completed (await harness.waitForSync())
# App logs (logInfo/logWarn/logError) are silenced under Jest by default.
# Surface them for the run when tracing a failure:
DEBUG=starwards:* npm test # all namespaces
DEBUG=starwards:space-manager:* npm test # one subsystem
Playwright failures:
npm run test:e2e
# Check screenshot diffs in test-results/
# Verify data-id selectors match actual panel titles
# Check if timing issue (add proper waits, not arbitrary timeouts)
Webpack errors:
cd modules/browser && npm start
# Check browser console (F12) for actual error
# Webpack overlay shows [object Object] - this is a known issue
# Look for import/export mismatches
2. Reproduce Consistently
For state sync issues:
// Add logging to both client and server
console.log('[CLIENT] Shield strength:', state.shield.strength);
console.log('[SERVER] Shield strength:', manager.state.shield.strength);
// Verify both show same value
// If different → state sync problem
// If same → UI rendering problem
For multiplayer bugs:
- Test with 1 client (works?)
- Test with 2 clients (breaks?)
- Test with concurrent actions (race condition?)
3. Check Recent Changes
git diff HEAD~1 # Last commit
git log --oneline -5 # Recent commits
git diff --stat origin/master # All changes on branch
Common culprits:
- @gameField decorator added/removed → rebuild core
- Schema change → restart server
- Widget change → clear browser cache
- Package update → npm ci && npm run build
4. Gather Evidence in Multi-Component Systems
Starwards has 4 layers: Browser → WebSocket → Server → State
Add diagnostic logging at each boundary:
// Layer 1: Browser widget
console.log('[WIDGET] Sending command:', value);
room.send({type: '/Spaceship/ship-0/shield/power', value});
// Layer 2: Network (Chrome DevTools → Network → WS)
// Verify WebSocket message sent
// Layer 3: Server room
this.onMessage((client, message) => {
console.log('[SERVER] Received:', message);
});
// Layer 4: State manager
console.log('[MANAGER] Shield power updated:', this.state.shield.power);
Run once to see WHERE it breaks:
- Widget logs but no WS message → room.send() issue
- WS message sent but server doesn't log → onMessage() not registered
- Server logs but state doesn't change → command handler bug
5. Trace Data Flow
Example: Shield strength not updating
Trace backward:
UI shows 500 ← Where does UI get value?
↓
pane.addBinding(shield, 'strength') ← What is shield?
↓
shield = ship.state.shield ← Does ship.state exist?
↓
ship.state from ShipDriver ← Is driver connected?
↓
driver.state from Colyseus room.state ← Is state synced?
Find the layer where data stops flowing correctly.
Phase 2: Pattern Analysis
1. Find Working Examples
For ship systems:
# Look at existing systems
modules/core/src/ship/reactor.ts # Has @gameField
modules/core/src/ship/armor.ts # Has @range
modules/core/src/ship/warp.ts # Has commands
For widgets:
# Look at working widgets
modules/browser/src/widgets/armor.ts # Tweakpane panel
modules/browser/src/widgets/targeting.ts # Command sending
For tests:
# Look at test patterns
modules/core/test/ship-test-harness.ts # Multiplayer testing
modules/e2e/test/pilot-screen.spec.ts # E2E testing
2. Compare Against References
Read docs COMPLETELY:
docs/PATTERNS.md- Common patterns and gotchasdocs/TECHNICAL_REFERENCE.md- @gameField, JSON Pointer, decoratorsdocs/testing/UTILITIES.md- Test harness usage
3. Identify Differences
Use diff tools:
# Compare your new system to existing one
diff modules/core/src/ship/shield.ts modules/core/src/ship/armor.ts
Установить starwards-debugging в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл starwards-debugging?
Systematic debugging for Starwards - four-phase framework (root cause investigation, pattern analysis, hypothesis testing, implementation) with Colyseus state inspection, Tweakpane debugging, multiplayer sync issues, and monorepo-specific troubleshooting
Как установить скилл starwards-debugging?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл starwards-debugging запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic