ClaudeMods
☰
ZH-CN
● 0 人在线 · 浏览 0 次
赞助提交作品
GitHub 仓库 · 发布者 Yash1927

tool-snake

一个 Claude Code plugin,会在聊天旁边打开 Snake pane;Claude 每次调用工具都会向棋盘投放食物,完成后游戏暂停并用语音播报分数。

已翻译

关于这个 mod

tool-snake 是一个由 function hooks 实现的 Claude Code mod,以 plugin 形式提供。游戏 pane 会停靠在聊天旁边(其他布局则位于提示符上方),提交提示后出现。主 agent 每次调用工具都会放下一枚带有工具首字母的彩色筹码(B Bash、E Edit、R Read、W Write、G Grep/Glob;其他工具放下灰色筹码)。蛇只在 Claude 工作时移动;回合完成时游戏暂停,徽章从 LIVE 变为 DONE,toast 和语音播报会报告吃掉了多少次工具调用。会保留 session 的最高分。Hooks:prompt.submit(开始回合、打开 pane)、tool.call(添加食物)、turn.complete(停止)、ui.message(toast 和语音)。按键:方向键/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

  1. Get the mod and start Claude Code with it:
    git clone https://github.com/Yash1927/claude-code-snake
    claude --plugin-dir claude-code-snake
    
  2. Send Claude a prompt. The game pane opens.
  3. Click the game to give it the keys. Arrows or WASD steer, r restarts after a crash, Esc gives the keys back to the prompt.
  4. /snake opens 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/.

License

MIT © Yash Rastogi (@yashx26)

更多类似作品