Screenshots
Finds the pages your diff touches, captures before and after shots, and adds them to the PR description.
Claude Code skill codemaman-pr-screenshots, works with GitHub and Browser.
Pics or it didn't happen
Install it
Copies the skill into ~/.claude/skills:
curl -fsSL https://toolsfortechies.dev/install.sh | bash -s -- codemaman-pr-screenshotsOr download the zip and unzip it into ~/.claude/skills. Restart Claude Code afterwards.
Try it
- Ask Claude
- “Add before and after screenshots to my PR”
- Or run
/codemaman-pr-screenshots
Before you start
- You'll need
- gh CLI signed in, a browser tool (built-in browser, Claude in Chrome or Playwright) and an app you can run locally.
- What it won't do without you
- Checks every image for sensitive data and never pushes to the PR branch.
Read the SKILL.md
# PR Screenshots Capture clear visual evidence of UI changes and embed it in the PR description without clobbering existing text. ## 1. Work out what changed - Resolve the PR: argument (number/URL) or `gh pr view --json number,url,body,baseRefName,headRefName`. If no PR exists yet, work from the current branch diff against the default branch and offer to create the PR afterwards. - Read `git diff --name-only <base>...HEAD` and map changed components/routes/templates to the user-visible pages and states they affect (look at the router config, story files, and which pages import the changed components). Produce a short shot list, for example: `/settings/profile` default, `/settings/profile` validation error, same page at mobile width. Confirm the list with the user if it has more than ~6 shots. - If the diff has no UI impact, say so and stop. ## 2. Get the app running - Look for a running dev server first (check common ports and `package.json`/Makefile/README scripts: `dev`, `start`, `storybook`). Otherwise start it in the background and wait for it to answer HTTP before continuing. Note any env vars, seed data, or login needed; ask the user for test credentials rather than guessing. Never use production credentials or screenshot production data. - For "before" shots create a worktree of the base branch (`git worktree add ../<repo>-base <base>`), install deps and run it on a second port. Leave the user's working tree untouched. If a before/after is impractical (new page), take "after" only and say why. ## 3. Capture Use the built-in browser (or Claude in Chrome / Playwright if that is what's available). For each shot: - Set a consistent viewport: desktop 1440x900 and, when the change is responsive, mobile 390x844. - Navigate, wait for network idle and for spinners/skeletons to disappear, dismiss cookie banners and dev overlays. - Put the page in the right state (fill forms, open modals, hover, trigger error states) before capturing. - Crop or capture the element of interest when a full page would bury the change. - Save every image as a PNG in the project folder where the command was run (the current working directory, normally the repo root): `./pr-screenshots/<pr-number or branch-name>/NN-page-state-before|after.png`. Create the folder if needed, and keep the files after the task so the user can find them. Keep files reasonably small (<1 MB each; downscale if needed). - Keep the screenshots out of git: unless the user says they want them committed, add `pr-screenshots/` to `.git/info/exclude` (local only; do not edit the tracked `.gitignore` without asking). Never commit or push them to the PR branch. - Look at every image yourself. Retake anything that shows a loading state, an error you didn't intend, or irrelevant clutter. - **Check for sensitive data** (emails, names, tokens, internal URLs, customer data) in each image. Blur/crop or retake with fake data. If unsure, ask the user. - For interactions that a still can't show, record a short GIF (the browser tool's GIF recorder) instead. ## 4. Upload so the images render in the PR GitHub has no official API for PR image uploads. Choose in this order and tell the user which you used: 1. **Browser upload (preferred)**: open the PR in the browser, click edit on the description, drag/attach the files via the file input so GitHub produces `github.com/user-attachments/...` URLs, and read the generated markdown. Requires the browser to be signed in to GitHub; if it isn't, ask the user to sign in. 2. **Assets branch fallback**: with the user's OK, commit the images to a dedicated orphan branch such as `pr-assets/<pr-number>` (never to the PR branch, never to main) in a temporary worktree, push, and reference them as `https://github.com/<owner>/<repo>/blob/pr-assets/<pr-number>/<file>.png?raw=true` (this form renders for authenticated viewers in private repos). Mention that the branch can be deleted after merge. ## 5. Update the PR description safely - Fetch the current body: `gh pr view <n> --json body -q .body`. - Insert or replace only the region between `<!-- screenshots:start -->` and `<!-- screenshots:end -->` markers; if absent, add a `## Screenshots` section at the end (or where the PR template's Screenshots heading is). Preserve everything else exactly. - Layout: a table with Before | After columns per page/state, with a bold caption naming the page, state and viewport. Use `<img src=... width="400">` to keep sizes sane. GIFs get their own row. - Write the new body to a temp file and apply with `gh pr edit <n> --body-file <file>`. - Show the user the final markdown and the PR link. If Jira is connected, offer to attach/comment the images on the ticket too. ## 6. Clean up Stop dev servers you started, remove the base worktree and any other temp files, and confirm `git status` shows no changes to tracked files. Leave the saved screenshots in `./pr-screenshots/<pr-number or branch-name>/` and tell the user the path. ## Rules - Don't push to the PR branch or alter code. The only things you add to the project folder are the screenshots in `pr-screenshots/`. - Don't expose real user data. When in doubt, ask. - If anything fails twice (server won't start, login blocked), stop and report what you tried rather than looping.Open the raw file