Automatic visual diffs for PRs. Pre-post reads your git changes, figures out which pages changed, and screenshots them.
How it works
- Make your UI changes
- Say
/pre-postin Claude Code - Pre-post reads your git diff and detects which pages changed
- It screenshots each route — production vs your new version
- You review the screenshots
- Pre-post adds a pre/post table to your PR
Works with localhost, Vercel preview deploys, Netlify, or any accessible URL.
What's different
Pre-post started as a fork of Vercel's before-and-after. The original required you to manually pass two URLs. Pre-post reads your git diff, detects which routes changed, and captures them automatically — desktop and mobile, at 2x retina quality.
Under the hood, it uses Playwright instead of Vercel's agent-browser. It waits for fonts to load and freezes CSS animations before each capture, so screenshots are consistent across runs.
Install
Install as a dev dependency
Add Skill
Show Claude Code how and when to take pre and post screenshots. The skill uses gh to detect the associated PR with your branch and Playwright for browser automation
Options
Capture responsive screenshots (desktop + mobile)
Compare specific routes
Capture a specific element using a CSS selector
Use different selectors for pre and post
Capture at mobile (375x812), tablet (768x1024), or custom viewport
Capture the entire scrollable page
Output a markdown table for PR descriptions
Use existing images instead of capturing URLs
Save to a custom location
Override the default upload method
By default, screenshots are committed directly to the PR branch (under .pre-post/) and served via GitHub blob URLs pinned to the commit SHA. Works for both public and private repos. Use --upload-url to override with a custom storage service.
Acknowledgements
Built on before-and-after by James Clements at Vercel Labs.