The challenge with AI and chess
I have been fascinated by the improvements in AI and LLMs. As a builder of many AI applications, I wondered what would happen if I could combine AI with chess coaching. If you have tried playing chess with LLMs like ChatGPT or Claude AI, you will notice they often hallucinate. In other words, they play illegal moves and often lose track of the board position. They might understand chess rules in theory, but they're not context-aware of the actual game state.
I wondered, would it be possible to create an AI Chess Coach that could help analyze and identify key moments in a chess game?
Teaching LLMs chess
I started by analyzing some famous games, specifically spending time on Short vs Timman as I have always admired that king walk in the middlegame.
Check out the full Short vs Timman analysis here
The breakthrough came from combining several techniques:
- Chess engine: Using engines like Stockfish to provide accurate position evaluation and best moves
- Board representation: Converting chess positions into a format the LLM can reliably understand
- Carefully crafted prompts: Teaching the AI to focus on explanation rather than move generation
- Strategic examples: Training the system with annotated games to understand chess commentary patterns
This approach allowed the LLMs to excel at what it does best - explanation and teaching - while relying on proven chess engines for the technical accuracy.
The result of this is an AI that can provide both text and voice commentary explaining:
- The actual move played and its implications
- The engine's recommended best move in the position
- Clear reasoning for why the recommended move is superior
- Key chess principles to remember
Tailoring commentary to player strength
One of the most exciting possibilities I'm exploring is customizing the analysis for different skill levels. The same position could be explained in completely different ways depending on your chess rating. Here's how this could work for the Short vs Timman position:
Commentary for a beginner player
Black moved their queen to a square that doesn't help defend the king or stop White's plans. This is a problem because White is getting ready to attack, and Black's pieces aren't working well together. In this position, Black needed to find a way to get their stuck bishop out and bring their pieces closer to the action. The better idea was to prepare to move a pawn on the queen's side to open up space. This would let the bishop out and make it harder for White to attack. It's important to remember that if your pieces are stuck or not helping, you should focus on getting them active and working together, not making moves that don't do much.
Commentary for an advanced player
Black's 20... Qc5 is strategically dubious, failing to contest White's kingside initiative and neglecting queenside development. The queen's drift leaves Black's position cramped and fails to address the primary problem: the c8 bishop's inactivity. The immediate priority was to prepare b6 to open the light-squared bishop and improve Black's piece coordination. In general, when cramped, prioritize pawn breaks and piece activation—passive queen moves only exacerbate spatial issues and leave Black vulnerable to White's expanding initiative.
Analyzing Your Own Games
If you would like to try this type of analysis out on your games, complete the following steps:
- Go to https://app.chesscoach.dev/
- Enter your Lichess username
- Your 40 most recent games are automatically loaded
- Select the game you want analyzed
- (Optional) Enable voice commentary for audio analysis alongside text
- Click analyze and wait for the magic
After processing, you'll receive analysis of 4 key moments from your game - one from each phase (opening, early middlegame, late middlegame, endgame). The system highlights critical squares with green circles to aid visual learning.
Why is this different
Unlike traditional chess engines that only show you evaluations and variations, this AI Chess Coach explains the why behind the moves. It identifies the critical moments where games are won or lost and explains them in language appropriate for your skill level. The voice commentary adds another dimension, making it feel like you have a personal chess coach walking you through your games.
If you would like to follow along my building journey consider signing up at: https://www.chesscoach.dev/