Validates the Coop TUI by capturing output from a tmux session using freeze and applying LLM-as-judge semantic validation. Supports text and visual (PNG/SVG) validation modes.
Validates the Coop TUI by capturing output from a tmux session using freeze and applying LLM-as-judge semantic validation. Supports text and visual (PNG/SVG) validation modes.
type
anthropic-skill
version
1.0
TUI Validate
Overview
This skill validates the Coop TUI by launching it in a tmux session, sending input, capturing the rendered output with freeze, and using LLM-as-judge for semantic validation.
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
After making changes to TUI rendering, gateway, or provider code
To verify the full end-to-end flow: user input → provider call → response display
To check tool call activity is visible in the TUI
Visual regression testing for the terminal interface
Verifying error handling displays correctly
Prerequisites
Required:
freeze CLI tool installed (charmbracelet/freeze)
tmux for interactive TUI capture
The coop binary built (cargo build --release)
Verification:
freeze --help | head -1
tmux -V
ls target/release/coop
Parameters
target (required): What to validate. One of:
tmux:<session> — Capture a live tmux session pane
command:<cmd> — Execute a command and capture output
buffer:<text> — Raw text/ANSI to validate directly
criteria (required): Validation criteria. Can be:
A predefined criteria name (see Built-in Criteria below)
A custom criteria string describing what to check
output_format (optional, default: "svg"): Screenshot format
svg — Vector format, good for documentation
png — Raster format, good for visual diff
text — Text-only extraction, fastest
save_screenshot (optional, default: false): Save screenshot to working directory
You MUST verify freeze is installed before attempting capture
You MUST handle capture failures gracefully and report the error
You SHOULD use --theme base16 for consistent rendering
You SHOULD set reasonable dimensions with --width 120
4. Extraction Phase
Extract content for LLM analysis:
If format is text, use the captured text directly
If format is svg or png, also capture a text version for content analysis
For visual validation, analyze the image directly using vision capabilities
5. Validation Phase
Apply LLM-as-judge with the appropriate criteria:
Semantic Validation:
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/whitespace but strict on:
- Required content presence
- Logical layout and hierarchy
- No rendering errors or artifacts
Visual Validation (with PNG 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
Capture pane (after sending a message that triggers tools)
Check for tool activity indicators ([calling tool: ...], [executing: ...])
Save screenshot for debugging
Report result
Example 4: Custom Criteria
/tui-validate target:tmux:coop-test criteria:"Shows the agent name 'reid' in the UI and displays at least one assistant response" judge_mode:strict
Example 5: Quick Buffer Validation
/tui-validate target:buffer:"Connected to reid (claude-sonnet-4-20250514). Type a message or /quit to exit." criteria:coop-connected output_format:text
Typical Full Workflow
A complete TUI validation session typically looks like: