ClaudeMods
☰
JA
● 0 人がオンライン ・閲覧 0 回
スポンサー作品を投稿
GitHub リポジトリ · 投稿者 Yash1927

tool-snake

Claude がツールを呼び出すたびに盤面へ食べ物を置き、完了すると音声付きのスコアを示して停止する Snake pane を chat の横に開く Claude Code plugin です。

翻訳済み

この mod について

tool-snake は function hooks の plugin として実装された Claude Code mod です。ゲーム pane は chat の横に dock され(別のレイアウトではプロンプトの上)、prompt を送信すると表示されます。main agent の各ツール呼び出しで、ツール名の先頭文字が付いた色付きチップを 1 つ置きます(B Bash、E Edit、R Read、W Write、G Grep/Glob。その他のツールは灰色)。蛇が動くのは Claude の作業中だけです。turn が完了するとゲームは停止し、badge は LIVE から DONE に変わり、toast と音声の行で食べたツール呼び出し数を伝えます。session の最高スコアを保持します。Hooks は prompt.submit(turn 開始、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)

関連作品