Agent SkillsHouseofmvps/ultraship › visual-diff

visual-diff

GitHub

基于 Playwright 的视觉回归测试技能,通过对比代码变更前后的页面截图和 DOM 结构,自动检测 CSS、布局及交互等视觉异常,确保前端 UI 一致性。

skills/visual-diff/SKILL.md Houseofmvps/ultraship

Trigger Scenarios

用户希望检查视觉回归 需要对比 UI 变更 验证 CSS 或布局修改未破坏界面

Install

npx skills add Houseofmvps/ultraship --skill visual-diff -g -y
More Options

Use without installing

npx skills use Houseofmvps/ultraship@visual-diff

指定 Agent (Claude Code)

npx skills add Houseofmvps/ultraship --skill visual-diff -a claude-code -g -y

安装 repo 全部 skill

npx skills add Houseofmvps/ultraship --all -g -y

预览 repo 内 skill

npx skills add Houseofmvps/ultraship --list

SKILL.md

Frontmatter
{
    "name": "visual-diff",
    "description": "Visual Regression Testing — screenshot comparison before and after changes. Use when user wants to check for visual regressions, compare UI changes, or verify CSS\/layout changes didn't break anything."
}

Visual Regression Testing

Automated screenshot comparison using Playwright. Catch visual bugs before they ship.

Process

Phase 1: Determine Test Scope

Ask the user:

  1. What URL(s) to test? (localhost, staging, or production)
  2. What changed? (CSS update, component refactor, dependency upgrade, etc.)

If the user already described what changed, skip asking.

Phase 2: Take "Before" Screenshots

If comparing against the current state (before making changes):

Use the Playwright MCP to capture screenshots:

  1. Navigate to the URL:

    • Use browser_navigate to go to the target URL
  2. Take full-page screenshot:

    • Use browser_take_screenshot to capture the current state
  3. Capture key viewports:

    • Desktop (1920x1080): browser_resize then browser_take_screenshot
    • Tablet (768x1024): browser_resize then browser_take_screenshot
    • Mobile (375x812): browser_resize then browser_take_screenshot
  4. Save screenshots with descriptive names noting they are "before" state.

Phase 3: Make Changes

Let the user make their changes, or make them yourself if that's the task.

Phase 4: Take "After" Screenshots

Repeat the same screenshot process for the same URLs and viewports.

Phase 5: Visual Comparison

Compare before and after screenshots:

  1. Layout shifts — did any elements move unexpectedly?
  2. Color changes — did colors, gradients, or shadows change?
  3. Typography — did font sizes, weights, or spacing change?
  4. Responsive issues — does it look correct on all viewports?
  5. Missing elements — did anything disappear?
  6. Overflow issues — is content clipping or overflowing?

Use browser_snapshot to get the accessibility tree and compare DOM structure between before/after.

Phase 6: Report

Present findings in a clear format:

No Visual Regressions Found:

  • "All pages look identical across desktop, tablet, and mobile viewports."

Regressions Detected: For each regression:

  • Page: URL where the issue appears
  • Viewport: Which screen size is affected
  • What changed: Description of the visual difference
  • Severity: Critical (broken layout), High (noticeable shift), Medium (minor difference), Low (pixel-level)
  • Suggested fix: How to resolve the regression

Phase 7: Targeted Testing

For specific component changes, also test:

  • Hover states (use browser_hover)
  • Click interactions (use browser_click)
  • Form states (use browser_fill_form)
  • Dark mode (if applicable)
  • Loading states
  • Error states
  • Empty states

Key Pages to Always Test

When the user doesn't specify pages, test these by default:

  1. Homepage / Landing page (/)
  2. Login/signup page (if exists)
  3. Main app page (dashboard, etc.)
  4. Any page the user recently modified

Key Principle

Trust screenshots, not assumptions. CSS changes cascade unpredictably. A "small tweak" in one component can break layouts across the entire app. Always verify visually.

Version History

  • ed232cb Current 2026-07-24 16:16

Same Skill Collection

skills/a11y/SKILL.md
skills/architecture/SKILL.md
skills/brainstorming/SKILL.md
skills/canary/SKILL.md
skills/clone-patterns/SKILL.md
skills/code-review/SKILL.md
skills/compete/SKILL.md
skills/cost/SKILL.md
skills/demo/SKILL.md
skills/deploy/SKILL.md
skills/dispatching-parallel-agents/SKILL.md
skills/evals/SKILL.md
skills/executing-plans/SKILL.md
skills/finishing-a-development-branch/SKILL.md
skills/frontend-design/SKILL.md
skills/grow/SKILL.md
skills/guard/SKILL.md
skills/index-fix/SKILL.md
skills/investigate/SKILL.md
skills/launch/SKILL.md
skills/learn/SKILL.md
skills/onboard/SKILL.md
skills/pentest/SKILL.md
skills/perf-audit/SKILL.md
skills/receiving-code-review/SKILL.md
skills/release/SKILL.md
skills/requesting-code-review/SKILL.md
skills/rescue/SKILL.md
skills/retro/SKILL.md
skills/revise-claude-md/SKILL.md
skills/security-audit/SKILL.md
skills/seo-audit/SKILL.md
skills/seo-strategy/SKILL.md
skills/ship-gate/SKILL.md
skills/sprint/SKILL.md
skills/staying-current/SKILL.md
skills/subagent-driven-development/SKILL.md
skills/systematic-debugging/SKILL.md
skills/test-driven-development/SKILL.md
skills/using-git-worktrees/SKILL.md
skills/using-ultraship/SKILL.md
skills/verification-before-completion/SKILL.md
skills/writing-plans/SKILL.md
skills/writing-skills/SKILL.md

Metadata

Files
0
Version
ed232cb
Hash
dfc0e64a
Indexed
2026-07-24 16:16

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-16 20:09
浙ICP备14020137号-1 $mapa de visitantes$