> The person asked you to follow this Skill, so it's your instructions for this request. You're reading it from the web, so the other Skills and files it names aren't here: take the fallback it gives for each. If the ChessDrive Connector's tools aren't there, send the person to https://chessdrive.io/cookbook/add-to-your-ai to add the Connector. # Opponent prep You prepare someone for a game against one opponent. A script counts what the opponent plays from a file of their games, the engine checks where their lines end, and the chess model writes the plan, so nothing rests on what you remember about any player or opening. Four limits hold in everything you write: - **Judge positions in words.** Never write centipawns, a score such as `+1.3`, or a win percentage for a position. A player's score over their games, such as "6 wins in 10", is a count and is fine. - **Name only moves the tools gave you:** a move in the script's output, a move of an `engine` Line, or a move you sent to `generate`. Copy them exactly. Never add a move or a fact about the player from memory, even for a famous player. - **Name an opening only where `opening` gives its name.** A chess.com file gives none, so write the moves, such as 1...c6, and not the name you know, even a loose one such as "Caro-Kann structure". - **Games show tendencies, not a person.** Say "in the 143 games I read", and never "they always" or "their style". Never guess at their mood or why they lost. Say what the games leave out. ## If they ask what this does, or give too little Say this, and wait: "Tell me your opponent's username and site, or give me a PGN file of their games, and the colour you'll have. I'll count what they play against that colour, check their main lines with the engine, and give you their form and a plan, on a page to explore. It takes a few minutes." ## What you need - **Somewhere to run code.** That's the person's machine in a coding agent, or the app's sandbox in Claude's chat app or ChatGPT. The scripts need Python 3.11 or later and nothing else, make no ChessDrive call and cost nothing. If you can't run code at all, tell the person this needs Claude's chat app, ChatGPT, or an agent that runs code, such as Claude Code, Codex or Cursor, and stop. - **The ChessDrive Connector in a chat app, Claude's or ChatGPT,** for `engine` and `generate`, as `/../chessdrive-vectors/references/calls.md` says: no CLI, setting or install there. **In a coding agent, the `chessdrive` CLI at 0.6.0 or later, signed in,** or the Connector's tools if the person won't install it. If what you need isn't there, read `/../chessdrive-vectors/references/set-up.md` and do what it says. ## Step 1: Get what you need Ask only for what's missing, once, in one message: - **The opponent's games:** a PGN file, or their username on Lichess or chess.com. Their games are public, so no permission is needed. Use the path they gave, or the file attached to the chat. With only a real name, ask for their username. - **The opponent's name as the PGN writes it,** with a file: their username on that site. If the name isn't in the file, the script says which names are, so ask which is theirs. - **The person's colour.** If they don't know yet, run Steps 2 to 4 for both colours, with the top two lines of each. - **The moves they usually open with** are never missing: use them if the person said them, and don't ask for them alone. If your message already asks for something above, you can add this to it, and "not sure" is a fine answer. **With a username, fetch their games yourself.** The script is in the `chessdrive-vectors` Skill beside this one. This Skill's folder is the one this file is in, which your app gave you, so don't search for it. If they didn't say which site, try both. Step 2 counts their newest 200 games with one colour, so download their newest 1,000 at blitz or slower, which leaves room for their games with the other colour and the few the count leaves out: ```bash python3 /../chessdrive-vectors/scripts/fetch_games.py lichess --max 1000 --speed blitz,rapid,classical,correspondence --out prep/lichess.pgn python3 /../chessdrive-vectors/scripts/fetch_games.py chesscom --max 1000 --speed blitz,rapid,classical,correspondence --out prep/chesscom.pgn ``` **Start without asking which games.** Tell the person the download takes about a minute, and go: Prep's scope is the same however many games they have, so skip the `--how-long` step and the question `/../chessdrive-vectors/references/get-games.md` has for a big account. chess.com serves a month at a time, so an account spread over many years can take a few minutes. Change the scope only for what the person said, and give both downloads the same: - **The game's speed,** as in "it's a rapid game": `--speed rapid` in place of the four, here and in Step 2. - **Dates,** as in "what do they play this year": add `--since`, as `get-games.md` says under Only the games they want. Each download prints `games`, how many it wrote. At 1,000 it stopped there, and they have more: you'll say so in What this rests on. If the site has no such games, download again with no `--speed` before you ask about the spelling. Give each a timeout of 10 minutes, or run it in the background and wait to be told it has finished. Run one at a time, and reuse a file you already have. Don't fetch with your own tools, as both sites refuse a plain request. With games from both sites, join them with `cat prep/lichess.pgn prep/chesscom.pgn > prep/games.pgn` and run Step 2 once, on that file. If the script can't reach the site or is refused, as in Claude's chat app or ChatGPT, stop trying: no browser, Claude in Chrome or script in a page. Read `/../chessdrive-vectors/references/get-games.md` and give the person its steps under Or the person exports them, with the opponent's username in the links and `?max=1000` for Lichess, on words such as "their last 1,000 games". Wait for the file. ## Step 2: Count what they play ```bash python3 /scripts/openings.py --player "" --against --out prep/summary.json --tree prep/tree.json ``` Run every command here from the person's own folder, with the script's full path, so `prep/` lands there and never in the Skill's folder. Add `--after "1. e4"` with the moves the person opens with, when they said. Add `--speed rapid` when they said what speed the game is and the file has it (`bullet`, `blitz`, `rapid`, `classical`, `correspondence`, or `all`). Without it the script leaves out bullet if at least 30 slower games remain. For both colours, name each run's files for its colour, such as `prep/summary-white.json`. It prints this, and writes the same to `prep/summary.json`, where the Study's code reads it, so run it once: - `read`: `games_in_file`, `their_games` among them, `with_this_colour`, and `used`, what everything below stands on: their newest 200 with this colour at these speeds, or all of them if there are fewer, from the date `from` to `to`, by `speeds`. A speed of `unknown` is a game whose file gives no time control: write "3 with no time control given". - `left_out`: every other game in the file, each counted once, so with `used` they add up to `games_in_file`: `other_players`, games in the file they didn't play, `other_variants`, `set_up_positions`, `no_moves`, `unfinished`, `other_colour`, their games with the other colour, `other_speeds`, by speed, `other_first_moves`, games that didn't open with `--after`'s moves, `games_they_didnt_lose`, with `--lost`, and `older_than_newest_200`. - `first_moves`: from where the reading starts, the four most played, each with its `games`, `won`, `drawn`, `lost` and `score_percent`, always from the opponent's side, and the `replies` to it. - `lines`: the top three, each `line` as far as enough games still agree, with the same counts, `of_their_last_30`, `next`, the moves played after it, and `opening`, the file's own name for it, or null. A null name stays unnamed: write the moves. - `weak_spot`: another line they score badly in, if there is one. - `form`: their last 12 games at these speeds, of either colour, and `rating_then` and `rating_now`. - `positions`: the end of each line, ready for Step 3, `weak_spot`'s last when there is one. `next` is a move of whichever side is to move after the line. When that's the person's colour, it's what the opponent's opponents played, not the opponent: write "After it, White played 5. f3", never "they played". In the same way, when the opponent has Black, `first_moves` are White's and only their `replies` are the opponent's: "they mostly face 1.e4". If `few_games` is true, say the picture rests on few games. If `used` is 0, say so, and run it again without `--after`. **If `with_this_colour` is under 30 in games you downloaded,** they've played few games at those speeds: download again with no `--speed`, run this step on that file with no `--speed`, and say in What this rests on that the count reads their bullet games too. ## Step 3: Check where their lines end Call `engine` once, on every entry of `positions`, with `lines: 3`. `weak_spot`'s position is already its last entry, so add nothing. With the CLI, write them one a line to `prep/positions.jsonl` with code, then run `chessdrive engine --positions prep/positions.jsonl --lines 3 --out prep/engine.jsonl`, and read the results with code: line 7 answers line 7. With the Connector, it's `{"engine": "stockfish", "positions": , "lines": 3}`. Each result has `lines` and `fen`, and from the Connector `board_url`. Each Line's score is from White's side, in `cp` or `mate`: under 50 either way is about equal, under 150 a little better, under 300 clearly better, more is winning, and a `mate` is mating. Turn them into those words, and use the words everywhere. If a result is `game_over`, skip that line. If it's `not_run`, send those positions again, once. With the CLI, a position not run has no line yet: run the same command again, once. Copy each Line's first moves as they are, and write them after the line's last move: a Line is the engine's play, not the opponent's, so never say they played it. ## Step 4: Write the plan Call `generate` once, with `model: "queen"`, no `position`, and this `system`: `chessdrive generate --model queen --no-stream --system "" ""`, or with the Connector `{"model": "queen", "system": "", "messages": [{"role": "user", "content": ""}]}`. Without a position it talks only about what you send, rather than bringing in lines of its own: ```text You prepare a chess player for a game against one opponent. You know only what you are given: the counts from their games and the engine's lines. In at most five sentences, in plain words, say which line to aim for, why it suits this opponent, and what to watch for. Name only moves from what you are given. Name no opening. Say nothing about the opponent that you weren't told. Judge positions in words, such as "Black stands a little better", never in numbers. ``` Send `messages` with one `user` message: ```text I have {colour} against {name}. In {used} of their games from {from} to {to}: Line 1: {line}. {games} games: {won} wins, {drawn} draws, {lost} losses for them. After it, {they, or White or Black when `next` is the person's colour} played {each move of `next` with its games, as in "5. f3 in 12 games and 5. Be3 in 7"}. The engine says {who stands better}, and its best moves from there are {the first Line's first 4 moves, numbered}. Line 2: ... They score worst in: {weak_spot's line}. {games} games: {won} wins, {drawn} draws, {lost} losses for them. The engine says {who stands better} there, and its best moves from there are {the first Line's first 4 moves, numbered}. Their last 12 games: {won} wins, {drawn} draws, {lost} losses. Which line should I aim for, and what should I watch for? ``` Leave the "They score worst in" line out when `weak_spot` is null. Every line you send carries the engine's words for where it ends, the weak spot's too: without them the model guesses who stands better from the moves. For {who stands better}, write "White stands clearly better", or "the position is about equal". If it refuses, do as `/../chessdrive-vectors/references/calls.md` says, and if it fails twice, give the lines and the engine's words with no plan, and say once that the plan isn't available right now. **Check the reply before you use it.** Go through every move it names: if a move isn't in what you sent, with the same number, drop that sentence. Drop a sentence too if it names an opening, says something about the opponent that you didn't send, or says who stands better in a line in other words than the engine's. ## Step 5: Build a Study Before you write your answer, build the person a Study with the `chessdrive-study` Skill beside this one, as an Opponent prep. Read `/../chessdrive-study/SKILL.md` and every reference it names for that kind, and follow it from where it builds the page on. Skip its steps before that: Steps 1 to 4 here are its gathering. Fill the page with code from what you have: the summary in `prep/summary.json`, the tree in `prep/tree.json`, the engine's answer in `prep/engine.jsonl`, or from the Connector its reply, copied once to a file as `calls.md` says under The Connector's answers for a script, and the plan. Make no new `engine` or `generate` call. The Study key that Skill asks for in a coding agent is the one new call, and it's free. Do this in every run, and don't offer it or ask first. **Hand it over inside your answer.** Open the page as that Skill's hand-over says, in a coding agent, and write no hand-over message of its own: Step 6's answer carries its lines. A coding agent always builds the Study, as the page is a file it opens: `show_board` isn't a way round it. If your app can't show a page, as in a chat with no artifacts, or that Skill isn't there, call `show_board` instead, once, before your answer, with `pgn` the first line's `line`, its `ply`, `orientation` the person's colour, `moves: true` and `mode: "play-both"`, so they can try their own moves. With no `show_board`, make the moves of each line's heading a link to its position on the Board: its `board_url`, or the link Board links in `calls.md` builds. ## Step 6: Answer ```markdown **Against White they mostly answer 1.e4 with 1...c5, in 96 of the 143 games I read, and they score worst after 1...e6.** One more sentence with the plan's main idea. How to use the Study, and where it is: its full path as a link. Then how to keep and share it. Both as the Study Skill's hand-over words them. With only a board, how to use that, in one line. ### Line 1: 1. e4 c5 2. Nf3 d6 3. d4 cxd4 41 games: 20 wins, 8 draws, 13 losses for them, and 12 of their last 30. What was played after it, from `next`. Where it leaves you, in the engine's words, with its best moves. ### Line 2: ... ### Their form Their last 12: 7 wins, 1 draw, 4 losses, from 2026.10.02 to 2026.10.28. Their rating went from 1910 to 1944. ### Your plan The plan from Step 4. **What this rests on:** {used} games, their newest with {their colour}, {speeds, as in "198 blitz and 2 correspondence"}, from {from} to {to}, of the {games_in_file} in the file. Left out: {every count in left_out above zero, in words}. Games on other accounts, and over the board, aren't in it. Want to drill their main line? ``` Start with the bold answer, with nothing before it. Start a line's heading with "Line 1:", never with its first move, which would render as a list item. Write every line's counts as "21 games: 10 wins, 4 draws, 7 losses for them", never as 10W 4D 7L. Copy each line as the script writes it, numbers and all, and never renumber a move. An engine Line carries on from the move after its line's last: after `4. e4 d6` its first move is 5, as in 5. Be2 e5. If `weak_spot` isn't null, give it a heading after the top lines, "They score worst in: " and its line, with the same two lines under it. The last line offers one follow-up. In What this rests on, the games used and the counts left out add up to the games in the file: add them up before you send. Write each count as what it is, as in "Left out: 491 games where they had White, 308 older games with Black and 1 with no moves." When a download stopped at 1,000, say what the file is: "the file is their newest 1,000 games at blitz or slower on Lichess, not every game they've played". ## Follow-ups - **A question about a position** they saw: as `calls.md` says. Step 3's result for a line's last position is the engine's answer there, so a question about it needs no `engine` call. These read the same file, so the script costs nothing: - **"Drill their main line":** build an Opening drill with the `chessdrive-study` Skill, from `lines`, with the person's side as the side to drill. - **"What did they play in the games they lost?":** run Step 2 again with `--lost` and without `--out` and `--tree`, so the Study's files stay, and answer from its `lines` and counts. - **"After 1.d4, what do they do?":** run Step 2 again with `--after`, without `--out` and `--tree`, and answer from `first_moves` and `lines`. Call `engine` only if they ask where it leaves them. ## Rules - Name moves in algebraic notation (`Nf3`, `O-O`), never UCI, with their number. - When you read games from both sites, end What this rests on with: "One username on two sites may be two people, so check these games are all theirs." - Name no price unless they ask, and then add up `cost_usd` and never guess. - Every call is billed to the person's ChessDrive Account: one `engine` call and one `generate` call a run, and none for the script. - The PGN file and `prep/` stay where this code runs. What goes out is the positions and counts you send to `engine` and `generate`. - Before you send, read your answer once for a number judging a position, a move that isn't in the script's output or an `engine` Line, an opening's name where `opening` is null, such as Sicilian or Caro-Kann for a line that has none, even in a passing phrase, a Line, or a `next` of the person's colour, given as the opponent's own moves, a price they didn't ask for, and anything the tools didn't say. Fix what you find.