visual-qa
Rigorous visual QA for any UI you built or changed, across BOTH web/page UIs and TUI/terminal UIs. MUST USE after building or changing any UI to verify it visually before declaring it done. Captures objective reference evidence with a bundled diff script (image-diff for screenshots, tui-check for terminal captures), then runs two parallel read-only oracle passes (design-system and functional integrity; visual fidelity and CJK precision) and synthesizes one good/bad verdict. Triggers: visual QA, visual regression, screenshot diff, pixel diff, image comparison, UI looks wrong, design system check, is this really a design system or just an image, alpha channel breakage, responsive check, CJK text, Korean/Japanese/Chinese text clipping, baseline drop, glyph drop, TUI alignment, terminal UI, tmux capture, box-drawing border misalignment, wide-character column drift. Use it even when the user does not say visual QA but asks whether a page, component, or terminal layout looks right.
- License 许可
- MIT
- 所属仓库
- younghai/lazyz
- 最近更新
- 2026-11-01
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- visual-qa
- description
- Rigorous visual QA for any UI you built or changed, across BOTH web/page UIs and TUI/terminal UIs. MUST USE after building or changing any UI to verify it visually before declaring it done. Captures objective reference evidence with a bundled diff script (image-diff for screenshots, tui-check for terminal captures), then runs two parallel read-only oracle passes (design-system and functional integrity; visual fidelity and CJK precision) and synthesizes one good/bad verdict. Triggers: visual QA, visual regression, screenshot diff, pixel diff, image comparison, UI looks wrong, design system check, is this really a design system or just an image, alpha channel breakage, responsive check, CJK text, Korean/Japanese/Chinese text clipping, baseline drop, glyph drop, TUI alignment, terminal UI, tmux capture, box-drawing border misalignment, wide-character column drift. Use it even when the user does not say visual QA but asks whether a page, component, or terminal layout looks right.
02 资源文件 10
- 参考文档agents/openai.yaml47 B
- 脚本scripts/ansi.ts499 B
- 脚本scripts/cli.ts2.4 KB
- 脚本scripts/east-asian-width.ts3.0 KB
- 脚本scripts/image-diff.ts3.7 KB
- 脚本scripts/png-crc.ts682 B
- 脚本scripts/png-decode.ts5.1 KB
- 脚本scripts/png-synth.ts1.6 KB
- 脚本scripts/tui-grid.ts2.6 KB
- 脚本scripts/types.ts1.3 KB
03 SKILL.md 正文
ZCode Harness Tool Compatibility
This skill was ported from the Codex/OpenCode OmO harness. ZCode does not provide call_omo_agent, task, background_output, team_*, multi_agent_v1.spawn_agent, or any Codex-only multi-agent tools. Translate every such example to ZCode's native tools:
| Codex/OpenCode example | ZCode tool to use |
|---|---|
call_omo_agent(subagent_type="explore", ...) |
Agent tool with subagent_type="Explore" and a self-contained prompt |
call_omo_agent(subagent_type="librarian", ...) |
Agent tool with subagent_type="Explore" (research-focused prompt) |
task(subagent_type="plan", ...) |
Agent tool with subagent_type="general-purpose" (planning-focused prompt) |
task(subagent_type="oracle", ...) for final verification |
Agent tool with subagent_type="general-purpose" (rigorous-review prompt) |
task(category="...", ...) for implementation or QA |
Agent tool with subagent_type="general-purpose" |
multi_agent_v1.spawn_agent(...) / spawn_agent(...) |
Agent tool with subagent_type and a self-contained prompt |
background_output(task_id="...") |
Only unstructured read-only research may use background mode; its completion arrives as a parent task notification, not a plugin hook |
multi_agent_v1.wait_agent(...) mailbox signals |
No equivalent plugin tool; use returned foreground Agent results or the host's background research notifications |
team_*(...) |
ZCode has no native team-of-threads API. Approximate with multiple parallel Agent calls (one per member) coordinated by the parent, or fall back to sequential subagents when isolation is unclear |
ZCode v3.14.3 loads enabled plugin agents from agents/. Prefer namespaced roles such as lazyz:explorer and lazyz:lazycodex-executor; unambiguous bare names also work. Include all task context and ownership in the self-contained prompt. Roles inherit the user's active model; do not force an obsolete provider ID or copy Codex model/effort fields. If an older host lacks a role, describe it inline using the appropriate built-in agent.
Before every governed Agent or Task call, read the Dispatch schema in the installed start-work skill and prepend exactly one LAZYCODEX_DISPATCH_V1 JSON line. General-purpose and known executor calls require this envelope; read-only Explore calls may remain unstructured. Use the same taskId across retries with a fresh runId, unchanged criteria, role, phase and budget. Planning/document work uses writer, code work implementer, review reviewer, and testing qa. Never rename a task to bypass its exhausted budget.
Governed calls must use run_in_background: false (or omit it). A background launch is not a completed result and has no matching plugin completion hook. Multiple independent foreground calls may be requested together; do not assume the host executes them concurrently. Read-only background research without a dispatch contract remains available.
Require each governed child to write the matching ReceiptV1 with current source identity, criterion invocations, zero exit codes and hashed regular artifacts, then return EVIDENCE_RECORDED; final-phase work requires FINAL_EVIDENCE_RECORDED. PostToolUse records failed evidence; Stop prevents unresolved completion while budget remains. An exhausted budget requires a blocker handoff, not an unsupported completion claim.
User authorization and verification policy take precedence over generic workflow instructions below. Do not auto-commit, push, merge, delete, deploy, install tools, call paid services, or run checks prohibited by the user. Record skipped checks honestly; do not fabricate a passing receipt. A task requiring a verified receipt remains unverified if the necessary checks are prohibited. ZCode Stop can continue at most three consecutive times, not indefinitely. Native Goal Mode, Memory and Wiki are host features; no callable API is assumed.
For work likely to take long, prefer multiple concurrent Agent calls in a single message over one giant blocking call. Treat each child's final message as the deliverable: if it lacks the required output, ack-only, or stops without producing evidence, fall back to a smaller re-scoped Agent call with the missing deliverable made explicit in the prompt.
Visual QA - Dual-Oracle Web and TUI Verification
Verify a rendered UI against intent using objective script evidence plus two parallel read-only oracle passes, then synthesize one good/bad verdict. The script numbers focus the reviewers. They are not the verdict.
Purpose and when to use
- Use after you build or change any UI, before calling it done. Covers web/page UIs and TUI/terminal UIs.
- Use when output must match a mock, a baseline, or a stated design intent; when you suspect a regression; when CJK (Korean/Japanese/Chinese) text may clip or misalign; when a claimed design system might actually be a flat image; when a terminal layout may overflow or its borders may break.
- Skip when there is no rendered surface (pure backend or library logic with no visual or terminal output). For broad post-implementation review use review-work; this skill is the visual specialist.
In the commands below, $SKILL_DIR is this skill's own directory (the folder containing this SKILL.md). The bundled script lives at scripts/cli.ts inside it.
Step 1 - Detect the surface
- Web/page UI: renders in a browser (HTML/CSS/JS, components, canvas, SVG). Evidence is screenshots.
- TUI/terminal UI: renders as text in a terminal (box-drawing, panes, status lines, REPL/TUI apps). Evidence is terminal captures.
If the change touches both, run both capture tracks and feed both into the passes.
Step 2 - Capture objective reference evidence
Web
- Capture a REFERENCE image: the user's mock/target, or a known-good baseline. Save as PNG.
- Capture the ACTUAL rendered screenshot at the same viewport size using the project's browser tooling (the playwright, agent-browser, or dev-browser skill). Save as PNG.
- Run the diff and keep the JSON:
bun "$SKILL_DIR/scripts/cli.ts" image-diff <reference.png> <actual.png>
Key fields: dimensionsMatch, diffRatio (0..1), similarityScore (0..100), alphaChannelIntact, hotspots[] (grid regions ranked by diffRatio).
TUI
- Capture plain text and an ANSI-preserving copy:
tmux capture-pane -p > capture.txt
tmux capture-pane -e -p > capture-ansi.txt
- Run the check with the REAL terminal width and keep the JSON:
bun "$SKILL_DIR/scripts/cli.ts" tui-check capture.txt --cols <N>
Key fields: maxWidth, overflowLines[], borderMisaligned, wideCharColumns[], hasAnsi.
This JSON (diff ratio, similarity score, hotspots or overflow lines, border alignment, wide-char columns, alpha) is REFERENCE evidence to aim the reviewers. It is not the verdict by itself.
Step 3 - Dispatch two read-only QA passes in parallel
Send BOTH task calls in a single message so they run concurrently. Each oracle is read-only: it reviews and reports, it cannot modify files. Each returns PASS, REVISE, or FAIL with concrete, located findings.
Paste evidence directly into each prompt, because the oracle works only from the prompt text: source code, the plain-text TUI captures, the script JSON, and the screenshot paths plus your described observations for web. The two passes differ in depth by charter, not by any model or effort setting, which cannot be pinned per call.
Pass A - Design-system and functional integrity (deeper, strict)
task(subagent_type="oracle",
run_in_background=true,
load_skills=[],
description="Visual QA pass A: design-system and functional integrity",
prompt="""
REVIEW TYPE: DESIGN-SYSTEM AND FUNCTIONAL INTEGRITY (read-only)
TIER INTENT: Treat this as the deeper, stricter pass. Reason exhaustively before concluding. Assume a plausible-looking surface may be faked until the source proves otherwise.
INTENT:
{What the user asked for, the mock or baseline, and the constraints.}
SURFACE: {web | tui | both}
SOURCE CODE:
{Full source of the UI: components, styles/tokens, layout, render code. Include neighboring files that show existing patterns.}
CAPTURES:
{Web: actual screenshot path(s) plus your described observations. TUI: paste capture.txt and capture-ansi.txt inline.}
SHARED SCRIPT EVIDENCE (reference, not verdict):
{Paste the image-diff or tui-check JSON. Use alphaChannelIntact for the transparency check.}
CHECK EACH:
1. Real design system vs ad-hoc: are styles driven by coherent design tokens and reused primitives, or one-off hardcoded values scattered per element?
2. Faked-with-an-image anti-pattern: is the UI a real DOM/component tree, or a pasted raster/screenshot or background-image standing in for live elements? For TUI: a real layout that reflows, or hardcoded pre-rendered text at fixed widths?
3. Alpha and transparency: handled correctly, with no unexpected opaque or black fills and correct PNG/CSS alpha? Cross-check alphaChannelIntact.
4. Code style and implementation quality.
5. Responsive and resize behavior across viewport sizes (web) or terminal resize (TUI).
6. Do the user-intended FEATURES actually work: interactions, states, navigation (web); input handling, resize, scroll (TUI)? Trace the code paths.
OUTPUT:
VERDICT: PASS | REVISE | FAIL
CONFIDENCE: HIGH | MEDIUM | LOW
SUMMARY: 1-3 sentences
FINDINGS: for each, [dimension] [severity] what is wrong, where (file/line or capture region), and the concrete fix
WHAT IS GOOD: correct aspects that must not regress
BLOCKING: items that must be fixed; empty if PASS
"""
)
Pass B - Visual fidelity and CJK precision (focused)
task(subagent_type="oracle",
run_in_background=true,
load_skills=[],
description="Visual QA pass B: visual fidelity and CJK precision",
prompt="""
REVIEW TYPE: VISUAL FIDELITY AND CJK PRECISION (read-only)
TIER INTENT: Treat this as the focused visual pass. Anchor every claim to the script evidence and the captures.
INTENT:
{What the user requested and the mock or baseline to match.}
SURFACE: {web | tui | both}
CAPTURES:
{Web: actual and reference screenshot paths plus your described observations. TUI: paste capture.txt and capture-ansi.txt inline.}
SCRIPT EVIDENCE (required, consume every field):
{Paste the image-diff or tui-check JSON.}
USE THE EVIDENCE:
- Web (image-diff): start from diffRatio and similarityScore, then open every hotspots[] entry (gridX, gridY, x, y, width, height, diffRatio) and explain the visual cause of each flagged region.
- TUI (tui-check): inspect maxWidth vs expectedColumns, every overflowLines[] entry, borderMisaligned, and wideCharColumns[].
CHECK:
1. Does the rendered output match what the user requested: layout, spacing, color, type, alignment?
2. CJK precision:
- Web: baseline/descender clipping, dropped glyphs (tofu), broken line-breaking, mismatched font metrics between reference and actual.
- TUI: wide-character column drift (CJK cells counted as 1 instead of 2), box-drawing border misalignment, content overflowing past the terminal width.
OUTPUT:
VERDICT: PASS | REVISE | FAIL
CONFIDENCE: HIGH | MEDIUM | LOW
SUMMARY: 1-3 sentences
EVIDENCE TRACE: each hotspot or overflow line mapped to its visual cause
FINDINGS: for each, [severity] what is wrong, where (hotspot grid or capture line:col), and the concrete fix
BLOCKING: items that must be fixed; empty if PASS
"""
)
Step 4 - Synthesize one verdict
When both passes return, merge them into a single report. Per dimension, mark good or bad with evidence. For each bad item, state what is wrong, where (file/line, hotspot grid, or capture line), and the concrete fix. Call out what is genuinely good so it is not regressed later.
Completion gate: do not declare the UI done until both passes are satisfied, OR the remaining gaps are explicitly listed and accepted by the user. A high similarityScore with an open Pass A finding, for example a faked-image layout or a broken feature, is still a FAIL.
# Visual QA - Verdict: GOOD | NEEDS WORK
| Dimension | Pass | Verdict | Evidence |
|---|---|---|---|
| Design system real vs faked | A | good/bad | ... |
| Features work | A | good/bad | ... |
| Responsive / resize | A | good/bad | ... |
| Alpha / transparency | A+B | good/bad | ... |
| Visual fidelity to intent | B | good/bad | ... |
| CJK precision | B | good/bad | ... |
## Must fix
[Blocking items, each with location and fix, in priority order]
## Good, keep it
[Correct aspects that must not regress]
## Completion gate
[Satisfied, or the exact remaining gaps and who accepted them]
Reference evidence is not the verdict
The script quantifies pixels and columns. It cannot judge whether the result is a real design system, whether features work, or whether intent was met. A 99/100 similarityScore can still hide a pasted-image fake, a broken interaction, or clipped CJK descenders. Use the numbers to aim the oracles, then trust the synthesized review.
Illustrative output (locked field names):
{
"command": "image-diff",
"dimensionsMatch": true,
"reference": { "width": 1440, "height": 900 },
"actual": { "width": 1440, "height": 900 },
"totalPixels": 1296000,
"diffPixels": 38880,
"diffRatio": 0.03,
"similarityScore": 97,
"alphaChannelIntact": true,
"hotspots": [
{ "gridX": 2, "gridY": 0, "x": 960, "y": 0, "width": 480, "height": 300, "diffRatio": 0.21 }
],
"summary": "97/100 similarity; one hotspot in the top-right header region."
}
{
"command": "tui-check",
"expectedColumns": 80,
"lineCount": 24,
"lineWidths": [80, 80, 82, 80],
"maxWidth": 82,
"overflowLines": [ { "line": 3, "width": 82 } ],
"borderMisaligned": true,
"wideCharColumns": [12, 13],
"hasAnsi": false,
"summary": "Line 3 overflows 80 cols by 2; borders misaligned at wide-char columns 12-13."
}
04 同仓库更多 Skills
valid-skill
A valid skill for testing purposes.
unknown-field
A skill with an unknown frontmatter field.
nested-child
Nested skill should be ignored.
root-skill-preferred
Root skill should win.
no-frontmatter
暂无简介
child-skill
A nested skill in a subdirectory.