← Back to list

stockfish-integration
by Grips001
Chess trainer game against an AI opponent.
⭐ 0🍴 0📅 Jan 8, 2026
SKILL.md
name: stockfish-integration description: Verify Stockfish WASM integration patterns. Use when working with engine code, UCI commands, or move analysis to ensure correct async patterns and error handling. allowed-tools: Read, Grep, Glob
Stockfish WASM Integration Patterns
Automatically verify correct usage of the Stockfish WASM engine integration.
When to Apply
- Working with files in
src/engine/ - Implementing move analysis features
- Debugging engine communication issues
- Adding new UCI commands
Architecture Overview
Frontend Request → WebSocket IPC → Backend Handler → Stockfish Engine
↓
Frontend Display ← WebSocket IPC ← Backend Response ← UCI Output
Key Files
| File | Purpose |
|---|---|
src/engine/stockfish-engine.ts | Main engine wrapper |
src/engine/stockfish-loader.ts | WASM loading |
src/shared/engine-types.ts | Type definitions |
src/shared/engine-constants.ts | Engine configuration |
src/backend/analysis-pipeline.ts | Batch analysis integration |
Correct Patterns
Engine Initialization
// Always check engine ready state before use
if (!engine.isReady()) {
await engine.initialize();
}
UCI Command Pattern
// Set position before analysis
engine.setPosition(fen);
// Use appropriate depth/time limits
const analysis = await engine.analyze({
depth: 20,
multiPV: 3,
});
Error Handling
try {
const result = await engine.getBestMove(fen);
} catch (error) {
if (error instanceof EngineNotReadyError) {
// Reinitialize engine
} else if (error instanceof InvalidFENError) {
// User feedback for invalid position
}
}
Async Patterns
// Always await engine operations
const moves = await engine.getTopMoves(fen, 3);
// Use Promise.all for independent operations
const [eval1, eval2] = await Promise.all([
engine.evaluate(fen1),
engine.evaluate(fen2),
]);
Anti-Patterns to Avoid
// DON'T: Fire and forget
engine.analyze(fen); // Missing await
// DON'T: Assume engine is ready
engine.getBestMove(fen); // Should check isReady()
// DON'T: Block on synchronous operations
while (!engine.isReady()) {} // Use async/await
Verification Checklist
- All engine calls are awaited
- Engine ready state checked before use
- Proper error types used (not generic Error)
- UCI commands follow correct sequence
- Analysis results validated before use
Reference
documents/engine-integration.md- Full integration guide- Stockfish UCI protocol documentation
Score
Total Score
60/100
Based on repository quality metrics
✓SKILL.md
SKILL.mdファイルが含まれている
+20
✓LICENSE
ライセンスが設定されている
+10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
✓言語
プログラミング言語が設定されている
+5
○タグ
1つ以上のタグが設定されている
0/5
Reviews
💬
Reviews coming soon