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.
type
anthropic-skill
version
1.0
metadata
{"internal":true}
TUI Validate
Overview
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.
When to Use
Validating TUI rendering after changes
Checking that UI components display correctly
Visual regression testing for terminal applications
Verifying TUI state after specific interactions
Creating documentation screenshots with validation
You MUST verify freeze is installed before attempting capture
You MUST handle capture failures gracefully and report the error
You MUST use appropriate freeze flags for the output format
You SHOULD use --theme base16 for consistent rendering
You SHOULD set reasonable dimensions with --width and --height
2. Extraction Phase
Extract content for LLM analysis:
For text/semantic validation:
If format is text, use the captured text directly
If format is svg or png, also capture text version for content analysis
For visual validation:
Requires PNG format
Will analyze the image directly using vision capabilities
Constraints:
You MUST extract both visual and text representations when judge_mode is visual
You MUST preserve ANSI escape sequences for color validation when relevant
3. Validation Phase
Apply 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:
You MUST return a clear PASS or FAIL verdict
You MUST provide specific feedback on failures
You MUST be lenient on whitespace/formatting differences
You MUST be strict on content presence and semantic correctness
Also capture text: tmux capture-pane -pet ralph-session > /tmp/text.txt
Apply ralph-full criteria checking header, content, and footer
Save screenshot to ralph-session.svg
Report validation result
Example 3: Custom Criteria Validation
Input:
/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:
Execute command and capture: freeze --execute "cargo run --example tui_demo" -o /tmp/capture.png