Your agent builds you an interactive page of your own: a game to step through, a drill of your mistakes, an opening line to practise or a worksheet to print.
edgecaseai/ chessdrive-plugin On a phone or the Free plan? Add just the Connector
https:/ / api.chessdrive.io/ mcp Paste this one line into Claude Code, Codex or Cursor. It sets everything up, gives you one link to sign in with, and starts your first review.
Set up ChessDrive for me: fetch and follow https://chessdrive.io/setup.md, which installs its CLI with `npm install -g chessdrive`.
# Set up ChessDrive
> Official instructions from ChessDrive for setting it up in a coding agent: the `chessdrive` CLI, the ChessDrive Skills and the ChessDrive Connector. They are published at https://chessdrive.io/setup.md, so you can check where they come from before you follow them.
Your person asked you to set ChessDrive up. ChessDrive gives you Skills for chess: game reviews, the mistakes they keep making, opponent prep and more, every move checked by an engine. Do every step yourself by running its commands, except the ones marked **Your person's step**: a browser sign-in or a restart happens outside your session, so ask them and wait. Never run a command that waits at a prompt. Every command here is safe to run again on a machine that is already set up.
**In Claude's or ChatGPT's chat app, not a coding agent?** No terminal is needed: follow https://chessdrive.io/cookbook/add-to-your-ai.md instead.
## 1. Install the CLI
```
npm install -g chessdrive
```
Without npm, run `curl -fsSL https://chessdrive.io/install.sh | sh` instead, or follow https://chessdrive.io/docs/cli on Windows. Either one also updates a CLI that is already there.
Check: `chessdrive version` prints a version.
## 2. Sign the CLI in
If `chessdrive balance` already prints a Plan and a Balance, the CLI is signed in: go on to step 3. Otherwise run `chessdrive login --no-wait`. It prints a link and a code, and returns.
> **Your person's step.** Give them the link and the code, and ask them to open the link, check the code, pick their Account and choose Allow. Wait for them to say they have.
Then run `chessdrive login`, which finishes at once. That's their only sign-in: the Connector uses the key the CLI saved. Never print that key, or write it anywhere a step doesn't say.
Check: `chessdrive balance` prints their Plan and Balance. If the Balance isn't what they expect, they allowed another Account: run `chessdrive logout`, then this step again, and ask them to pick the right Account.
## 3. Add the Skills and the Connector
Use your agent's section.
### Claude Code
Install the Plugin, which brings the Skills and the Connector. The Connector uses the key the CLI saved, so there is no second sign-in.
```
claude plugin marketplace add edgecaseai/chessdrive-plugin
claude plugin install chessdrive@chessdrive
```
Check: `claude plugin list | grep -A2 'chessdrive@chessdrive'` shows it enabled. If it's listed but disabled, run `claude plugin enable chessdrive@chessdrive`.
> **Your person's step.** Ask them to run `/reload-plugins` in Claude Code, or restart it, to load the Plugin. Wait for them to say they have.
### Codex
Download https://chessdrive.io/plugin/chessdrive.zip, unzip it and copy every folder in its `skills` folder, with all its files, to the folder where Codex reads your person's own Skills, so they work in every project. Copying again replaces them with the latest.
Then the Connector: in `~/.codex/config.toml`, a `[mcp_servers.chessdrive]` table with `url = "https://api.chessdrive.io/mcp"` and `http_headers_helper = "<the full path of chessdrive> key --headers"`. If the table is already there, leave it.
Check: `codex mcp list` lists chessdrive.
> **Your person's step.** Ask them to restart Codex. In Codex Desktop, quit it fully and open it again.
### Cursor
Download https://chessdrive.io/plugin/chessdrive.zip, unzip it and copy every folder in its `skills` folder, with all its files, to the folder where Cursor reads your person's own Skills, so they work in every project. Copying again replaces them with the latest.
Then the Connector: in `~/.cursor/mcp.json`, a server named chessdrive with `"url": "https://api.chessdrive.io/mcp"` and `"headers": { "Authorization": "Bearer ${env:CHESSDRIVE_CONNECTOR_KEY}" }`. Merge it into the file, and keep the other servers. Then add `export CHESSDRIVE_CONNECTOR_KEY="$(chessdrive key 2>/dev/null)"` to their shell's startup file, once. On Windows, leave out the headers and the export: Cursor signs in through their browser.
Check: `~/.cursor/mcp.json` has the chessdrive server.
> **Your person's step.** Ask them to restart Cursor.
### Any other agent
Download https://chessdrive.io/plugin/chessdrive.zip, unzip it and copy every folder in its `skills` folder, with all its files, to the folder where you read your person's own Skills, so they work in every project. Copying again replaces them with the latest.
Then add a remote MCP server named chessdrive at https://api.chessdrive.io/mcp, sending `Authorization: Bearer` and the key `chessdrive key` prints. Merge it into your MCP settings, and keep the other servers. Restart if your agent needs it.
## 4. Report the result
Report only what you checked. Don't mark a line done that you couldn't confirm.
```
┌─ ChessDrive set-up ────────────────────────────┐
│ ✓ CLI signed in: Free plan, $10.00 │
│ ✓ Skills Game review, Patterns, Prep, … │
│ ⚠ Connector restart your agent to load it │
└────────────────────────────────────────────────┘
```
Use ✓ for checked, ⚠ for waiting on your person, and ✗ for failed. After the banner, give the next action for every line that isn't ✓.
## 5. Get them started
Ask for their Lichess or chess.com username. If you can use the ChessDrive Skills now, offer to review their last game, and on their yes do it with the Game review Skill. Otherwise, once they've restarted you, they can send one of these:
- "Review my last game. I’m <username> on Lichess."
- "Find the mistakes I keep making. I’m <username> on chess.com."
- "Prep me for my game against <opponent> on Lichess."
## No person present
In CI or an agent SDK run, nobody can do the person's steps. Read the key from `CHESSDRIVE_API_KEY`: if it isn't set, stop and say so. Save it for the CLI with `printenv CHESSDRIVE_API_KEY | chessdrive login`, and never ask for it, print it or write it to a file. Then do step 3 and skip the restarts: your agent loads the Skills and the Connector the next time it starts.
## If something fails
- **No npm, or npm can't install globally:** use the installer in step 1. It needs neither npm nor sudo.
- **Your agent's safety check refuses an install:** don't work around it. Ask your person to run that command themselves; in Claude Code, `!` before a command runs it in the session.
- **`No ChessDrive API at …`:** the CLI is pointed at the wrong address. Check `--base-url` and `CHESSDRIVE_BASE_URL`.
- **The link or the code has expired:** run step 2 again for a new one.
- **Don't open https://api.chessdrive.io/mcp in a browser:** it's for agents, not a web page. Every sign-in starts from the CLI.
- **The Skills or the Connector's tools are missing:** your person restarts the agent. Then ask them to try "Which ChessDrive Skills do you have?".The Connector’s address is the same in every agent. The MCP docs
Check it worked: ask What’s my ChessDrive balance?
Runs cost about $0.14 from your Balance · Free’s $10 covers about 70 runs(estimate)A game review; a game with many mistakes costs up to about 30 cents. An opening drill, or a worksheet with your own answers, makes no calls.
---
name: chessdrive-study
description: Build someone a Study with ChessDrive, an interactive chess page of their own on the ChessDrive Board. Use when someone says "turn this game into a page I can step through", "make me a drill of my mistakes", "make a worksheet from these positions for my students" or "build me a trainer for my opening lines", or asks for any chess app, viewer, board, trainer, quiz or printable sheet, even if they don't name ChessDrive. In Claude it's an artifact, in a coding agent a local HTML file, whose engine and questions run on a Study key. Calls ChessDrive's engine and chess models only as the Study needs, with the ChessDrive Connector in a chat app, Claude's or ChatGPT, and through the `chessdrive` CLI in a coding agent.
---
# Build a Study
You build a **Study**: one page for one person, around their game, their lines or their students. It shows the **Board**, ChessDrive's free chess board, which owns the rules, the position and the person's moves, so your page code only feeds it and listens to it. Paid answers come from `engine` and `generate`, which you call yourself while you build: with the ChessDrive Connector's tools in a chat app, Claude's or ChatGPT, even where it runs code, and anywhere you can't run code, and with the `chessdrive` CLI in a coding agent. Read `<this Skill's folder>/../chessdrive-vectors/references/calls.md` before your first call: it has who judges what, how to make calls at once and what to do when one is refused. `<this Skill's folder>` is the folder this file is in, which your app gave you, so don't search for it. If what you need isn't there, read `<this Skill's folder>/../chessdrive-vectors/references/set-up.md` and walk the person through it one step at a time. Give no chess reading of your own in the meantime, and go on when it's there. The answers you gather go into the page at build time. The page answers about a position the person plays or steps to, only when they ask: the engine's Line from Stockfish in their browser, free, and a question to Generate with a **Study key** made for that page ([live.md](references/live.md)).
Every move on the page is **sourced**: from a PGN or FEN the person gave, from `engine`, or played by the person on the Board. Every verdict ("a mistake", "the best move") comes from `engine`, in its words, and every explanation from a chess model, as `calls.md` says. Never work out a move yourself.
## Step 1: Pick the kind
Build without asking whether they want a page. Match the request to one kind, then read [frame.md](references/frame.md), [board.md](references/board.md), [live.md](references/live.md) and the kind's reference before anything else:
| They want | Kind | Reference | Calls |
|---|---|---|---|
| to go through a game and see where it turned | Game review | [review.md](references/review.md) | `engine` 1, `generate` 1 a marked move |
| to practise the moments they went wrong | Mistake drill | [mistake-drill.md](references/mistake-drill.md) | `engine` 1 a game and 1 a position, `generate` 0 or 1 |
| to learn or test a line of their repertoire | Opening drill | [opening-drill.md](references/opening-drill.md) | None |
| sheets of positions to print or hand out | Worksheet | [worksheet.md](references/worksheet.md) | None with the coach's answers, else `engine` 1 a position |
| to prepare against an opponent, from a PGN file of their games | Opponent prep | [opponent-prep.md](references/opponent-prep.md) | `engine` 1, `generate` 0 or 1 |
- **One position or one game to look at or play** needs no page where your app draws boards: in Claude's chat or desktop app or ChatGPT, where the Connector has `show_board`, call it and stop. A coding agent builds the page. It takes the Board's State. Add `opponent: {"engine": "stockfish", "level": 5}` to play the person with the engine.
- **Something else,** such as a table of their games: build it from the closest kind and keep every rule here.
- **Preparing against an opponent with no file of their games:** run the `chessdrive-prep` Skill first, and build nothing from memory of their games.
Ask one question only when the request lacks the one input the kind needs: which game, which side, which lines. If they ask what this does, or give no position, game or lines to work from, say in a line or two what you need, such as a PGN, a Lichess or chess.com link, or their opening lines, and build nothing. Take the person's word for the side they played, whatever the PGN's names say.
## Step 2: Gather
Make the calls the kind's reference lists, and no more. **When another ChessDrive Skill has just gathered these answers, use them and make no new calls.**
- `generate` takes `model`, `system`, `messages` and `position`. Put everything it may talk about in the message: the moves, the evaluations and the engine's Lines. Make the calls at once with `ask.py`, Queen for what the person reads as prose and Knight for bulk, as `calls.md` says, and write the page while they run.
- A long game's `engine` answer can be too big for your app to show you at once. If it saves the answer to a file, read `moves` from there; don't call `engine` again.
- When a tool says the Balance is empty, pass on its message and its link to Pricing, and stop.
- Keep the `cost_usd` of every answer, in case they ask what the page cost.
## Step 3: Build the page
One self-contained HTML file in the frame, [frame.md](references/frame.md), so every Study looks like ChessDrive, has the same layout and fits any screen, with the Board as [board.md](references/board.md) says:
- the frame's page, style and keeping script, copied as they stand, with the kind's parts in its header, `.cd-board`, `.cd-panel` and `.cd-more`;
- for a Board the person moves on, live.md's card, styles and `live(board)`, with the Study key you made in a coding agent in the page's `chessdrive-key` `<meta>`, and none in an app that shows the page itself;
- the fields of each tool answer your page reads, inline as one `const DATA = {…}` of JSON, leaving out `board_url` and what you don't use. Write `DATA` from the answers with code, never from memory: one wrong letter in a Line is an illegal move on the page. With the CLI the answers are files. With the Connector they arrive in the chat: if your app saved one to a file, read it from there, and if not, write the fields you need to one JSON file in your scratch folder, copied from the tool's answer as it stands, and have your code build `DATA` from that file, so each move is copied once and never typed again. Where no code runs, copy them into `DATA` the same way;
- page code after the keeping script that sets the Board's State and listens to its events, as the kind's reference says, all inside `(() => { … })();`. At the top level of a script, a name the browser already uses, such as `top`, stops the whole script.
In Claude it's an artifact, in ChatGPT a canvas, and in a coding agent a `.html` file in the person's working folder, never a scratch or temporary folder, even one your app tells you to use, so they can find and keep it. Only the page goes there: keep tool answers and any build script in your scratch or temporary folder, not beside the page or in the folder above it.
**If your app can't show a page,** fall back, though a coding agent always can, as the page is a file it opens: `show_board` with the game and its verdicts (see [review.md](references/review.md)), or the position, where the Connector has it. Without `show_board`, give the `board_url` links from the tool answers.
## Step 4: Link back
Every page carries the frame's footer, on screen and on every printed page, whatever else it shows:
```html
<footer class="cd-made">Made with <a href="https://chessdrive.io/?utm_source=study&utm_campaign=KIND" target="_blank" rel="noopener">ChessDrive</a></footer>
```
`KIND` is `review` for a Game review, `drill` for a Mistake drill, `opening` for an Opening drill, `worksheet` for a Worksheet, `prep` for Opponent prep and `other` for anything else. The frame's print rules repeat it on every sheet. The Board's own "Board by ChessDrive" link stays as it is.
## Step 5: Check it
Run `python3 <this Skill's folder>/scripts/check.py <file>` and fix each line it prints until it prints `ok`. It checks `DATA`, the scripts, `innerHTML`, the Board's URL, keys and the footer, with `node --check` where Node is. Never open the page in a browser to check it, yours or the person's: an error once it runs shows on the page, as a line they can paste back to you. It's done when every line holds:
- the page is the frame: its tokens and no colour or font of your own, the header's two lines, the Board in `.cd-board`, the panel in `.cd-panel`, and `data-moves` on `.cd-page` only when the Board shows its moves;
- the Board faces the person's side, or the side to move for a position with no owner, and one that shows a game or a position takes moves and has its way back (board.md, Trying moves);
- every move and verdict on the page traces to the person's input or to an answer in `DATA`, and an evaluation the page prints as a number reads from White's side (`+1.2`, `−0.4`, `M3`, `−M3`). A Game review's own text gives evaluations in words, as [review.md](references/review.md) says;
- text from a PGN or a tool goes in with `textContent`, as a PGN header can hold anything, and the page makes no `fetch` but the keeping script's and live.md's card's, and loads Stockfish only as live.md's `stockfish()` does.
## Step 6: Hand it over
In a coding agent, open the file for them first: `open <file>` on macOS, `xdg-open <file>` on Linux, `start "" <file>` on Windows.
Then up to three short lines, not a line for every marked move. When the Skill that sent you here writes an answer of its own, as Game review does, that answer is the first line: give only the other two, inside it.
- the answer to what they asked, when the page has one ("Engine found no mistakes by you; 7...h6 cost you the most"), from the tool answers alone: name the one to three moves that cost most with their verdicts, and give no reason for a move that `generate` didn't write: "8...Nxd5 was a blunder; the engine preferred 8...O-O", not "…because after 9.fxe4 White wins a piece", and for a drill leave the engine's choice out, as it's the answer; and where on the page to look: a Game review's verdicts and notes are in its top card, On the board;
- how to use the page ("Click a move or use ← →"), and, for a file, where it is: its full path as a link, as in `[/Users/ana/chess/review.html](file:///Users/ana/chess/review.html)`;
- how to keep and share it: for a file, "Download saves a copy that opens anywhere, without your key; send it, or Save as PDF"; in Claude, "Download or share it from the artifact's menu". For a page with a Study key, add that the engine's Line runs in their browser, free, that its questions work for 7 days, up to a dollar a day, and that the key is listed on the Dashboard under Study keys.
Nothing else: no note on moves you left out or notes you dropped. Say nothing about how you checked the page, or that you haven't opened it in a browser: the page shows its own errors. Name no price unless they ask: the key's dollar a day is its limit, not a price, and goes with every page that has a key. If they ask what it cost, add up `cost_usd` and never guess ("2 ChessDrive calls, 4 cents").
## Follow-ups
- **A question about a position** they saw: as `calls.md` says. An `engine` answer the page was built from is reused, so a question about its position needs no new `engine` call.
## Rules
- Load the Board only from the pinned URL in [frame.md](references/frame.md). Its rules and moves are the ones the person can trust.
- Keep the person's data in their page: a game they pasted stays in `DATA`.
- Every call is billed to the person's ChessDrive Account, the page's own too, up to its Study key's dollar a day. Spend only on what the page shows, and rebuild a page from the answers you have.
- Name verdicts as `engine` does. A move it didn't call a mistake is a "costly move" at most.
Fair play: ChessDrive is for review and prep after the game, not for help during rated play.