Controls, inspects, tests, and records real terminal apps via CLI or Rust/Python/JS APIs. Supports text/style locators, keyboard/mouse input, screenshots, snapshots, and live sessions.
Ships in tui-test. 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.
Use tui-test to control and test a real terminal.
| Context | Use | Reference |
|---|---|---|
| Agent or shell workflow | CLI | CLI |
| Trusted tape to GIF | Local CLI workflow | Tape |
| Python code | tui_test | Python |
| JavaScript or TypeScript | @microsoft/tui-test | JavaScript |
| Rust code | tui-test-rs | Rust |
| Common tasks | Current project language | Recipes |
Use the library that matches the project. Use the CLI when the terminal must persist across separate commands or be watched with monitor.
CLI and library sessions do not share state.
tui-test run my-app
tui-test expect text "Ready"
tui-test click text "Continue"
tui-test expect text "Done"
tui-test close
Run tui-test agent-context for exact command and option names.
For a trusted tape, use the isolated local workflow:
tui-test tape check demo.tape --json
tui-test tape run demo.tape
Both commands report the effective grid, pixel dimensions, and source-located warnings.
check does not start a child or write an output.
Tape commands ignore TUI_TEST_SESSION and do not load project configuration.
They reject explicit session and diagnostic flags; only the global --json flag applies.
Warning: Run only trusted tapes. Tapes can execute shell commands; they are not sandboxed.
See Tape for an example and the supported subset.
from tui_test import TuiTest
async with TuiTest.ephemeral() as terminal:
await terminal.run("my-app")
await terminal.get_by_text("Ready").expect()
await terminal.get_by_text("Continue").click()
import { TuiTest } from "@microsoft/tui-test";
const terminal = TuiTest.ephemeral();
try {
await terminal.run("my-app");
await terminal.getByText("Ready").expect();
await terminal.getByText("Continue").click();
} finally {
await terminal.closeQuiet();
}
Use text and style locators for visible terminal state.
save = (
terminal
.get_by_text("Settings")
.get_by_text("Save", direction="after")
.unique()
)
await save.click()
first(), last(), nth(), or unique() before an action when text repeats.get_by_style() or getByStyle() for colors and attributes.direction="within", "after", or "before" for relative matches.locations() or count() for immediate reads.wait(), expect(), or click() when the app may still be changing.| Need | Use |
|---|---|
| Visible or hidden text | Locator wait() or expect() |
| Submitted command finished | wait command, wait_command(), waitCommand() |
| Program exited | wait exit, wait_exit(), waitExit() |
| Shell prompt ready | wait ready, wait_ready(), waitReady() |
| Screen stopped changing | wait idle, wait_idle(), waitIdle() |
| Clipboard changed or matched | wait clipboard, wait_clipboard(), waitClipboard() |
| Bell fired | wait bell, wait_bell(), waitBell() |
Do not use a fixed sleep when a wait can describe the state.
open for shell commands and run for an app.left, middle, or right.Use screenshot for text, SVG, or PNG. SVG, PNG, APNG, and GIF support --background COLOR and --transparent. MP4 supports --background only. Use record for APNG, GIF, MP4, or asciinema. Configure [trace] with mode = "on-failure" and a directory for test artifacts, including agent-readable Markdown/JSON, an asciicast, and standalone HTML. Trace modes are off (default), on, and on-failure; [recording] only accepts directory.
For a failed assertion that must be understood offline, add --failure-artifacts <dir>. Agents should read failure.md first, then failure.json for exact locator/process evidence and timeline.json for retained per-cell frame metadata. Users can open failure.html directly from disk to navigate assertion checkpoints, step frames, and inspect clicked cells. Missing history is explicit; sampled frames are not a complete recording. Add --failure-artifact-recording for a continuous cast only when terminal output is safe to retain; diagnostic bundles can contain sensitive terminal text, titles, and locator operands.
What SKILL.md sets; muted values are Claude Code's defaults
/tui-test:tui-testfrom tui-test
tui-test@brain is listed by medilies/brain — review the source before installing
npx claudepluginhub medilies/brain --plugin tui-testOther plugins' skills for the same job