pr-screenshots

GitHub

通过Playwright捕获视觉变更截图,利用临时分支托管图片并嵌入GitHub PR描述,辅助审查无需检出代码。

.squad/templates/skills/pr-screenshots/SKILL.md microsoft/Generative-AI-for-beginners-dotnet

Trigger Scenarios

PR包含UI组件或文档站点变更 需要为PR添加可视化预览

Install

npx skills add microsoft/Generative-AI-for-beginners-dotnet --skill pr-screenshots -g -y
More Options

Non-standard path

npx skills add https://github.com/microsoft/Generative-AI-for-beginners-dotnet/tree/main/.squad/templates/skills/pr-screenshots -g -y

Use without installing

npx skills use microsoft/Generative-AI-for-beginners-dotnet@pr-screenshots

指定 Agent (Claude Code)

npx skills add microsoft/Generative-AI-for-beginners-dotnet --skill pr-screenshots -a claude-code -g -y

安装 repo 全部 skill

npx skills add microsoft/Generative-AI-for-beginners-dotnet --all -g -y

预览 repo 内 skill

npx skills add microsoft/Generative-AI-for-beginners-dotnet --list

SKILL.md

Frontmatter
{
    "name": "pr-screenshots",
    "domain": "pull-requests, visual-review, docs, testing",
    "source": "earned (multiple sessions establishing the pattern for PR #11 TypeDoc API reference)",
    "confidence": "high",
    "description": "Capture Playwright screenshots and embed them in GitHub PR descriptions"
}

Context

When a PR includes visual changes (docs sites, UI components, generated pages), reviewers need to see what the PR delivers without checking out the branch. Screenshots belong in the PR description body, not as committed files and not as text descriptions.

Use this skill whenever:

  • A PR touches docs site pages (Astro, Starlight, etc.)
  • A PR adds or changes UI components
  • A PR generates visual artifacts (TypeDoc, Storybook, diagrams)
  • Playwright tests already capture screenshots as part of testing

Patterns

1. Capture screenshots with Playwright

If Playwright tests already exist and produce screenshots, reuse those. Otherwise, write a minimal capture script:

// scripts/capture-pr-screenshots.mjs
import { chromium } from 'playwright';

const browser = await chromium.launch();
const page = await browser.newPage({ viewport: { width: 1280, height: 720 } });

const screenshots = [
  { url: 'http://localhost:4321/path/to/page', name: 'feature-landing' },
  { url: 'http://localhost:4321/path/to/detail', name: 'feature-detail' },
];

for (const { url, name } of screenshots) {
  await page.goto(url, { waitUntil: 'networkidle' });
  await page.screenshot({ path: `screenshots/${name}.png`, fullPage: false });
}

await browser.close();

2. Host screenshots on a temporary branch

GitHub PR descriptions render images via URLs. The gh CLI cannot upload binary images directly. Use a temporary orphan branch to host the images:

# Save current branch
$currentBranch = git branch --show-current

# Create orphan branch with only screenshot files
git checkout --orphan screenshots-temp
git reset
git add screenshots/*.png
git commit -m "screenshots for PR review"
git push origin screenshots-temp --force

# Build raw URLs
$base = "https://raw.githubusercontent.com/{owner}/{repo}/screenshots-temp/screenshots"
# Each image: $base/{name}.png

# Return to working branch
git checkout -f $currentBranch

3. Embed in PR description

Use gh pr edit with the raw URLs embedded as markdown images:

$base = "https://raw.githubusercontent.com/{owner}/{repo}/screenshots-temp/screenshots"

gh pr edit {PR_NUMBER} --repo {owner}/{repo} --body @"
## {PR Title}

### What this PR delivers
- {bullet points of changes}

---

### Screenshots

#### {Page/Feature Name}
![{alt text}]($base/{name}.png)

#### {Another Page}
![{alt text}]($base/{another-name}.png)

---

### To verify locally
```bash
{commands to run locally}

"@


### 4. Cleanup after merge

After the PR is merged, delete the temporary branch:

```bash
git push origin --delete screenshots-temp

5. Gitignore screenshots locally

Screenshots are build artifacts — never commit them to feature branches:

# PR screenshots (hosted on temp branch, not committed to features)
screenshots/
docs/tests/screenshots/

Examples

Example: Docs site PR with 3 pages

  1. Start dev server: cd docs && npm run dev
  2. Run Playwright tests (they capture screenshots as a side effect)
  3. Push screenshots to screenshots-temp branch
  4. Update PR body with embedded ![...]() image references
  5. Reviewer sees the pages inline without checking out the branch

Example: Reusing existing Playwright test screenshots

If tests at docs/tests/*.spec.mjs already save to docs/tests/screenshots/:

cd docs && npx playwright test tests/api-reference.spec.mjs
# Screenshots now at docs/tests/screenshots/*.png
# Push those to screenshots-temp and embed in PR

Anti-Patterns

  • Committing screenshots to feature branches — they bloat the repo and go stale
  • Posting text descriptions instead of actual images — reviewers can't see what they're getting
  • Using gh CLI to "upload" imagesgh issue comment and gh pr edit don't support binary uploads
  • Asking the user to manually drag-drop images — automate it with the temp branch pattern
  • Skipping screenshots for visual PRs — if the PR changes what users see, show what users see
  • Leaving the screenshots-temp branch around forever — clean up after merge

Version History

  • bd4e082 Current 2026-08-20 14:06

Same Skill Collection

.github/skills/agent-collaboration/SKILL.md
.github/skills/coordinator-init-mode/SKILL.md
.github/skills/coordinator-response-mode/SKILL.md
.github/skills/coordinator-source-of-truth/SKILL.md
.github/skills/cross-squad-communication/SKILL.md
.github/skills/cross-squad/SKILL.md
.github/skills/error-recovery/SKILL.md
.github/skills/git-workflow/SKILL.md
.github/skills/iterative-retrieval/SKILL.md
.github/skills/reflect/SKILL.md
.github/skills/reviewer-protocol/SKILL.md
.github/skills/secret-handling/SKILL.md
.github/skills/session-recovery/SKILL.md
.github/skills/squad-conventions/SKILL.md
.github/skills/squad-help/SKILL.md
.github/skills/squad-version-check/SKILL.md
.github/skills/squad/SKILL.md
.github/skills/tiered-memory/SKILL.md
.squad/templates/skills/agent-collaboration/SKILL.md
.squad/templates/skills/agent-conduct/SKILL.md
.squad/templates/skills/architectural-proposals/SKILL.md
.squad/templates/skills/ci-validation-gates/SKILL.md
.squad/templates/skills/client-compatibility/SKILL.md
.squad/templates/skills/coordinator-init-mode/SKILL.md
.squad/templates/skills/coordinator-response-mode/SKILL.md
.squad/templates/skills/coordinator-source-of-truth/SKILL.md
.squad/templates/skills/cross-machine-coordination/SKILL.md
.squad/templates/skills/cross-squad-communication/SKILL.md
.squad/templates/skills/cross-squad/SKILL.md
.squad/templates/skills/distributed-mesh/SKILL.md
.squad/templates/skills/docs-standards/SKILL.md
.squad/templates/skills/e2e-template-testing/SKILL.md
.squad/templates/skills/economy-mode/SKILL.md
.squad/templates/skills/error-recovery/SKILL.md
.squad/templates/skills/external-comms/SKILL.md
.squad/templates/skills/fact-checking/SKILL.md
.squad/templates/skills/gh-auth-isolation/SKILL.md
.squad/templates/skills/git-workflow/SKILL.md
.squad/templates/skills/github-multi-account/SKILL.md
.squad/templates/skills/history-hygiene/SKILL.md
.squad/templates/skills/humanizer/SKILL.md
.squad/templates/skills/init-mode/SKILL.md
.squad/templates/skills/iterative-retrieval/SKILL.md
.squad/templates/skills/model-selection/SKILL.md
.squad/templates/skills/nap/SKILL.md
.squad/templates/skills/notification-routing/SKILL.md
.squad/templates/skills/personal-squad/SKILL.md
.squad/templates/skills/pr-review-response/SKILL.md
.squad/templates/skills/ralph-two-pass-scan/SKILL.md

Metadata

Files
0
Version
bd4e082
Hash
8a384ce6
Indexed
2026-08-20 14:06

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-25 16:42
浙ICP备14020137号-1 $방문자$