Skip to main content
The skill tree module lives in packages/core/src/skill/tree.ts.

Data Model

Skills are stored flat in the skills table with a parent_id self-reference:

Building the Tree

buildSkillTree(skills: Skill[]): SkillNode[] takes the flat list from the database and constructs a directed acyclic graph. Each node has a children array containing its direct descendants.
Root nodes (skills without a parent) are the top-level entries.

XP Routing

When a quest is completed, collectSkillXp determines how XP is distributed:
XP is awarded to each tagged skill directly. Parent skills do not automatically receive child XP; each node is independent. updateSkillXp then applies the updates and recalculates the level for each affected skill.

Skill Repository