with one click
tui-validate
// Validates Terminal User Interface (TUI) output using freeze for screenshot capture and LLM-as-judge for semantic validation. Supports both visual (PNG/SVG) and text-based validation modes.
// Validates Terminal User Interface (TUI) output using freeze for screenshot capture and LLM-as-judge for semantic validation. Supports both visual (PNG/SVG) and text-based validation modes.
[HINT] Download the complete skill directory including SKILL.md and all related files
| name | tui-validate |
| description | Validates Terminal User Interface (TUI) output using freeze for screenshot capture and LLM-as-judge for semantic validation. Supports both visual (PNG/SVG) and text-based validation modes. |
| type | anthropic-skill |
| version | 1.0 |
| metadata | {"internal":true} |
This skill validates Terminal User Interface (TUI) applications by capturing their output and using LLM-as-judge for semantic validation. It leverages freeze from Charmbracelet for high-fidelity terminal screenshots and provides structured validation criteria.
Philosophy: Rather than brittle string matching, this skill uses semantic understanding to validate that TUI output "looks right" - checking layout, content presence, and visual hierarchy without breaking on minor formatting changes.
Required:
freeze CLI tool installed (brew install charmbracelet/tap/freeze)tmux for interactive TUI capture (optional, for live applications)Verification:
# Check freeze is installed
freeze --version
# Check tmux is installed (for interactive capture)
tmux -V
target (required): What to validate. One of:
file:<path> - ANSI output file to validatecommand:<cmd> - Command to execute and capturetmux:<session> - Live tmux session to capturebuffer:<text> - Raw text/ANSI to validatecriteria (required): Validation criteria. Can be:
output_format (optional, default: "svg"): Screenshot format
svg - Vector format, best for documentationpng - Raster format, best for visual difftext - Text-only extraction, fastestsave_screenshot (optional, default: false): Whether to save the screenshot
{target_name}.{format} in current directoryjudge_mode (optional, default: "semantic"): Validation approach
semantic - LLM judges based on meaning and layoutstrict - Also checks exact content presencevisual - Requires PNG, checks visual appearanceralph-headerValidates Ralph TUI header component:
[iter N] or [iter N/M] formatMM:SS formatā¶ auto or āø paused)[SCROLL]idle: Nsralph-footerValidates Ralph TUI footer component:
ā active, ⯠idle, or ā done)ralph-fullValidates complete Ralph TUI layout:
tui-basicGeneric TUI validation:
Capture TUI output based on target type:
For file targets:
freeze {file_path} -o /tmp/tui-capture.{format}
For command targets:
freeze --execute "{command}" -o /tmp/tui-capture.{format}
For tmux targets:
tmux capture-pane -pet {session} | freeze -o /tmp/tui-capture.{format}
For buffer targets:
echo "{buffer}" | freeze -o /tmp/tui-capture.{format}
Constraints:
--theme base16 for consistent rendering--width and --heightExtract content for LLM analysis:
For text/semantic validation:
text, use the captured text directlysvg or png, also capture text version for content analysisFor visual validation:
Constraints:
visualApply LLM-as-judge with the appropriate criteria:
Semantic Validation Prompt Template:
Analyze this terminal UI output and determine if it meets the following criteria:
CRITERIA:
{criteria_description}
TERMINAL OUTPUT:
{captured_text}
Evaluate each criterion and provide:
1. PASS or FAIL for each requirement
2. Brief explanation for any failures
3. Overall verdict: PASS or FAIL
Be lenient on exact formatting but strict on:
- Required content presence
- Logical layout and hierarchy
- No rendering errors or artifacts
Visual Validation Prompt Template (with image):
Examine this terminal screenshot and validate:
CRITERIA:
{criteria_description}
Check for:
1. Visual hierarchy and layout
2. Color coding correctness
3. No rendering artifacts or broken characters
4. Proper alignment and spacing
Verdict: PASS or FAIL with explanation
Constraints:
Report validation results:
On PASS:
ā
TUI Validation PASSED
Criteria: {criteria_name}
Target: {target}
Mode: {judge_mode}
All requirements satisfied.
{optional_notes}
On FAIL:
ā TUI Validation FAILED
Criteria: {criteria_name}
Target: {target}
Mode: {judge_mode}
Issues found:
- {issue_1}
- {issue_2}
Screenshot saved: {path_if_saved}
Constraints:
Input:
/tui-validate file:test_output.txt criteria:ralph-header
Process:
test_output.txt containing ANSI outputfreeze test_output.txt -o /tmp/capture.svgralph-header criteria via LLM judgeInput:
/tui-validate tmux:ralph-session criteria:ralph-full save_screenshot:true
Process:
tmux capture-pane -pet ralph-session | freeze -o ralph-session.svgtmux capture-pane -pet ralph-session > /tmp/text.txtralph-full criteria checking header, content, and footerralph-session.svgInput:
/tui-validate command:"cargo run --example tui_demo" criteria:"Shows a bordered box with 'Hello World' text centered inside" output_format:png judge_mode:visual
Process:
freeze --execute "cargo run --example tui_demo" -o /tmp/capture.pngInput:
/tui-validate buffer:"[iter 3/10] 04:32 | šØ Builder | ā¶ auto" criteria:ralph-header output_format:text
Process:
name: ralph-header
description: Ralph TUI header component validation
requirements:
- name: iteration_counter
description: Shows iteration in [iter N] or [iter N/M] format
required: true
pattern: '\[iter \d+(/\d+)?\]'
- name: elapsed_time
description: Shows elapsed time in MM:SS format
required: true
pattern: '\d{2}:\d{2}'
- name: hat_indicator
description: Shows current hat with emoji prefix
required: true
examples: ["šØ Builder", "š Planner", "šÆ Executor"]
- name: mode_indicator
description: Shows loop mode status
required: true
values: ["ā¶ auto", "āø paused"]
- name: scroll_indicator
description: Shows [SCROLL] when in scroll mode
required: false
pattern: '\[SCROLL\]'
- name: idle_countdown
description: Shows idle timeout when present
required: false
pattern: 'idle: \d+s'
name: ralph-footer
description: Ralph TUI footer component validation
requirements:
- name: activity_indicator
description: Shows current activity state
required: true
values: ["ā active", "⯠idle", "ā done"]
- name: event_topic
description: Shows last event topic
required: false
examples: ["task.start", "build.done", "loop.terminate"]
- name: search_display
description: Shows search query and match count when searching
required: false
pattern: 'Search: .+ \d+/\d+'
name: ralph-full
description: Complete Ralph TUI layout validation
requirements:
- name: header_section
description: Header at top with iteration, time, hat, and mode
required: true
references: ralph-header
- name: content_section
description: Main terminal content area
required: true
checks:
- Has visible content or is ready for content
- Properly bounded between header and footer
- name: footer_section
description: Footer at bottom with activity status
required: true
references: ralph-footer
- name: visual_hierarchy
description: Clear visual separation between sections
required: true
checks:
- Borders or spacing between sections
- Consistent width across sections
# macOS
brew install charmbracelet/tap/freeze
# Linux (via Go)
go install github.com/charmbracelet/freeze@latest
# Verify installation
freeze --version
tmux list-sessionstmux list-panes -t {session}tmux capture-pane -pet {session}:{pane}--theme flag for consistent colorsstrict mode for exact matching requirementssemantic mode for layout/presence checkingThis skill can be integrated into test suites:
// In tests/tui_validation.rs
#[test]
#[ignore] // Run with: cargo test -- --ignored
fn validate_header_rendering() {
// 1. Render header to buffer
let output = render_header_to_string(&test_state);
// 2. Save to temp file
std::fs::write("/tmp/header_test.txt", &output).unwrap();
// 3. Run tui-validate skill (via CLI or programmatic)
// /tui-validate file:/tmp/header_test.txt criteria:ralph-header
// 4. Assert validation passed
}