comparing-branches-visually — Claude Code skill: visual branch diff
Checks out two branches in separate worktrees, runs both dev servers on different ports, screenshots the same pages and reports before/after.
npx skills add spencerpauly/awesome-cursor-skills --skill comparing-branches-visually -a claude-codeWhat comparing-branches-visually does
Reach for this skill when a UI change needs a before-and-after. It adds a git worktree for the base branch and starts that branch's dev server on a second port, while your current branch keeps its own. The agent then lists changed files with git diff main --name-only, filters components and styles, and maps files to routes: app/dashboard/page.tsx becomes /dashboard.
For every affected page it navigates to the base branch URL, saves a screenshot as "before", switches to the current branch port and saves "after". The report puts both images side by side with a note on what moved — a shorter header, repositioned nav links. Cleanup is one command: git worktree remove.
Keep the viewport identical across shots. The skill suggests starting at 1280×800 and adding 375px for mobile-first work. If the app sits behind auth, log in on both ports first, or every screenshot will show the login page. Port 3001 for the base branch is set by hand, so a busy port breaks the server step.
What it helps with
- show a UI change before and after
- compare two branches' layouts without switching back and forth
- collect screenshots of changed pages for a PR description
- check whether the layout breaks at mobile width
- find which pages a component change touched
Example prompts for the agent
- Visually compare feature/redesign-header against main and show before/after screenshots
- Run both branches in worktrees and screenshot /dashboard and /settings
- Produce a visual diff of my changes and add it to the PR description
How to install comparing-branches-visually
1Skills CLI (Vercel)
npx skills add spencerpauly/awesome-cursor-skills --skill comparing-branches-visually -a claude-code2Manually: put the files in place
~/.claude/skills/comparing-branches-visually/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/comparing-branches-visually/
1Skills CLI (Vercel)
npx skills add spencerpauly/awesome-cursor-skills --skill comparing-branches-visually -a codex2Manually: put the files in place
.agents/skills/comparing-branches-visually/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add spencerpauly/awesome-cursor-skills --skill comparing-branches-visually -a cursor2Manually: put the files in place
.cursor/skills/comparing-branches-visually/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install spencerpauly/awesome-cursor-skills comparing-branches-visually2Manually: put the files in place
.github/skills/comparing-branches-visually/SKILL.md1Skills CLI (Vercel)
npx skills add spencerpauly/awesome-cursor-skills --skill comparing-branches-visually -a gemini-cli2Platform CLI
gemini skills install https://github.com/spencerpauly/awesome-cursor-skills --path resources/comparing-branches-visuallyManually: put the files in place
.devin/skills/comparing-branches-visually/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add spencerpauly/awesome-cursor-skills --skill comparing-branches-visually -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about comparing-branches-visually
How do I install comparing-branches-visually in Claude?
Run npx skills add spencerpauly/awesome-cursor-skills --skill comparing-branches-visually -a claude-code. The skill file lands at ~/.claude/skills/comparing-branches-visually/SKILL.md.
What does comparing-branches-visually do?
It runs the base and current branches at the same time, starts their dev servers on different ports, screenshots the same pages and returns a report with before and after pairs.
What does the skill need to work?
A free port for the base branch dev server, and a login on both ports if the app requires auth. Screenshots come from browser_navigate and browser_take_screenshot.
Source text
SKILL.md · CC0-1.0
--- name: comparing-branches-visually description: Check out two branches in separate worktrees, start both dev servers on different ports, screenshot the same pages, and produce a visual diff. user-invocable: true --- # Comparing Branches Visually Create a visual before/after comparison of UI changes between two branches. ## Workflow ### 1. Set Up Two Worktrees Use `best-of-n-runner` subagents or git worktrees to run both branches simultaneously: ```bash # Create a worktree for the base branch git worktree add /tmp/branch-compare-base main # The current working directory has the feature branch ``` ### 2. Start Both Servers Start the base branch server on a different port: ```bash # In the base worktree cd /tmp/branch-compare-base && PORT=3001 npm run dev # Current branch is already on the default port (3000) ``` ### 3. Identify Pages to Compare Determine which pages are affected by the changes: ```bash git diff main --name-only | grep -E '\.(tsx?|jsx?|vue|svelte|css)' ``` Map changed files to their routes (e.g. `app/dashboard/page.tsx` → `/dashboard`). ### 4. Screenshot Both Versions For each affected page: 1. `browser_navigate` to `http://localhost:3001/<page>` (base branch) 2. `browser_take_screenshot` → save as "before" 3. `browser_navigate` to `http://localhost:3000/<page>` (feature branch) 4. `browser_take_screenshot` → save as "after" ### 5. Report Present the comparison: ``` 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. Clean Up ```bash # Stop the base branch server # Remove the worktree git worktree remove /tmp/branch-compare-base ``` ## Tips - Test at a consistent viewport size (1280×800 is a good default) - For mobile-first changes, also compare at 375px width - If the app requires auth, log in on both ports first - This pairs well with `screenshotting-changelog` for PR descriptions
© spencerpauly · CC0-1.0 · spencerpauly/awesome-cursor-skills