In the past, I’ve used Claude Code with mixed results. The tool has improved a great deal in the meantime. I still prefer developing the most essential functionalities by hand instead of using Claude Code. However, I found a fun way to use Claude Code in a way it wasn’t intended! One of my hobbies is playing TTRPGs (tabletop role-playing games) and CRPGs (computer/console role-playing games), which both tend to have limitations that the LLM-powered Claude Code does not.

TTRPGs require other people to be available at the time you want to play, and they require a person to “prep” (prepare) a session. CRPGs don’t have that limitation, but they are limited to what the developers programmed into them. I think that LLMs are great for generating text, but they eventually lose track of the context, which, in my experience, makes the story grind to a halt.

Claude Code doesn’t have those limitations, and it offers something that most other interactions with LLMs don’t: a file backend. This backend is great for keeping track of everything a DM (dungeon master, also often known as a GM: game master) would need to manage a session, story, or campaign.

To get started with this project, I figured it would be useful to have the d20 SRD available. There’s already a GitHub repository that has this, and in Markdown to boot! I created an empty directory and prompted Claude Code to plan a directory structure it could use to run a campaign for the user. This generated an extensive file structure and content, very much directed at the d20 system, I think, but I figure it is easy to change that.

Claude Code didn’t understand that I wanted it to run the game, so I let it generate CLAUDE.md for itself and expand on the features, which added some slash commands. After spending a couple of hours and $15, I think it is at a point where it is quite user-friendly and stable. I have made the project available to the public:

git clone https://git.sng.rs/ks/claude-dm.git

Start Claude DM by running claude. There are a couple of custom commands to help the user manage the game state: /new-campaign, /save, /continue, /exit, /campaigns, and /game-help for more commands.

It will take some time to get from starting a new campaign to actually playing because Claude Code will have to generate a campaign, interactively create a character for the player, and create locations and NPCs (non-player characters), etc. That will, sadly, give some spoilers regarding the game.

I’ve had a lot of fun playing with Claude Code as a DM!

Final note: a friend of mine suggested using /model to set the model to haiku for increased speed and lower costs. This seems to work well, but I can imagine that it might drift from the rules a bit. I think it’s great, at least!

Resources