screenshot-validation
This skill validates screenshot images and viewer HTML files used as PR evidence by checking image dimensions (minimum 400x400 pixels), viewport width (1280 pixels recommended), file size (under 5MB), blankness detection, and rendering correctness using headless Chromium. Use it after adding or modifying images in the evidence directories or generating new viewer HTML files to ensure quality standards are met before committing to prevent CI failures.
git clone --depth 1 https://github.com/liaohch3/claude-tap /tmp/screenshot-validation && cp -r /tmp/screenshot-validation/.agents/skills/screenshot-validation ~/.claude/skills/screenshot-validationSKILL.md
# Screenshot Validation Validate that evidence images and viewer HTML files meet quality standards before committing. This catches issues that would otherwise fail CI or produce misleading PR evidence. ## Image quality check Checks PNG/JPG/GIF/WEBP files for: - **Minimum dimensions**: 400x400 pixels (hard fail) - **Desktop viewport width**: >= 1280px (warning if narrower) - **File size**: <= 5MB (warning if larger) - **Blankness detection** (PNG only): fails if > 90% of pixels are white/transparent ### Run on specific files or directories ```bash uv run python scripts/check_screenshots.py .agents/evidence/pr/ uv run python scripts/check_screenshots.py .agents/recordings/ uv run python scripts/check_screenshots.py path/to/specific-image.png ``` ### Run on git-staged images ```bash scripts/check_screenshots.sh ``` This shell wrapper automatically finds staged PNG/JPG files and runs the quality check on them — useful as a pre-commit sanity check. ## Viewer HTML rendering verification Uses Playwright (headless Chromium) to verify that generated viewer HTML files actually render correctly — not just raw JSON or Python errors. Checks: - No JavaScript errors on page load - Normal traces render a sidebar with entries and a detail panel - Empty embedded traces render the explicit "No API calls captured" state - Body text doesn't contain raw JSON dumps or Python tracebacks ### Run ```bash uv run python scripts/verify_screenshots.py .traces/trace_*.html ``` Requires Playwright to be installed (`uv pip install playwright && playwright install chromium`). ## Typical workflow After generating new evidence for a PR: ```bash # 1. Check image quality uv run python scripts/check_screenshots.py .agents/evidence/pr/ # 2. If you generated new viewer HTML, verify it renders uv run python scripts/verify_screenshots.py .traces/trace_*.html # 3. If all passes, stage and commit git add .agents/evidence/pr/ ``` ## Fixing common failures | Failure | Fix | |---------|-----| | `very small image (WxH; minimum is 400x400)` | Retake screenshot at a larger viewport or higher resolution | | `narrow desktop viewport (Wpx < 1280px)` | Resize browser window to >= 1280px wide before capturing | | `mostly blank/white image` | Ensure the screenshot captures actual content, not an empty page | | `No sidebar — viewer not rendered` | Viewer HTML is broken; regenerate from trace JSONL | | `JS errors` | Check viewer.html for syntax errors in embedded data |
Generate demo assets (GIF/MP4) from real tmux E2E runs and viewer screenshots using asciinema and Playwright
Test JS logic embedded in HTML using two-layer strategy - Python unit tests + Playwright browser integration tests
Validate maintainer docs structure, standards freshness, manifest paths, and plan state. Run this after modifying any file under .agents/docs/standards/, .agents/docs/plans/, .agents/docs/architecture/, or AGENTS.md — it catches stale metadata, broken manifest paths, and plan state drift before CI does.
Record browser test videos with Playwright for PR review and bug fix verification
Full pre-PR merge-readiness check. Run this before opening or merging a pull request — it validates local gates (lint, format, tests), CI status, screenshot evidence, and PR metadata in one pass. Also useful for reviewing an existing PR's readiness.
Push to GitHub and optionally bump version to trigger PyPI release
Fill missing i18n translations in the viewer source JSON. Run this after adding or modifying English or Chinese UI strings in claude_tap/viewer_i18n.json — it auto-translates to ja, ko, fr, ar, de, ru via OpenRouter.