TU

tui-smoke-test

Automated liveness testing for terminal user interfaces.

Install

mkdir -p .claude/skills/tui-smoke-test && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/14660" && unzip -o skill.zip -d .claude/skills/tui-smoke-test && rm skill.zip

Installs to .claude/skills/tui-smoke-test

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Smoke-test a Rust TUI binary headlessly using `script` to provide a PTY, verifying the binary builds, opens an alt screen, runs the event loop, and exits cleanly on `q` without leaving the terminal in raw mode. Use after edits that touch the event loop, terminal setup/teardown, panic hook, or any rendering code path; whenever you need to verify a TUI change without an interactive terminal of your own.
404 charsno explicit “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)
Intermediate

Key capabilities

  • Build a Rust TUI binary in release mode
  • Headlessly smoke-test a TUI binary using `script`
  • Verify TUI enters and leaves alt screen
  • Confirm TUI hides and restores cursor
  • Check for clean exit and terminal state restoration
  • Diagnose common TUI test failures

How it works

The skill uses the `script` command to provide a pseudo-terminal (PTY) for a Rust TUI binary, allowing it to run headlessly and verifying its liveness and terminal cleanup.

Inputs & outputs

You give it
A Rust TUI binary that needs headless smoke testing
You get back
A log file (`/tmp/rmon-smoke.log`) and an exit code indicating liveness and cleanup status

When to use tui-smoke-test

  • Verifying TUI liveness
  • Testing terminal cleanup
  • Headless UI smoke testing

About this skill

tui-smoke-test

A TUI needs a real TTY for raw mode + alt screen. A non-interactive shell (Claude Code's Bash, CI runner) doesn't have one, so calling the binary directly will either fail or hang. The script command on macOS/Linux provides a PTY and lets us drive the binary as if from a terminal.

This skill verifies liveness and cleanup, not correctness — it answers "does it open and close without breaking the user's shell?", not "are CPU values right?".

Build first

export PATH="$HOME/.cargo/bin:$PATH" && cargo build --release

(Debug builds work but cold-start is slower, which makes timing the q send fragile.)

Run it

(sleep 1.5; printf 'q') | script -q /tmp/rmon-smoke.log target/release/resource-monitor
echo "exit: $?"

The (sleep 1.5; printf 'q') lets the sampler fire at least once (≥1 second at default 1Hz) and renders ~10 frames before sending q over the PTY.

For a binary that takes flags (e.g. --config), pass them after the binary path:

(sleep 1.5; printf 'q') | script -q /tmp/rmon-smoke.log target/release/resource-monitor --debug

What to look for

Inspect /tmp/rmon-smoke.log:

  • Exit code 0 (echoed after the pipe)
  • Log contains both [?1049h (enter alt screen) and [?1049l (leave alt screen) — proves the cleanup path ran
  • Log contains both [?25l (cursor hidden) and [?25h (cursor restored)
  • After the run, your shell still echoes input normally (raw mode is off)

A quick check:

grep -q '\[?1049h' /tmp/rmon-smoke.log && grep -q '\[?1049l' /tmp/rmon-smoke.log && echo "alt-screen pair OK"

Common failures

  • Exit code != 0 with no panic: tracing logs go to stderr → captured in the log. Read it.
  • No ?1049l in log: the cleanup didn't run — likely an early return in App::run skipped leave_terminal, or the panic hook is restoring stdout but not the alt screen.
  • Terminal stays broken after exit: the panic hook is missing or the process exited via SIGKILL (uncatchable). Confirm app::install_panic_hook is called before enter_terminal().
  • q ignored, hangs until SIGINT: should_quit regressed, or event::poll is being given Duration::ZERO and never reading the key.
  • script: command not found: macOS ships BSD script. On Linux: apt install bsdmainutils or util-linux.

Cleanup

rm -f /tmp/rmon-smoke.log

When NOT to use

  • For runtime correctness (CPU% matches top, sparklines move under load) — that needs interactive verification by the user, or a --dump-style headless mode that prints metrics as JSON.
  • For input that needs to be observed across multiple frames (typing in a search box, multi-key chord) — the simple printf pipeline can't model that. Use a real terminal for those flows.

When not to use it

  • For runtime correctness verification (e.g., CPU% values, sparkline movement)
  • For testing input that requires observation across multiple frames (e.g., typing in a search box)
  • When not working with Rust TUI binaries

Prerequisites

cargoscript

Limitations

  • The skill only verifies liveness and cleanup, not runtime correctness.
  • The `script` command is required and may need installation on Linux.
  • Cannot test complex multi-frame input interactions.

How it compares

This skill provides a method for headless testing of TUI applications by simulating a terminal environment, which is not possible by directly executing the binary in a non-interactive shell.

Compared to similar skills

tui-smoke-test side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
tui-smoke-test (this skill)03moReviewIntermediate
debug-with-valgrind27moReviewIntermediate
cts-triage14moReviewAdvanced
reproduce-reduce-regress17moNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry