agentleFS
michalklejdyszmichalklejdysz/pr-visuals/skills/pr-screenshots/SKILL.md

pr-screenshots

Skill0 starsChanged 23 days agoMITView on GitHub

Capture matched before/after screenshots of a UI change in the running web app and attach them to the branch's GitHub PR. The "before" comes from swapping the changed files back to the base branch while the dev server hot-reloads, so both shots share the same data, URL, login and viewport. Use when a PR changes what a screen shows, or when asked for screenshots, before/after shots or visuals for a PR.

  • Commits and pushes

14 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use security-review.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • SentrySkill

    security-review

    Finds exploitable application security vulnerabilities in code changes. Use for Warden security scans, appsec review, OWASP-style checks, authentication or authorization bugs, injection, XSS, SSRF, path traversal, secrets, unsafe crypto, webhook verification, open redirects, or sensitive data exposure.

    Also in 3 projects that use this

  • Other versions14 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 14

    1. github/awesome-copilot★ 41ksame name
    2. github/gh-aw★ 5.6ksame name
    3. lukevella/rallly★ 5.4ksame name
    4. github/squad★ 3.4ksame name
    5. levy-street/world-of-claudecraft★ 2.3ksame name
    6. getsentry/skills★ 1.1ksame name
    7. BrOrlandi/my-claude-skills★ 22same name
    8. nanosite-ai/nanoflow★ 15same name
    9. bwhtech/skills★ 3same name
    10. krimvp/xpl★ 2same name

    4 more not listed

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository2 other files it gives its agents.

The file

Show its rules and text

We split this skill into the rules it gives an agent

17 rules. 0 are common, 8 are distinctive, and 9 are very specific to this project.

  • 0

    Common

    Most of the 13 edited versions we read keep these.

  • 8

    Distinctive

    This author's own choices. Worth a look.

  • 9

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before/after pairs that differ only by the code in the diff.

    line 8
  2. Very specific:

    Read .pr-visuals/config.md at the repo root.

    line 14
  3. Very specific:

    Write .pr-visuals/config.md from config-template.md, and .pr-visuals/.gitignore containing out/.

    line 26
  4. Distinctive:

    Create the data the screens need the normal way (the UI or the real backend), logged in as the demo account.

    line 39
  5. Very specific:

    Check with git diff --quiet HEAD -- <files>.

    line 69
  6. Very specific:

    Wait for the hot reload, then reload the page and repeat the exact steps from section 2.

    line 73
  7. Distinctive:

    If the change is in the API, the database or generated data, a frontend swap can't show the old state.

    line 81
  8. Very specific:

    Config says how: use the "Backend changes" section of .pr-visuals/config.md, e.g.

    line 84
  9. Very specific:

    Throwaway state script: write a script under .pr-visuals/out/<branch>/ that puts the same record into its old and new shape (node state.mjs …

    line 86
  10. Distinctive:

    Write the section into the PR body file, using the layout from the config:

    line 98
  11. Very specific:

    Use stacked pairs (Before / image / After / image) instead of a table when the shots are wider than about 1200 px or when there's only one …

    line 108
  12. Distinctive:

    If the repo has a PR template, keep its section names and put the shots in its screenshots section.

    line 110
  13. Distinctive:

    Run gh from the folder that holds the PNGs, so the relative paths resolve:

    line 113
  14. Very specific:

    If the user said not to touch the PR, or there's no GitHub remote or a new enough gh, keep the files in .pr-visuals/out/<branch>/ and hand …

    line 128
  15. Distinctive:

    Only the diff differs between a pair: same data, account, URL, viewport, theme and language.

    line 133
  16. Distinctive:

    No real personal data in a shot.

    line 136
  17. Very specific:

    Never commit anything under .pr-visuals/out/.

    line 137

“Common” is measured: kept by at least 6 in 10 of the 13 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

PR screenshots

Before/after pairs that differ only by the code in the diff. The trick: take the "after" shot, put the changed files back to their base-branch version, let the dev server hot-reload, take the "before" shot of the same page, then restore the files.

0. Config

Read .pr-visuals/config.md at the repo root. If it's missing, set it up once:

  1. Detect what's available instead of asking: which playwright-cli, the browser tools you have (Claude in Chrome, Chrome DevTools MCP, others), the dev command in package.json, the dev server port, and any seed script or seeded accounts in the repo.
  2. Propose a config in one message and let the user correct it, e.g. "playwright-cli is installed, so I'll use it at 1440x900 against http://localhost:5173, logging in as the seeded demo@example.com. OK?" Any tool that saves a PNG works; playwright-cli is the default because scripted shots repeat exactly.
  3. Explain the demo account: screenshots end up in a PR, so log in only with a local or seeded account whose data can be public. If there isn't one, ask the user to create it (or offer to add it to the seed) rather than using their own account.
  4. Write .pr-visuals/config.md from config-template.md, and .pr-visuals/.gitignore containing out/. Commit the config with the rest of the work.

Artifacts go to .pr-visuals/out/<branch>/ (gitignored by the file above). Run browser commands from the repo root: playwright-cli only reads scripts from under the directory it was opened in.

1. Plan the shots

From the diff and the task, list the screens and states the change affects: a page, an open dialog, a hover state, an error state. One pair per state. New screens get only an "after".

2. Prepare the state

Create the data the screens need the normal way (the UI or the real backend), logged in as the demo account. Note the exact URL and the steps that reach each state.

3. After

With the branch code running, capture each state at the config viewport. Name files after-<state>.png. Look at each one before moving on: a dev-server error overlay, a spinner or a half-finished animation means a retake.

# Keeps playwright-cli logs in .pr-visuals/out/ instead of a .playwright-cli/ folder in the repo.
P() { PLAYWRIGHT_MCP_OUTPUT_DIR="$PWD/.pr-visuals/out/.cli" playwright-cli -s=shots "$@"; }
# Twice the pixel density, so shots stay sharp in a PR and in a README. Viewport from the config.
mkdir -p .pr-visuals/out && printf %s '{"browser":{"contextOptions":{"viewport":{"width":1440,"height":900},"deviceScaleFactor":2}}}' > .pr-visuals/out/shots.json
P open --config=.pr-visuals/out/shots.json "<url>"
P goto "<url of the state>"
P screenshot --filename=.pr-visuals/out/<branch>/after-<state>.png

For a crop of one component, run-code with page.screenshot({ path, clip }) around its boundingBox() plus about 16 px of padding.

4. Before: swap, reload, capture

  1. Find the base: gh pr view --json baseRefName -q .baseRefName, or the remote default branch (git symbolic-ref --short refs/remotes/origin/HEAD). Run git fetch origin <base>.
  2. Pick the files to swap: the changed frontend files that render this state, from git diff --name-only origin/<base>...HEAD. Swap the smallest set that brings back the old UI. Swapping unrelated files (new imports, changed types) can break the build.
  3. Each file you swap must have no uncommitted changes, or restoring it would wipe them. Check with git diff --quiet HEAD -- <files>. If it fails, commit first (a WIP commit is fine) or stop and ask.
  4. Swap: git show origin/<base>:<file> > <file> for each file. A file that is new on the branch has no base version; leave it, and swap the file that imports it instead.
  5. Wait for the hot reload, then reload the page and repeat the exact steps from section 2. Capture before-<state>.png at the same viewport, scroll position and zoom as the "after".
  6. Restore, always, even if a capture failed: git checkout -- <files>. Then git status must show the working tree as it was before the swap. Reload once more and check the page shows the "after" UI again.

When swapping files isn't enough

If the change is in the API, the database or generated data, a frontend swap can't show the old state. In order of preference:

  • Config says how: use the "Backend changes" section of .pr-visuals/config.md, e.g. a command that runs the base branch on another port.
  • Throwaway state script: write a script under .pr-visuals/out/<branch>/ that puts the same record into its old and new shape (node state.mjs before / after) against the local dev database only, capture each, then delete the script. Never point it at a shared or remote database.
  • Can't reproduce: say so in the PR ("before: not reproducible locally, see the issue") and attach only the "after".

5. Attach to the PR

GitHub only, and gh 2.99 or later (gh --version). --attach uploads each file and rewrites ![alt](./file.png) references in the body to the uploaded URL.

Write the section into the PR body file, using the layout from the config:

## Screenshots

| State | Before | After |
| --- | --- | --- |
| Settings, saved | ![before](./before-saved.png) | ![after](./after-saved.png) |

Use stacked pairs (**Before** / image / **After** / image) instead of a table when the shots are wider than about 1200 px or when there's only one pair, so GitHub doesn't shrink them. If the repo has a PR template, keep its section names and put the shots in its screenshots section.

Run gh from the folder that holds the PNGs, so the relative paths resolve:

cd .pr-visuals/out/<branch>
gh pr view --json number -q .number          # is there a PR already?
gh pr create --title "..." --body-file pr.md --attach ./before-saved.png --attach ./after-saved.png
gh pr edit <n> --body-file pr.md --attach ./before-saved.png --attach ./after-saved.png

In a fork, pass -R <owner>/<repo> (and --base) to every gh command, or gh targets the upstream repository.

Then check the result: gh pr view <n> --json body -q .body must contain github.com/user-attachments/ URLs and no ./ paths left.

If the user said not to touch the PR, or there's no GitHub remote or a new enough gh, keep the files in .pr-visuals/out/<branch>/ and hand over their paths plus the markdown above.

Rules

  • Only the diff differs between a pair: same data, account, URL, viewport, theme and language.
  • Crop or zoom to the area that changed when the page is large; the reader should see the difference without hunting for it. Use the same crop for both shots of a pair.
  • No real personal data in a shot. If it appears, retake with demo data.
  • Never commit anything under .pr-visuals/out/.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.