comparing-branches-visually について
2つの Git ブランチを同時に実行し、影響を受けるページのスクリーンショットを撮って UI の変更を比較するスキルです。視覚的な差分の確認と報告に役立ちます。
主な機能
- 01ブランチごとの worktree を用意
- 02異なるポートで両ブランチを実行
- 03コード変更の影響を受けるページを特定
- 04変更前後のスクリーンショットを撮影
- 05視覚的な差分を報告
活用シーン
- 01マージ前の UI 変更レビュー
- 02ブランチ間で影響ページを比較
- 03Pull Request 用の視覚的な変更概要を作成
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ spencerpauly/ awesome-cursor-skills --skill comparing-branches-visuallyインストール後、Claude Code で/comparing-branches-visuallyを入力して読み込まれたか確認します。
詳細
ブランチを視覚的に比較する
2 つのブランチ間の UI の変更を、変更前と変更後で視覚的に比較します。
ワークフロー
1. 2 つのワークツリーを設定する
best-of-n-runner サブエージェントまたは Git ワークツリーを使って、両方のブランチを同時に実行します。
# Create a worktree for the base branch
git worktree add /tmp/branch-compare-base main
# The current working directory has the feature branch
2. 両方のサーバーを起動する
ベースブランチのサーバーを別のポートで起動します。
# In the base worktree
cd /tmp/branch-compare-base && PORT=3001 npm run dev
# Current branch is already on the default port (3000)
3. 比較するページを特定する
変更の影響を受けるページを特定します。
git diff main --name-only | grep -E '\.(tsx?|jsx?|vue|svelte|css)'
変更されたファイルをルートに対応付けます(例:app/dashboard/page.tsx → /dashboard)。
4. 両方のバージョンのスクリーンショットを撮る
影響を受けるページごとに、次の手順を実行します。
browser_navigateでhttp://localhost:3001/<page>(ベースブランチ)に移動しますbrowser_take_screenshot→ 「before」として保存しますbrowser_navigateでhttp://localhost:3000/<page>(フィーチャーブランチ)に移動しますbrowser_take_screenshot→ 「after」として保存します
5. レポートする
比較結果を提示します。
Visual Diff: feature/redesign-header vs main
/dashboard:
Before: [screenshot from main]
After: [screenshot from feature branch]
Changes: Header height reduced, nav links repositioned, new avatar dropdown
/settings:
Before: [screenshot]
After: [screenshot]
Changes: No visual differences detected
6. クリーンアップする
# Stop the base branch server
# Remove the worktree
git worktree remove /tmp/branch-compare-base
ヒント
- ビューポートのサイズを統一してテストします(1280×800 が適切なデフォルトです)
- モバイルファーストの変更では、幅 375px でも比較します
- アプリで認証が必要な場合は、最初に両方のポートでログインします
- PR の説明には
screenshotting-changelogと組み合わせると便利です
コメント
Markdown 対応