ワンクリックで
tui-dev
Develop, test, and validate Terminal User Interface applications using tmux as your "headless browser" for terminals.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Develop, test, and validate Terminal User Interface applications using tmux as your "headless browser" for terminals.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Structured procedure to locate the root cause of a confirmed bug. Uses keyword search → focused reading → call-graph tracing. Outputs a specific file + line + hypothesis.
Step-by-step procedure to reproduce a bug. Use this FIRST before trying to fix anything. Produces a minimal script that demonstrates the failure.
AgentM SDK development guide — manifest-as-agent-unit philosophy, SDK programmatic invocation, dynamic workflow orchestration, atom contract, Operations abstraction, event system, service communication, CLI conventions, scenario authoring, logging, structured output, and config resolution. Use whenever writing, editing, or reviewing code under src/agentm/ (atoms, core, gateway), contrib/scenarios/ (manifests), or contrib/extensions/ (workspace-member atoms). Also trigger when creating new atoms, modifying MANIFEST declarations, registering tools or events, touching FileOperations / BashOperations / ResourceWriter, writing CLI subcommands, configuring model profiles, spawning child sessions, building multi-agent orchestrators, writing workflow scripts, or when a code change looks like it might bypass the SDK's existing abstractions. If you catch yourself about to write raw os.stat / open() / subprocess.run in an atom, importing openai/anthropic directly instead of going through the provider layer, or shelling
Guide for adding new benchmarks to the agentm-eval framework and running experiments through the unified `agentm eval` CLI. Covers the adapter interface, experiment lifecycle, result schema, ClickHouse linking, and output conventions. Use whenever creating a new eval adapter, modifying an existing benchmark integration, writing code under contrib/evals/src/agentm_eval/, discussing experiment management, or when the user mentions "add a benchmark", "new eval", "接入评估", "新benchmark", "实验管理", "eval adapter". Also trigger when reviewing eval-related code or debugging experiment output structure.
How to write workflow scripts that orchestrate multiple agents in AgentM. Covers agent(), parallel(), pipeline(), phase(), return values, atom_config data passing, and the journal-based resume / invalidation / partial re-run mechanism (workflow_lineage, workflow_invalidate). Trigger when writing a workflow script, choosing an orchestration pattern, recovering from a wrong node result, or when the user says 编排 / workflow / 多 agent / 并行 / 扇出 / 调度 / 写个 workflow / 失效 / 部分重跑 / 重算. Also trigger when you catch yourself building prompts inside a workflow script — pass data via atom_config instead and let the agent build its own prompt.
Analyze agentm session traces using `agentm trace` atomic commands. Use when inspecting trajectories, token economics, tool calls, or aggregating stats across a trace tree (parent + child sessions). Compose atomic commands via shell pipes — never parse OTLP JSONL directly.
| name | tui-dev |
| description | Develop, test, and validate Terminal User Interface applications using tmux as your "headless browser" for terminals. |
TUI development presents unique challenges for AI agents: the output is visual and not easily parseable. This skill enables a visual verification loop:
tmux serves as the equivalent of a headless browser for terminal applications—it provides a controlled, scriptable environment to run and interact with TUIs without requiring a physical terminal.
# Install freeze (Charm's terminal screenshot tool)
brew install charmbracelet/tap/freeze
# Verify tmux is available
which tmux
# Create a detached session with specific dimensions
tmux new-session -d -s <session-name> -x <cols> -y <rows> '<command>'
# List sessions
tmux list-sessions
# Attach to session (for debugging)
tmux attach-session -t <session-name>
# Kill session
tmux kill-session -t <session-name>
# Kill all sessions (cleanup)
tmux kill-server
Set these environment variables for proper TUI rendering:
TERM=xterm-256color # 256 color support
COLORTERM=truecolor # 24-bit color support
LANG=en_US.UTF-8 # Unicode support
LC_ALL=en_US.UTF-8
# Full example
tmux new-session -d -s tui -x 120 -y 40 \
'TERM=xterm-256color COLORTERM=truecolor ./my-tui-app'
| Use Case | Size | Flags |
|---|---|---|
| Standard TUI | 80x24 | -x 80 -y 24 |
| Wide tables/dashboards | 120x40 | -x 120 -y 40 |
| Full-screen TUI | 160x50 | -x 160 -y 50 |
| Mobile/narrow testing | 60x20 | -x 60 -y 20 |
| Documentation screenshots | 100x30 | -x 100 -y 30 |
# Run a binary
tmux new-session -d -s app -x 80 -y 24 './my-tui-app'
# With build step (Rust)
cargo build --release && \
tmux new-session -d -s app -x 80 -y 24 './target/release/my-tui'
# With arguments
tmux new-session -d -s app -x 80 -y 24 './my-app --config config.toml'
# From specific directory
tmux new-session -d -s app -x 80 -y 24 -c /path/to/project './app'
# Rust (ratatui, crossterm)
cargo run --release
# Go (bubbletea, tview)
go run .
# Python (textual, rich)
python -m myapp
# Node.js (blessed, ink)
npx tsx ./src/app.tsx
# Fixed delay (simple)
sleep 2
# Poll for specific content (more reliable)
for i in {1..30}; do
tmux capture-pane -t app -p | grep -q "Ready" && break
sleep 0.1
done
# Wait for any content to appear
until tmux capture-pane -t app -p 2>/dev/null | grep -q .; do
sleep 0.1
done
# Send literal text
tmux send-keys -t <target> 'text'
# Send special keys
tmux send-keys -t app Enter
tmux send-keys -t app Escape
tmux send-keys -t app Tab
tmux send-keys -t app Space
tmux send-keys -t app BSpace # Backspace
| Action | tmux Key |
|---|---|
| Enter/Return | Enter |
| Escape | Escape |
| Tab | Tab |
| Shift+Tab | S-Tab or BTab |
| Backspace | BSpace |
| Delete | DC |
| Home | Home |
| End | End |
| Page Up | PgUp |
| Page Down | PgDn |
| Arrow keys | Up, Down, Left, Right |
| Function keys | F1 through F12 |
| Ctrl+key | C-<key> (e.g., C-c, C-a) |
| Alt+key | M-<key> (e.g., M-x) |
| Ctrl+Alt+key | C-M-<key> |
# Bad: no delay
tmux send-keys -t app 'j' && tmux send-keys -t app Enter
# Good: small delay for TUI to process
tmux send-keys -t app 'j'
sleep 0.1
tmux send-keys -t app Enter
# Better: wait for expected state
tmux send-keys -t app 'j'
until tmux capture-pane -t app -p | grep -q "item 2"; do sleep 0.05; done
tmux send-keys -t app Enter
# Navigate a menu
tmux send-keys -t app Down Down Enter
sleep 0.2
# Type into an input field
tmux send-keys -t app 'my search query' Enter
# Open command palette
tmux send-keys -t app C-p
sleep 0.1
tmux send-keys -t app 'command name' Enter
# Scroll through content
for i in {1..10}; do
tmux send-keys -t app Down
sleep 0.05
done
# Basic capture with ANSI colors
tmux capture-pane -t <target> -p -e > output.txt
# Capture specific line range
tmux capture-pane -t app -p -e -S 0 -E 20 > output.txt
# Include scrollback history
tmux capture-pane -t app -p -e -S -1000 > output.txt
| Flag | Purpose |
|---|---|
-p | Print to stdout (instead of tmux buffer) |
-e | Include ANSI escape sequences (colors) |
-S n | Start line (negative = scrollback) |
-E n | End line |
-J | Join wrapped lines |
# Search for content
tmux capture-pane -t app -p | grep -q "Error" && echo "Error found!"
# Check for UI element
if tmux capture-pane -t app -p | grep -q "Save successful"; then
echo "Save completed"
fi
# Get specific line
tmux capture-pane -t app -p | sed -n '5p'
# Count occurrences
tmux capture-pane -t app -p | grep -c "item"
# Capture terminal content
tmux capture-pane -t app -p -e > .agent/tui-dev/capture.txt
# Basic PNG
freeze .agent/tui-dev/capture.txt -o screenshot.png
# Styled screenshot
freeze .agent/tui-dev/capture.txt -o screenshot.png \
--theme dracula \
--padding 20 \
--margin 20 \
--border.radius 8 \
--shadow.blur 20 \
--font.family "JetBrains Mono" \
--font.size 14 \
--window
# SVG output (scalable)
freeze .agent/tui-dev/capture.txt -o screenshot.svg
| Option | Description | Example |
|---|---|---|
--theme | Color theme | dracula, monokai, nord |
--padding | Internal padding (px) | 20 |
--margin | External margin (px) | 20 |
--border.radius | Corner radius | 8 |
--shadow.blur | Shadow blur radius | 20 |
--font.family | Font name | "JetBrains Mono" |
--font.size | Font size | 14 |
--window | Show window chrome | (flag) |
-o | Output file | .png, .svg, .webp |
# Capture "before" state
tmux capture-pane -t app -p > .agent/tui-dev/before.txt
# Make interaction
tmux send-keys -t app Enter
sleep 0.5
# Capture "after" state
tmux capture-pane -t app -p > .agent/tui-dev/after.txt
# Compare
diff .agent/tui-dev/before.txt .agent/tui-dev/after.txt
┌──────────────────────────────────────────────────────────┐
│ TUI Development Loop │
├──────────────────────────────────────────────────────────┤
│ │
│ ┌────────┐ ┌────────┐ ┌────────┐ │
│ │ 1.Edit │───▶│2.Build │───▶│ 3.Run │ │
│ │ Code │ │ App │ │in tmux │ │
│ └────────┘ └────────┘ └────────┘ │
│ ▲ │ │
│ │ ▼ │
│ ┌────────┐ ┌────────┐ ┌────────┐ │
│ │ 6.Fix │◀───│5.Verify│◀───│4.Capture│ │
│ │ Issues │ │ State │ │ Output │ │
│ └────────┘ └────────┘ └────────┘ │
│ │
└──────────────────────────────────────────────────────────┘
# === 1. Edit code ===
# (Make code changes with Edit tool)
# === 2. Build ===
cargo build --release
if [ $? -ne 0 ]; then
echo "Build failed"
exit 1
fi
# === 3. Start TUI ===
tmux kill-session -t tui 2>/dev/null || true
tmux new-session -d -s tui -x 120 -y 40 \
'TERM=xterm-256color ./target/release/my-tui'
sleep 2
# === 4. Capture state ===
mkdir -p .agent/tui-dev
tmux capture-pane -t tui -p -e > .agent/tui-dev/state.txt
# === 5. Verify ===
# Check for expected content
if ! grep -q "Welcome" .agent/tui-dev/state.txt; then
echo "ERROR: Welcome message not displayed"
fi
# Check for errors
if grep -q "Error\|panic\|crash" .agent/tui-dev/state.txt; then
echo "ERROR: Crash detected"
fi
# === 6. Interactive verification ===
tmux send-keys -t tui Tab
sleep 0.2
tmux send-keys -t tui Enter
sleep 0.5
tmux capture-pane -t tui -p -e > .agent/tui-dev/state-after.txt
if grep -q "Feature Active" .agent/tui-dev/state-after.txt; then
echo "SUCCESS: Feature working"
fi
# === Cleanup ===
tmux kill-session -t tui
# Assert content present
assert_content() {
local pattern="$1"
local target="${2:-tui}"
if ! tmux capture-pane -t "$target" -p | grep -q "$pattern"; then
echo "FAIL: Expected '$pattern' not found"
return 1
fi
echo "PASS: Found '$pattern'"
}
# Assert content absent
assert_no_content() {
local pattern="$1"
local target="${2:-tui}"
if tmux capture-pane -t "$target" -p | grep -q "$pattern"; then
echo "FAIL: Unexpected '$pattern' found"
return 1
fi
echo "PASS: '$pattern' correctly absent"
}
# Wait for content with timeout
wait_for_content() {
local pattern="$1"
local timeout="${2:-30}"
local target="${3:-tui}"
for i in $(seq 1 $timeout); do
if tmux capture-pane -t "$target" -p | grep -q "$pattern"; then
return 0
fi
sleep 0.1
done
echo "TIMEOUT: '$pattern' not found after ${timeout}00ms"
return 1
}
# Save known-good state as golden file
tmux capture-pane -t tui -p > .agent/tui-dev/golden/main-screen.txt
# Compare current state against golden
tmux capture-pane -t tui -p > .agent/tui-dev/current.txt
# Strip ANSI codes for content comparison
strip_ansi() {
sed 's/\x1b\[[0-9;]*m//g'
}
diff <(strip_ansi < .agent/tui-dev/golden/main-screen.txt) \
<(strip_ansi < .agent/tui-dev/current.txt)
| Problem | Cause | Solution |
|---|---|---|
| App exits immediately | Missing TTY | Run inside tmux session |
| No colors in capture | Missing -e flag | Add -e to capture-pane |
| Wrong dimensions | Not set explicitly | Use -x and -y flags |
| Keys not registering | Too fast | Add sleep 0.1 between sends |
| Unicode garbled | Locale issue | Set LANG=en_US.UTF-8 |
| App unresponsive | Wrong TERM | Try TERM=xterm-256color |
# Check TERM value
tmux send-keys -t app 'echo $TERM' Enter
sleep 0.5
tmux capture-pane -t app -p | tail -2
# Verify color support
tmux send-keys -t app 'tput colors' Enter
sleep 0.5
tmux capture-pane -t app -p | tail -2
# Check for ANSI codes in capture
cat -v .agent/tui-dev/capture.txt | head -10
# Should show ^[[38;5;... sequences
# Verify session dimensions
tmux display-message -t app -p '#{window_width}x#{window_height}'
# Check if session exists
tmux has-session -t tui 2>/dev/null
echo $? # 0 = exists, 1 = gone
# Check running process
tmux list-panes -t tui -F '#{pane_pid} #{pane_current_command}'
# Capture crash output before cleanup
tmux capture-pane -t tui -p -e -S -1000 > .agent/tui-dev/crash-log.txt
Use .agent/tui-dev/ for TUI development artifacts:
.agent/tui-dev/
├── captures/ # Raw terminal captures
│ ├── current.txt
│ └── before.txt
├── screenshots/ # Generated images
│ └── feature.png
├── golden/ # Reference states for regression
│ └── main-screen.txt
└── logs/ # Build/crash logs
└── crash-log.txt
# Start TUI in tmux
tmux new-session -d -s tui -x 120 -y 40 'TERM=xterm-256color ./app'
# Wait for startup
sleep 2
# Send keystrokes
tmux send-keys -t tui Down Enter
# Capture output
tmux capture-pane -t tui -p -e > .agent/tui-dev/output.txt
# Take screenshot
freeze .agent/tui-dev/output.txt -o screenshot.png --theme nord
# Check for content
tmux capture-pane -t tui -p | grep -q "Success" && echo "OK"
# Cleanup
tmux kill-session -t tui