Agent skill
TUI Puppeteering with tmux
Use when automating or testing TUI/CLI applications - provides isolated tmux sessions with scripts for input, output capture, and state verification
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/tui-puppeteering-with-tmux
SKILL.md
TUI Puppeteering
Workflow
- Write a Test Plan (required before execution)
- Start session with
tui-start - Assert-Act-Assert loop: verify state, send input, verify result
- Cleanup with
tui-stop
Test Plan (Mandatory)
Before running any commands, output a plan block:
Scripts
All scripts use hardcoded socket nori-agent-sock for isolation.
tui-start
/home/clifford/Documents/source/nori/skills/tui-puppeteering-with-tmux/tui-start <session-name> "<command>"
Creates isolated session with 120x40 geometry, runs command, disables status bar.
tui-assert
# Fixed string match (default)
/home/clifford/Documents/source/nori/skills/tui-puppeteering-with-tmux/tui-assert <session> "<text>" [timeout]
# Regex match
/home/clifford/Documents/source/nori/skills/tui-puppeteering-with-tmux/tui-assert <session> -E "<pattern>" [timeout]
Default timeout: 5s. On failure, writes <session>_failure.log.
tui-send
# Literal text (no Enter)
/home/clifford/Documents/source/nori/skills/tui-puppeteering-with-tmux/tui-send <session> "<text>"
# Special keys
/home/clifford/Documents/source/nori/skills/tui-puppeteering-with-tmux/tui-send <session> --keys "Enter"
/home/clifford/Documents/source/nori/skills/tui-puppeteering-with-tmux/tui-send <session> --keys "C-c"
Use --keys for: Enter, Escape, Tab, Space, BSpace, Up, Down, Left, Right, C-a to C-z, F1-F12.
GOOD: Add delay after Escape
$SCRIPTS/tui-send "$SESSION" --keys "Escape" sleep 0.2 $SCRIPTS/tui-send "$SESSION" --keys "j"
</warning>
### tui-capture
```bash
/home/clifford/Documents/source/nori/skills/tui-puppeteering-with-tmux/tui-capture <session>
Returns current screen content. Use for debugging mid-flow.
Optional flags (rarely needed):
| Flag | Use Case |
|---|---|
-e |
Preserve ANSI color codes (for testing colored output) |
-S N |
Include N lines of scrollback history |
-a |
Capture inactive buffer instead of active |
tui-stop
/home/clifford/Documents/source/nori/skills/tui-puppeteering-with-tmux/tui-stop <session>
Kills session and cleans up. Always call when done, even on failure.
tmux-isolated
For any direct tmux commands (cleanup, advanced usage):
/home/clifford/Documents/source/nori/skills/tui-puppeteering-with-tmux/tmux-isolated <tmux-args>
Assert-Act-Assert Loop
SCRIPTS="/home/clifford/Documents/source/nori/skills/tui-puppeteering-with-tmux"
SESSION="test-feature"
# Start
$SCRIPTS/tui-start "$SESSION" "./my-app"
# ASSERT initial state
$SCRIPTS/tui-assert "$SESSION" "Welcome" 10
# ACT
$SCRIPTS/tui-send "$SESSION" "hello"
$SCRIPTS/tui-send "$SESSION" --keys "Enter"
# ASSERT result
$SCRIPTS/tui-assert "$SESSION" "Response:" 10
# Cleanup
$SCRIPTS/tui-stop "$SESSION"
Debugging Failures
On assertion failure, check the auto-generated log:
cat <session-name>_failure.log
For manual inspection mid-test:
$SCRIPTS/tui-capture "$SESSION"
Safety
Verification
Run the test suite to verify scripts work:
bash /home/clifford/Documents/source/nori/skills/tui-puppeteering-with-tmux/test_tui_scripts.sh
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?