← Projects

Letting Claude test its own Minecraft code

Once I adopted agentic coding, writing code was easy, but testing took a lot of time. That's why I made a test harness where Claude Code starts a throwaway copy of the BingoMC network, joins it with a bot and proves a change works in game.

Building Minecraft plugins in Java for BingoMC got supercharged once I started working with Claude Code. But a new bottleneck was forming: testing. I had to check every change in game by joining with my own Minecraft client, and that was slow and time consuming.

So I gave Claude a way to test its own work.

A network in a box

The harness starts a complete, disposable copy of the network on my machine: a MySQL database loaded with the production schema and seed data, object storage with a Minecraft world, Redis, the proxy, a lobby and a game server. Everything runs from throwaway copies, which every agent has its own of, so tests can run in parallel.

A Mineflayer bot then joins the server like a real player. Small scripts let Claude send console commands, make the bot run commands, and deploy a change into the test servers.

How Claude checks its work

The bot writes everything it sees to a log: chat, titles, the action bar, the scoreboard, its inventory, and kicks. A test records where the log is, drives the bot, and then asserts on what showed up. For the things a player can’t see, it checks the server itself, with entity data and SQL queries against the test database.

A test in the harness: one bot throws snowballs at another, and every hit is logged so the test can check the knockback. Another bot checks whether the Santa Sleigh gadget we made for winter actually works.

On top of that sit larger suites: a routing matrix that sends players through the real lobby, proxy and game server, SQL contract tests, and a smoke test on staging that runs three games at once.

Several Claude sessions can test in parallel, because each one gets its own slot with its own containers, ports and logs.

Teaching Claude to use it

The harness is a set of scripts, but the part that makes it work is the instructions. A Claude Code skill explains which test loop to use when, how to tell a server is ready, and the gotchas I ran into. The project instructions tell Claude to prove every change in game, and to review its own code before handing it back.

The result

Claude now gets it right about 99% of the time before I even look at it. I review results instead of clicking through games by hand, and testing stopped being the bottleneck.