I wanted it to be fun and actually complete games. I started with this, with a few minor tweaks: https://github.com/Tmate6/Lichess_ChatGPT_ChatBot/blob/main/...
This approach sends along the list of legal moves in the prompt if it attempts an illegal move. That seems to work well at getting playable moves.