Automatic visual diffs for PRs. Pre-post reads your git changes, figures out which pages changed, and screenshots them.
Update the homepage
| Before | After |
|---|---|
site.com | site.com |
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 before/after 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 globally to use from anywhere
npm i -g pre-postAdd Skill
Show Claude Code how and when to take before and afters. The skill uses gh to detect the associated PR with your branch and Playwright for browser automation
npx skills add juangadm/pre-postOptions
Capture responsive screenshots (desktop + mobile)
pre-post compare --before-base url1 --after-base url2 --responsiveCompare specific routes
pre-post compare --before-base url1 --after-base url2 --routes /dashboard,/settingsCapture a specific element using a CSS selector
pre-post url1 url2 ".hero"Use different selectors for before and after
pre-post url1 url2 ".old" ".new"Capture at mobile (375x812), tablet (768x1024), or custom viewport
pre-post url1 url2 --mobilepre-post url1 url2 --size 1920x1080Capture the entire scrollable page
pre-post url1 url2 --fullOutput a markdown table for PR descriptions
pre-post url1 url2 --markdownUse existing images instead of capturing URLs
pre-post before.png after.pngSave to a custom location
pre-post url1 url2 --output ./screenshotsUpload to a custom image storage service
pre-post url1 url2 --upload-url my-s3-endpointBy default, images are uploaded to 0x0.st. For heavy usage or sensitive captures, use your own upload handler.
Acknowledgements
Built on before-and-after by James Clements at Vercel Labs.