Yash1927/claude-code-snake
tool-snake
一個 Claude Code 外掛,會在聊天旁開啟 Snake pane;Claude 每次呼叫工具就把食物放到棋盤上,Claude 完成後遊戲暫停並用語音報分。
關於這個 mod
tool-snake 是以 function hooks 實作的 Claude Code Mod,並以 plugin 形式提供。遊戲 pane 會停駐在聊天旁(其他版面則位於提示列上方),送出 prompt 後出現。主要 agent 每次呼叫工具都會放下一枚標有工具首字母的彩色籌碼(B Bash、E Edit、R Read、W Write、G Grep/Glob;其他工具會放下灰色籌碼)。蛇只在 Claude 工作期間移動;回合結束時遊戲會暫停,徽章從 LIVE 翻成 DONE,通知和語音行會報告吃掉了多少次工具呼叫。會保留工作階段的最高分。Hooks:prompt.submit(開始回合、開啟 pane)、tool.call(加入食物)、turn.complete(停止)、ui.message(通知與語音)。按鍵:方向鍵/WASD 控制方向,r 重新開始,Esc 把按鍵焦點交還提示列;/snake 重新開啟 pane。採 MIT License。
安裝
請先查看作者 README,確認 marketplace 與外掛名稱;指令可能隨儲存庫結構而變動。
claude plugin marketplace add Yash1927/claude-code-snake claude plugin install tool-snake
原文 / README
tool-snake
Play snake inside Claude Code while it works. Every tool call Claude makes drops food into the game.
<p align="center"> <a href="media/tool-snake-launch.mp4"><img src="media/tool-snake-demo.gif" width="800" alt="Claude Code with the tool-snake pane docked beside the chat: each tool call in the chat drops a colored chip onto the snake board"></a> </p> <p align="center"><a href="media/tool-snake-launch.mp4">Watch the 30-second launch video (sound on)</a></p>What it does
- A game pane opens next to the chat when you send Claude a prompt.
- Every tool call Claude makes drops food, shown as the tool's first letter in the tool's color: B Bash, E Edit, R Read, W Write, G Grep (and Glob). Other tools drop a gray chip.
- The snake only moves while Claude is working. When Claude finishes, the game pauses, the badge flips from LIVE to DONE, and it tells you, in a toast and out loud, how many of its tool calls you ate: "Claude is done. You ate 9 of its 14 tool calls."
- Your best score is kept for the session.
Play
- Get the mod and start Claude Code with it:
git clone https://github.com/Yash1927/claude-code-snake claude --plugin-dir claude-code-snake - Send Claude a prompt. The game pane opens.
- Click the game to give it the keys. Arrows or WASD steer,
rrestarts after a crash, Esc gives the keys back to the prompt. /snakeopens the pane any time.
The game needs the terminal or the desktop app. In the fullscreen layout the pane docks beside the chat; otherwise it sits above the prompt.
How it works
tool-snake is a Claude Code mod: a plugin of function hooks that runs in the session.
| file | what it does |
| --- | --- |
| hooks/register.tsx | Hooks prompt.submit (start a turn, open the pane), tool.call (add food for the main agent's calls), turn.complete (stop) and ui.message (toast and speak the final count), and draws the pane. |
| hooks/game.tsx | The game: a 22x12 board with 2-character square cells, stepped every 110 ms, edges wrap. Draws the header, board, legend and hint. |
| tests/snake.test.tsx | Food from tool calls, eating, pausing when Claude is done, steering, the spoken line, and the pane on the terminal. |
Test
claude plugin validate tool-snake
claude plugin test tool-snake
The launch video
The video in media/ is built entirely in code, with no After Effects. An HTML page
draws every frame from a single time value, Playwright renders it at 60 fps, and ffmpeg encodes it. It runs this mod's own
game logic, so the board, chips and the final 9 of 14 are what the mod produces for those tool
calls. Source and re-render steps are in video/.


