No slash command · from terminal
Drives a Red-Green-Refactor state machine for TDD with terminal test watchers. Use when running TDD in watch mode with jest, vitest, cargo watch, or pytest-watch.
Ships in terminal. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
This skill teaches the protocol Claude follows AFTER a test watcher is running. For watcher setup (starting the watcher pane and managing long-running processes), see terminal:terminal-interaction. For framework-specific pass/fail/running/idle signals, read ${CLAUDE_PLUGIN_ROOT}/skills/framework-signals/SKILL.md — it is a file to read, not a skill to invoke.
The TDD loop requires a dedicated pane topology: Claude edits code in one pane while a persistent test watcher runs in a second pane. Claude reads the watcher with watch-pane and capture-pane but never restarts it.
┌──────────────────────┬────────────────────┐
│ Claude work pane │ Test Watcher │
│ (Bash / code edit) │ (helper pane) │
└──────────────────────┴────────────────────┘
The left (work) pane is where Claude runs file edits and any auxiliary commands. The right (watcher) pane runs the test framework in watch mode for the entire session. Claude only reads the watcher pane — it never sends keystrokes to it except at teardown.
The TDD protocol is a 5-state machine. Always know which state you are in before taking an action.
RED → parse failure (file:line:test name from watch-pane output)
→ edit code → save → enter WAITING
WAITING → watch-pane fires "pattern:RUNS|Running" → change detected
→ if watch-pane times out: re-save with touch, watch-pane again
→ proceed to poll for RED or GREEN
GREEN → report pass count → leave watcher running → ask user to continue
COMPILE_ERROR → fix compile error first → re-enter WAITING
IDLE → Ctrl+C watcher pane → report summary: N tests fixed
| From | Condition | To |
|---|---|---|
| RED | File saved, watch-pane detects change | WAITING |
| WAITING | watch-pane fires pass pattern | GREEN |
| WAITING | watch-pane fires fail pattern | RED |
| WAITING | watch-pane fires compiler error pattern | COMPILE_ERROR |
| COMPILE_ERROR | Compile error resolved, file saved | WAITING |
| GREEN | User asks to continue / next failing test | RED |
| GREEN | User asks to stop | IDLE |
| Any | User explicitly stops | IDLE |
COMPILE_ERROR takes priority over RED. If the watcher output shows both error[E and a test failure, fix the compile error first — the test failure may disappear once the code compiles.
After saving a file, wait for the "change detected" signal before reading results.
watch-pane with a trigger pattern for the framework's "running" or "change detected" signal first (e.g., RUNS , Running, Ding!).touch on the saved file. The file system event may have been missed.Violating this rule produces false RED readings — Claude thinks the test is still failing when the watcher simply has not rerun yet.
Use these regexes against watch-pane output (or capture-pane snapshot content) to extract the file, line, and test name from a RED state. Extract before editing so you know exactly where to make the change.
Jest/Vitest: /at Object\.<anonymous> \((.+):(\d+):(\d+)\)/
/FAIL (src\/[^\s]+\.test\.[tj]s)/
Cargo: /panicked at '[^']+', (.+):(\d+):\d+/
Pytest: /FAILED (tests\/[^\s]+)::([^\s]+)/
/File "([^"]+)", line (\d+)/
Match group 1 is the file path, match group 2 is the line number. For Jest/Vitest's FAIL line, match group 1 is the test file path. For Pytest's FAILED line, match group 1 is the module path and group 2 is the test name.
Never restart the watcher between iterations. One watcher per project.
mcp__plugin_terminal_mux__watch-pane observes non-destructively. The watcher keeps running between watch-pane calls.mcp__plugin_terminal_mux__close-pane({ slot: 1 }) — it interrupts the watcher and then kills the pane, or releases it if it was one the user had left open.This example shows the full loop from watcher start through a single RED-to-GREEN cycle.
mcp__plugin_terminal_mux__start-and-watch({
slot: 1,
command: "bun test --watch",
pattern: "Ran [0-9]+ tests? across",
mode: "medium",
timeout: 30
}) → WatchResult // confirms watcher is initialized and idle
Once the user reports a failing test or the watcher shows a fail signal, read the current state:
mcp__plugin_terminal_mux__capture-pane({ slot: 1 })
→ snapshot contains:
FAIL src/utils/format.test.ts
● formatDate › returns ISO string
Expected: "2026-01-15"
Received: "01/15/2026"
at Object.<anonymous> (src/utils/format.test.ts:12:5)
Apply the Jest/Vitest regex: file = src/utils/format.test.ts, line = 12.
Read the failing file at the extracted location:
Read({ file_path: "/absolute/path/src/utils/format.ts" })
Locate the formatDate function and correct the date format. Use Edit to apply the fix. Save (the file write is the save).
Do not read the watcher yet. Use watch-pane to block until the watcher notices the change:
mcp__plugin_terminal_mux__watch-pane({
slot: 1,
triggers: "pattern:RUNS |pattern:Running|error",
mode: "line", // notify on every new line — fast response
timeout: 15
}) → WatchResult
// If event == "timeout": re-trigger with Bash touch, then watch-pane again
// If event == "pattern:...": change detected, watcher is re-running
If watch-pane times out (no change detected), re-trigger:
Bash({ command: "touch /absolute/path/src/utils/format.ts" })
// Then call watch-pane again
mcp__plugin_terminal_mux__watch-pane({
slot: 1,
triggers: "pattern:Tests: \\d+ passed|pattern:Tests: \\d+ failed|pattern:FAIL |pattern:error\\[E|exit|error",
mode: "bunch", // notify every 10 lines — balanced for test output
timeout: 60
}) → WatchResult
// WatchResult.output contains the full test run output
// WatchResult.event tells you: "pattern:Tests: N passed", "pattern:FAIL", etc.
Report to the user:
"All 14 tests passing. formatDate now returns ISO strings. Watcher is still running.
Would you like to continue with another failing test, or stop here?"
Leave the watcher pane running. If the user is done, send Ctrl+C to the watcher pane and kill it:
mcp__plugin_terminal_mux__close-pane({ slot: 1 }) // interrupts the watcher, then releases or kills the pane
Report summary: "Session complete. 1 test fixed across 1 file."
If you need to verify the watcher is still running before calling watch-pane:
mcp__plugin_terminal_mux__pane-state({ slot: 1 })
→ { isAlive: true, foregroundCmd: "bun", waitingForInput: false }
// isAlive: false → watcher crashed; recreate it
// waitingForInput: true → watcher may be paused; check output
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
5 skills in this plugin
/framework-signalsProvides pass/fail/running/idle output markers for 15+ test, build, and deploy tools. Use when monitoring terminal output for jest, vitest, pytest, go test, cargo, webpack, vite, or vercel./terminal-interactionSlot-addressed tool patterns for interactive terminal access. Use when running interactive commands, starting dev servers, watching tests, querying databases, or working beside the user./tui-navigation-patternsProvides key sequences and navigation patterns for common TUI apps. Use when navigating vim, nano, htop, less, psql, lazygit, k9s, tig, btop, or sending keystrokes to a database shell.npx claudepluginhub madappgang/magus --plugin terminalOther plugins' skills for the same job