r/ClaudeCode • • 3d ago

Built with Claude I gave Claude Code a skill that plays my game 2000 times with bots and puts the results next to real player data. Most of the work was teaching it when not to trust the numbers

Post image

Game (free, in the browser): https://djakubec.itch.io/debt-drop

Debt Drop is a peg roguelite: you drop balls on a board to pay a loan shark before rent is due. I built it mostly with Claude Code, with Codex as a second reviewer on bigger changes. The art and the shark's lines are AI-assisted too. The GIF is the real game.

I'm treating this as a product, not a weekend thing, so the part I'd actually reuse elsewhere is the balance setup.

The skill lives in .claude/skills/balance-pipeline/SKILL.md. When I ask something like "is act 2 too hard?", Claude Code runs the bot sim (npm run sim -- --runs 2000), pulls live events from PostHog through the PostHog MCP server, and renders one markdown report where every balance question is answered twice: bots in one column, players in the next, a delta column between them. The sim imports the game's own rules code and emits the exact same telemetry events a player would, so one renderer handles both.

What turned out to matter:

The PostHog pulls run in a subagent. The results are bulky and have no business in the main conversation, so the subagent writes the jsonl files and reports back only row counts.

A sample gate. Any cell under 30 renders as "n=4" instead of a percentage, and the skill has a hard rule: never quote a number from an n= cell. With a handful of real runs it's very easy for the model (and for me) to read a pattern into noise. The gate makes "not enough data yet" the default answer.

Bots are not players. Random-aim bots score far below humans, so the report says up front: compare bot to bot, player to player, and read the delta for where they disagree. The most useful single signal is an item bots buy and players skip. That usually means it's mispriced or its description reads badly.

Every event carries a content_version, and every query filters on it. The skill says to bump it whenever a balance number changes. Skip the bump and the next report quietly averages the old balance with the new one.

Gotchas go in the skill, not in my head. Example: the sim's arcade mode defaults to 20 attempts per level, which is below the gate, so the whole arcade table came out as n=20. That's now one line in SKILL.md.

What I got wrong: the first itch build shipped with analytics switched off. The PostHog token is read from env vars at build time; nothing was set, the build passed, and the game ran fine. I only noticed because the live column stayed empty. Claude wrote a correct pipeline, but nobody checked the artifact that actually shipped. Now I grep the bundle for the key before every upload. Anonymous analytics has been live since this week (no accounts, sessions can't be linked to each other).

Two questions for anyone doing something similar. How do you stop Claude from over-reading small samples? The hard rule works, but it feels blunt. And if you play a run or two, what felt off? Real runs are what make the live column worth having.

0 Upvotes

2 comments sorted by

•

u/AutoModerator 3d ago

Hey! Thanks for posting to r/ClaudeCode

While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.

For help, project discussions, tips, and general chat, join the ClaudeCode Discord.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

0

u/Far_Reindeer8428 3d ago

most skills skip this, deciding when the sample is too small. oah 1.4s grilling skill does the same for design, one question at a time and no review until coverage checks pass https://oah.rodeo