capture-pr-screenshotslisted
Install: claude install-skill damson/hard-won-skills
# Capture PR screenshots end-to-end
From "the diff touched a UI page" to "the PR body shows a SHA-pinned image".
## Procedure
### 0. Defer to the repo's own command
```bash
{ find . -maxdepth 4 -iname '*screenshot*' -name '*.md'
find . -maxdepth 4 -ipath '*screenshot*' -iname 'README*'; } 2>/dev/null | sort -u
```
If one exists and documents a regenerate/capture command, **run that and skip to step 7.**
It knows the project's viewport, auth story and naming. The steps below are defaults for
a repo that documents none of it.
### 1. Find the changed surfaces
```bash
BASE=$(gh pr view --json baseRefName -q .baseRefName 2>/dev/null \
|| git symbolic-ref --short refs/remotes/origin/HEAD | sed 's|origin/||')
git diff "origin/$BASE"... --name-only | grep -E '(page|index)\.(tsx|jsx|vue)$|\+page\.svelte$|routes/.*\.(tsx|jsx)$'
SHOTS=$(find . -type d -iname 'screenshot*' -not -path './node_modules/*' | head -1)
echo "base=$BASE shots=${SHOTS:-<none>}"
```
Zero route matches, or no screenshot directory, means this repo is not shaped the way
this skill assumes — **stop and ask** rather than proceeding on empty results. Map each
route to a filename in `$SHOTS`, following the naming already used by the files there.
### 2. Pre-flight
- Ensure env files exist. In a secondary worktree they are gitignored and absent — link the primary's:
```bash
MAIN=$(git worktree list --porcelain | awk '/^worktree /{print $2; exit}')
ln -sfn "$MAIN/.env" .env.local # adjust to