skill-progression-trees
Covers the design and server-side build of game skill trees as prerequisite graphs: node types, cost curves, respec, prestige, and unlock validation in…
от fcsouza★ 29 звёзд на GitHub
Установить skill-progression-trees в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Skill and Progression Trees
Core rules
- Model a DAG, not a tree. A node can have several prerequisites. Cycles break validation, so reject any admin write that creates one.
- Validate unlocks on the server. Never trust a client unlock request. Check prerequisites and currency on the server, and write the deduction and the unlock row in one transaction.
- Snapshot the node at unlock time. Store its prerequisites, cost, effects and tier on the unlock row. After a balance patch you can still audit what the player bought.
- Scale cost by tier. Flat costs make late nodes cheap as income grows. Use
cost = baseCost * tier^exponentand tune the exponent against player income per tier. - Always offer a respec. Free with a cooldown, or paid in soft currency.
- Store effects as data. Keep effects in JSONB (
{ "stat": "attack", "modifier": "+10%" }) and apply them on the server. A balance change then needs a data update, not a deploy. - Reveal nodes progressively. Show a node once its prerequisites are met, so new players are not faced with the whole tree.
Procedure
- Classify every node: active (player-triggered ability), passive (always-on bonus), unlock (gate to content or a mechanic), prestige (bonus that survives a reset).
- Fill in the design doc. Copy
templates/skill-tree-template.mdwhen starting a new tree; it holds the cost table, respec policy, prestige rules and the balance checklist. - Create the tables. Copy
boilerplate/skill-tree.tswhen building the backend. It definesskill_nodes(tree definition, prerequisites as a JSONB array of node IDs) andplayer_skills(one row per unlock, unique on player and node, with the snapshot). - Build the unlock endpoint.
POST /skills/unlock/:nodeIdcallsunlockNode(db, playerId, nodeId, spend), which runs the eligibility check, the deduction and the insert in one transaction.spendis required, so the deduction cannot be left out: pass(tx, playerId, cost) => spendCurrency(tx, playerId, SKILL_CURRENCY, cost)with the guardedspendCurrencyfrompostgres-game-schema. It returns false when the player cannot pay, andunlockNoderolls back. Add the foreign key fromplayer_skills.player_idto your players table withonDelete: 'cascade'(the file marks the spot). - Cache the unlocked set. If tree reads load the database, cache each player's unlocked node IDs and delete the cache entry after an unlock or respec commits.
- Build the respec endpoint.
POST /skills/respec: charge the fee or check the cooldown, delete the player'splayer_skillsrows except prestige nodes (they survive a reset by definition), refund the points spent on the deleted nodes, and invalidate the cache, all in one transaction except the cache delete. - Run the health checks on every admin write.
detectCyclesreturns each prerequisite cycle;findMissingPrerequisitesreturns prerequisites that point at deleted nodes. Reject the write if either is non-empty.
Endpoints
| Endpoint | Method | Does |
|---|---|---|
/skills/tree |
GET | Full tree with the player's unlock status per node (getPlayerTree) |
/skills/unlock/:nodeId |
POST | Validates prerequisites and cost, deducts, inserts, in one transaction |
/skills/respec |
POST | Charges the fee, deletes the player's unlocks, refunds points |
Pitfalls
- Unlock state on the client. Trivial to edit and it drifts from the server.
- Trusting the eligibility check alone under concurrency. Two parallel requests can both pass it. The unique index on (player, node) rejects a duplicate unlock, and the failed insert rolls back that transaction's deduction. Requests for different nodes are not covered: the
spendyou pass must guard the wallet update itself, asspendCurrencyinpostgres-game-schemadoes withWHERE amount >= costand a check that it updated one row. - Chaining
.where()in Drizzle. A plain select allows one.where(); a second call is a type error, and the builder stores only the last condition. Combine conditions withand(...). - A driver without transactions. Drizzle's
neon-httpdriver throwsNo transactions support in neon-http driverfromtransaction(). Use a driver with interactive transactions forunlockNodeand respec. - No respec. A bad early choice locks the build for good.
- Flat costs. Late nodes become trivially cheap as income grows.
- No cycle check. One circular prerequisite makes every node in the loop unreachable.
- Effects in code. Every balance change needs a deploy.
- Whole tree visible at once. Overwhelms new players.
Files
boilerplate/skill-tree.ts: copy when building the backend. Drizzle tables,canUnlock,unlockNode,hasUnlocked,getPlayerTree,detectCycles,findMissingPrerequisites. The caller passes its own Drizzle database; the file imports no driver.templates/skill-tree-template.md: copy when desi
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- boilerplate/skill-tree.ts
- references/sources.md
- templates/skill-tree-template.md
FAQ
Что делает скилл skill-progression-trees?
Covers the design and server-side build of game skill trees as prerequisite graphs: node types, cost curves, respec, prestige, and unlock validation in Postgres with Drizzle. Use when a game needs a skill tree, talent tree, ability unlock graph, passive bonus web or prestige layer, or when building its unlock and respec endpoints.
Как установить скилл skill-progression-trees?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл skill-progression-trees запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…