turn-based-game-mcp
Copilot instructions31 starsChanged 12 months agoMITView on GitHub
These instructions guide Copilot across all files in this monorepo. Language-specific and framework-specific rules are in separate instruction files under .github/instructions/. All games implement Game<TGameState, TMove> interface in shared/src/types/game.ts:
The file
We split this copilot-instructions.md into the rules it gives an agent
8 rules. About 0 are common, 1 is distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 17
Run npm run lint to check for linting issues
- Very specific: line 18
Run npm run test to ensure all tests pass
- Very specific: line 44
All games implement Game<TGameState, TMove> interface in shared/src/types/game.ts:
- Very specific: line 57
Create/list games: web/src/app/api/games/[game-type]/route.ts
- Very specific: line 64
Add API routes in web/src/app/api/games/[new-game]/
- Very specific: line 65
Create AI implementation in mcp-server/src/ai/
- Very specific: line 66
Add MCP tools in mcp-server/src/server.ts
- Distinctive: line 76
Never hardcode credentials or API keys
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Turn-Based Games Platform
Purpose
These instructions guide Copilot across all files in this monorepo. Language-specific and framework-specific rules are in separate instruction files under .github/instructions/.
Repository Structure
shared/- Core game logic, types, and SQLite storage (TypeScript library)web/- Next.js 15 frontend with API routes (React + TailwindCSS)mcp-server/- Model Context Protocol server providing AI opponents (Node.js service)
Code Standards
Required Before Each Commit
- Run
npm run lintto check for linting issues - Run
npm run testto ensure all tests pass - Build shared package first when making cross-package changes
Development Flow
- Build shared:
npm run build --workspace=shared(always run first) - Dev web:
npm run dev --workspace=web(starts Next.js on port 3000) - Dev MCP:
npm run dev --workspace=mcp-server(starts MCP server via stdio) - Full test:
npm run test(runs all workspace tests) - Full lint:
npm run lint(runs all workspace linting)
Database
- SQLite file location:
web/games.db(default) - Controlled by
GAMES_DB_PATHenvironment variable
Architecture Guidelines
Service Boundaries
- MCP server communicates with web app via HTTP calls to
/api/games/*endpoints - MCP server never accesses the database directly
- Web app uses direct SQLite access via
shared/src/storage/sqlite-storage.ts
Game Interface
All games implement Game<TGameState, TMove> interface in shared/src/types/game.ts:
// Required methods for all game implementations
validateMove(state, move) // Check if move is legal
applyMove(state, move) // Apply move and return new state
checkGameEnd(state) // Determine win/draw/continue
getValidMoves(state) // Get available moves
getInitialState(config) // Create starting game stateAPI Routes Pattern
- Create/list games:
web/src/app/api/games/[game-type]/route.ts - Make moves:
web/src/app/api/games/[game-type]/[id]/move/route.ts
Adding New Games
- Define types in
shared/src/types/games.ts - Implement game class in
shared/src/games/ - Add API routes in
web/src/app/api/games/[new-game]/ - Create AI implementation in
mcp-server/src/ai/ - Add MCP tools in
mcp-server/src/server.ts - Build UI components in
web/src/components/games/
Environment Variables
WEB_API_BASE- MCP server's web app URL (default:http://localhost:3000)GAMES_DB_PATH- SQLite database location (default:./games.db)
Security Considerations
- Never hardcode credentials or API keys
- Validate all user inputs in API routes
- Sanitize game IDs and player names before database operations
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

