Skill Tree
A skill tree lets players spend points on skills, and each skill can need others first. Every choice opens up later ones. What usually goes wrong is taking points back: only allow it if every skill that stays still has what it needs. Have your AI check the tree for loops and missing skills.

Paste this to your AI
Copy it into Claude, Cursor or ChatGPT. It already has good values and the usual mistakes in it.
Add "Skill Tree" to my game.
What it should do: A skill tree lets players decide what their character becomes, and each choice opens up later ones. That gives them something to plan for.
Build it exactly as this state machine. First check that it fits my game, then build it like this:
```mermaid
stateDiagram-v2
[*] --> locked
locked: Locked
open: Can be bought
owned: Bought
locked --> open: needs are met
open --> locked: a need is taken back
open --> owned: first rank bought
owned --> owned: buy or refund a rank
owned --> open: last rank back, or reset
owned --> locked: whole tree reset
```
Use these starting values:
- pointsPerLevel: 1
Watch out for these common mistakes:
- A refund takes away something another skill needs: Tell your AI to refuse a refund if any skill the player keeps would lose what it needs.
- A spare rank cannot be refunded: Tell your AI to check requirements against the rank after the refund, not just whether another skill depends on this one.
- Two skills need each other: Tell your AI to look for loops in the requirements when the tree loads.
- A requirement nobody can meet: Tell your AI to compare each required rank with that skill's maximum when the tree loads.
Do not change anything else in the game. Do not claim anything without proof: model what it takes, and show me what your solution rests on and how I can see that it works. If you cannot show something, say you do not know. When you are done, tell me in plain words how to try it.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP
What it does
A skill tree lets players decide what their character becomes, and each choice opens up later ones. That gives them something to plan for.
How it runs, as a diagram
Everything it can be in, and what moves it on. Your AI builds from exactly this.
How it runs, as a diagram
- Locked → Can be bought: needs are met
- Can be bought → Locked: a need is taken back
- Can be bought → Bought: first rank bought
- Bought → Bought: buy or refund a rank
- Bought → Can be bought: last rank back, or reset
- Bought → Locked: whole tree reset
Good starting values
| Value | Start with | What it changes |
|---|---|---|
| pointsPerLevel | 1 | How many points each level gives. More points fill the tree faster; fewer make each choice matter more. |
What usually goes wrong
A refund takes away something another skill needs
A player gives back a skill that another skill they keep still needs. They now hold something they could never have bought that way.
Fix: Tell your AI to refuse a refund if any skill the player keeps would lose what it needs.
A spare rank cannot be refunded
A simple check refuses every refund as soon as another skill depends on this one, even a third rank when the others need only two.
Fix: Tell your AI to check requirements against the rank after the refund, not just whether another skill depends on this one.
Two skills need each other
Neither can ever be bought, and the tree looks fine until a player reaches them.
Fix: Tell your AI to look for loops in the requirements when the tree loads.
A requirement nobody can meet
A skill asks for rank 3 of a skill that stops at rank 2. Everything behind it stays closed, and nothing tells you why.
Fix: Tell your AI to compare each required rank with that skill's maximum when the tree loads.
How to check it works
- You meet a skill's requirements and have enough points. you buy it: its rank goes up and the points are spent.
- A skill whose requirement you do not have yet. you try to buy it: nothing changes.
- A skill that needs rank 2 of another. you try to buy it with that other skill at rank 1, then at rank 2: it is refused the first time and works the second time.
- A skill with two requirements. you try to buy it with one met, then with both: it is refused, then it works.
- A skill at its highest rank. you try to buy it again: nothing changes.
- Too few points. you try to buy a skill: nothing changes.
- A skill you bought that nothing else depends on. you give it back: its rank goes down and the points come back.
- A skill at exactly the rank another skill needs. you try to give it back: nothing changes.
- A skill one rank above what another skill needs. you give it back: its rank goes down.
- Several skills bought. you reset the whole tree: all ranks are gone and all the points are back.
- Three broken trees: one with a loop, one with an unknown skill and one with an impossible rank. you ask your AI to show you what the tree check says: each problem is reported, and a tree with no mistakes reports none.
Common questions
how do you make a skill tree
Keep every skill in a list, with its cost, its highest rank and what it needs. One buying rule then works for every skill.
what do i tell my ai to add a skill tree
Paste this: Add a skill tree where each skill has a cost, a highest rank and a list of what it needs, with one buying rule that checks the points, the rank and the requirements.
how do i handle refunds in a skill tree
Work out the ranks as they would be after the refund, then check that every skill the player holds still has what it needs. If one does not, refuse the refund.
how do i find problems in a skill tree before release
Have your AI check it when it loads: every required skill exists, every required rank can be reached, and there are no loops. A tree that passes can then be bought in full.
Where it comes from
Earliest example we could find: Diablo II (Blizzard North) (2000). Earliest character skill tree we could document. Each class learns skills by spending points along branching trees, with later skills gated by character level and by earlier skills. David Brevik recalls the idea as letting classes choose a path through a tree, borrowed from the research tree of the strategy game Master of Orion.
- 1980 Civilization (board game, Francis Tresham, Hartland Trefoil): Precursor, not a skill tree: a technology tree in which advances require earlier advances. It belongs to a civilization, not a character. It is listed because Craddock traces the research tree of Master of Orion back to this game, and Brevik's skill tree idea came from that research tree. [Civilization (1980 board game), Wikipedia][How StarCraft and Shower Epiphanies Influenced Diablo 2's Design (David Craddock, Game Developer, 2018; excerpt from Stay Awhile and Listen: Book II)][How Assassin's Creed Valhalla made a 40-year-old mechanic controversial again (Danny Paez, Inverse, 2020)]
- 2000 Diablo II (Blizzard North): Earliest character skill tree we could document. Each class learns skills by spending points along branching trees, with later skills gated by character level and by earlier skills. David Brevik recalls the idea as letting classes choose a path through a tree, borrowed from the research tree of the strategy game Master of Orion. [How StarCraft and Shower Epiphanies Influenced Diablo 2's Design (David Craddock, Game Developer, 2018; excerpt from Stay Awhile and Listen: Book II)][Branching out: How limiting skill choices made Diablo 2 more fun (GamesBeat, 2018; excerpt from Stay Awhile and Listen: Book II)]
- 2001 Final Fantasy X (Square): The Sphere Grid replaces fixed level gains with movement across a fixed board of connected nodes holding stats and abilities. It is a network rather than a strict tree. Sourced from Wikipedia only. [Final Fantasy X, Wikipedia]
- 2004 World of Warcraft (Blizzard Entertainment): Talent trees brought the point-spending tree to an MMO. Early beta talents were closer to spell upgrades; the trees that replaced them were modeled on Diablo II, which Blizzard itself confirms. [WoW Archivist: Strange choices behind WoW's earliest talent trees (Scott Andrews, Engadget, 2012)][Diablo II continues to inspire Blizzard 20 years later (Blizzard News, undated, about 2020)][Skill Tree (Digital Games Mechanics Wiki, WPI)]
- 2011 Tom Chilton's GDC talk on World of Warcraft: Cataclysm: A developer's public account of a skill tree's failure mode: trees grew bloated, many talents were filler, players followed standard builds, and newcomers found the trees intimidating. Blizzard cut them down to viable choices. Reported by Engadget, which paraphrases the talk. [GDC 2011: Tom Chilton discusses Cataclysm design, talent and zone revamps (Mathew McCurley, Engadget, 2011)]
- 2013 Path of Exile (Grinding Gear Games): A single large passive tree shared by all classes, each starting from its own point. Grinding Gear Games says a passive tree was already in its late-2008 design document and changed through many iterations before the release. [Stories from Development: What came from the Original Design? (Bex_GGG, Path of Exile forum, 2018)][Path of Exile, Wikipedia]
What was checked
- 15 tests pass on the reference code.
- The state diagram was checked against the code, at the default values and at every listed low and high value.
Your AI gets the code
Tested example code comes through the Spielerando connection, so your AI can use it right away. How to connect it