Tool Defense
A tower defense above the Claude Code prompt where every enemy is one of Claude's real tool calls: Bash sends runners, an Edit or Write a slow tank, a web or MCP call a flyer, an Agent a boss. Build and upgrade towers by clicking beside the road, hold the base through Claude's turn. Zero tokens. Needs an interactive terminal with a mouse.
npx claude-code-templates@latest --skill β’β’β’β’β’β’β’β’β’β’β’β’β’β’β’β’β’β’β’β’Interactive Terminal Locked
Unlock this skill to run and inspect the interactive installation sequence.
tool-defense
A tower defense above the Claude Code prompt where every enemy is one of Claude's real tool calls: Bash sends runners, an Edit or Write a slow tank, a web or MCP call a flyer, an Agent a boss. Build and upgrade towers by clicking beside the road, hold the base through Claude's turn. Zero tokens: the mod answers every key and click itself and never asks the model anything.
Play
/defense opens the board above the prompt (/defense stop or the close button closes it).p pauses, r restarts.Every tool call Claude makes releases one enemy the moment the call starts, shaped by the tool:
| tool | enemy |
|---|---|
| Bash, PowerShell | βΆβΆ runner: fast, fragile |
| Edit, Write, NotebookEdit | ββ tank: slow, tough |
| WebFetch, WebSearch, any MCP tool | β’β£ flyer: crosses the bottom row over the towers' heads |
| Agent, Workflow | ββ boss |
| anything else (Read, Grep, Glob, ...) | βͺβͺ scout |
Between Claude's calls a quiet trickle of scouts keeps the game alive, so it is playable on its own too. A long turn with many tool calls is the real wave: build before you press Enter.
Your best score is kept in the plugin's store across sessions.
Install
npx claude-code-templates@latest --mod games/tool-defense claude
It is written to .claude/skills/tool-defense/, which Claude Code auto-loads as tool-defense@skills-dir. For one session with hot reload: claude --plugin-dir .claude/skills/tool-defense. claude plugin validate .claude/skills/tool-defense prints every event it hooks and every $ call it makes.
How it is built
hooks/register.tsx is the hooks module: it registers /defense, mounts the board on the AbovePrompt band and keeps the score in $.store. hooks/games/*.ts is the game's logic, pure functions with no drawing, and hooks/boards/*.tsx is the surface module that draws it in two-character cells on the drawing thread and takes the keys and the mouse. Written for aitmpl.com against Anthropic's published function-hooks declarations.
Requirements
claude -p, the desktop app or mobile.A clone of the genre, not affiliated with or endorsed by the original publisher.
How to Use & Getting Started
# Step 1: Initialize skill agent setup
npx skills add Tool Defense --install-production
python -m pip install -r requirements.txt
codex plugin install Tool Defense@latest
export API_KEY=secret_token_key_here
Installation Runbook & Walkthrough Locked
Unlock this skill to reveal complete step-by-step setup guides, terminal commands, configuration recipes, repository links, and interactive installation video walkthroughs.
Unlock full access to Tool Defense
Get instant access to complete setup guides, repository source code, and integration assets.
More in mod
View all mod skills βPrompt Cache Control
Prompt-cache meter above the Claude Code prompt: how many tokens each request read from, wrote to and sent past the cache, a live countdown to the cache's expiry, and what to do about it (keep going, compact or clear). The TTL follows Claude Code's own rules for your account (1 hour on a Claude subscription, 5 minutes on an API key, cloud provider or usage credits, plus the TTL variables and setting) and corrects itself from request timing. When Claude Code will compact an idle conversation by itself, it counts down to that too. cache opens a per-turn table.
Jev Model Router
Picks the model and the reasoning effort for each task with TypeSafe's Jev, a System One decision model reached either through TypeSafe's own API or the Vercel AI Gateway. Routes subagent models at agent.spawn and the main loop's effort and model at turn.step, in both directions, falling back to the engine's built-in classifier when no key is set.
Jev Skill Suggestion
Keeps the skill listing out of the context window and lets TypeSafe's Jev, a System One decision model, pick at most one skill per prompt from the skills' descriptions, the way TypeSafe's skill-suggestion cookbook does: one request ranks every skill and asks whether the prompt needs a skill at all, a second re-reads the top three with their SKILL.md and can reject them all. The winner's SKILL.md is attached to the prompt, so the skills can be hidden from the model altogether ( jev-skill-suggestion:setup makes them user-invocable-only and context counts them at 0). Falls back to the engine's built-in classifier when no key is set.