packages/core/src/skill/tree.ts.
Data Model
Skills are stored flat in theskills 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.
XP Routing
When a quest is completed,collectSkillXp determines how XP is distributed:
updateSkillXp then applies the updates and recalculates the level for each affected skill.