agentleFS
chrisreddingtonchrisreddington/turn-based-game-mcp/.github/copilot-instructions.md

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
  1. Very specific:

    Run npm run lint to check for linting issues

    line 17
  2. Very specific:

    Run npm run test to ensure all tests pass

    line 18
  3. Very specific:

    All games implement Game<TGameState, TMove> interface in shared/src/types/game.ts:

    line 44
  4. Very specific:

    Create/list games: web/src/app/api/games/[game-type]/route.ts

    line 57
  5. Very specific:

    Add API routes in web/src/app/api/games/[new-game]/

    line 64
  6. Very specific:

    Create AI implementation in mcp-server/src/ai/

    line 65
  7. Very specific:

    Add MCP tools in mcp-server/src/server.ts

    line 66
  8. Distinctive:

    Never hardcode credentials or API keys

    line 76

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

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 lint to check for linting issues
  • Run npm run test to 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_PATH environment 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 state

API 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

  1. Define types in shared/src/types/games.ts
  2. Implement game class in shared/src/games/
  3. Add API routes in web/src/app/api/games/[new-game]/
  4. Create AI implementation in mcp-server/src/ai/
  5. Add MCP tools in mcp-server/src/server.ts
  6. 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

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.