Overview
Use Claude Code to separate a Telegram role-playing bot's combat rules from its chat code, then write and run a battle simulator that pits every character class against the others so you can tune the numbers.
Problem or Objective
- Which agents help create, run and debug games?
- Which setups let many agents act in a simulated world you can observe?
More in Games and Simulations
AI Agents and Models
Tools and Integrations
- Tools
- Claude Code · Telegram
- Prerequisites
- Claude Code with a Claude subscription or Console account, the source code of your Telegram bot, and a place to run the bot.
How It Works
Start Claude Code in the repository of your game bot. Ask it to read the code and move the combat rules (stats, damage formulas, abilities, random rolls) into one module that has no Telegram dependency, with unit tests that pin the current behaviour. Next, ask it to write a command-line simulator that runs many fights for every pair of classes with a fixed random seed and writes win rates, average fight length and damage per turn to a CSV file. Run the simulator, review the table with Claude, and choose small changes to the class numbers yourself; have Claude apply them on a branch, rerun the tests and the simulator, and show the before and after tables. Only when you are happy, merge the branch and restart the bot on your own server.
Implementation Workflow
Steps assembled from the agents, tools and prompt of this entry. Adapt them to your own setup.
- Choose the agentSet up Claude Code.
- Connect the toolsConnect the tools this workflow relies on: Claude Code, Telegram.
- Check the prerequisitesClaude Code with a Claude subscription or Console account, the source code of your Telegram bot, and a place to run the bot.
- Gather your detailsCollect what the prompt asks for: Character classes, Telegram bot library you use, Fights per class pair, Random seed.
- Run the starter promptPaste the starter prompt below into Claude Code and adapt it to your case.
- Check against the documentationCompare what you get with the documentation at code.claude.com before you rely on it.
Practical Starter Prompt: Build a combat simulator for my bot
Fill the fields to adapt the prompt. Empty fields stay as visible [placeholders].
Read this repository. Move the combat rules for [Character classes] into a module with no [Telegram bot library you use] imports and add unit tests that lock in the current behaviour. Then write a simulator that runs [Fights per class pair] fights for every pair of classes with seed [Random seed] and writes win rate, average turns and damage per turn to results.csv. Run it and summarise the outliers. Propose number changes but ask me before applying them, and work on a branch; do not merge or restart the bot.Approve the proposed number changes yourself, read the diff, and merge and restart the bot only after the tests and a second simulator run look right.
Expected Results and Benefits
This is a suggested workflow, not a reported result. The points below are what the cited documentation says the tools can do.
This is a suggested workflow, not a reported outcome. Anthropic's Claude Code overview says it reads your codebase, edits files and runs commands, which covers refactoring the combat code, writing the simulator and running it. Nothing on the pages covers Telegram bots or game balance, so whether the resulting classes feel fair to players is something only playtesting can tell. The Telegram bot platform and your hosting were not verified here.
Limitations and Considerations
A simulator only measures the rules you coded: abilities that depend on player choices need a simple strategy model, so treat the win rates as a guide and confirm with real players. Keep the bot token in an environment variable, out of the repository and out of prompts. Review every diff before merging, since changed numbers affect existing players' characters. Most Claude Code surfaces require a Claude subscription or Anthropic Console account. Results depend on your setup and were not independently reproduced by Top 200 Repos.
GitHub Repositories
AI Agent Repository
Source code of the agent that does the work.
Related Videos
About anthropics/claude-code
The SECRET Claude Code Upgrade That Has Everyone Going Nuts (Full Guide) (opens in a new tab)
The title names the project, the description links the project website.
Watch on YouTube (opens in a new tab)About anthropics/claude-code
The only Claude Code guide you'll ever need (Opus 4.5) (opens in a new tab)
The title names the project, the description links the project website.
Watch on YouTube (opens in a new tab)Independent creators. Listing a video implies no endorsement, sponsorship or partnership.
Sources
- Overview - Claude Code Docs (opens in a new tab)
Project documentation · code.claude.com · Undated · Source checked 25 Nov 2026, 11:57 UTC
What this source supports
- Claude Code is an agentic coding tool that reads your codebase, edits files, runs commands, and integrates with your development tools.
- Claude Code is an AI-powered coding assistant that helps you build features, fix bugs, and automate development tasks.
- Most surfaces require a Claude subscription or Anthropic Console account.

