/playwright-visual:visual-project-structurefrom playwright-visual
Scaffold the visual regression test directory layout, configure `.gitattributes` for Git LFS on PNG baselines, and generate snapshot update helper scripts.
Claude never picks this skill on its own
Its frontmatter has no description. Without a description, Claude Code leaves it out of the list Claude chooses from. Typing /playwright-visual:visual-project-structure still runs it.
What the skill costs in Claude's context, stage by stage
No description Claude Code can read, so Claude's list leaves it out: only you can start it.
SKILL.md joins the conversation and stays.
Scaffold the visual regression test directory layout, configure .gitattributes for Git LFS on PNG baselines, and generate snapshot update helper scripts.
tests/visual/__screenshots__/ with a .gitkeep so the empty directory is tracked..gitattributes entries for PNG LFS tracking.tests/
└── visual/
├── specs/ # Visual spec files (*.visual.spec.ts)
│ ├── landing.visual.spec.ts
│ ├── dashboard.visual.spec.ts
│ └── components/
│ ├── button.visual.spec.ts
│ └── card.visual.spec.ts
├── __screenshots__/ # Baseline PNG storage (Git LFS)
│ ├── .gitkeep
│ ├── landing-desktop-chromium-linux.png
│ ├── landing-mobile-chromium-linux.png
│ └── ...
└── helpers/
├── disable-animations.ts # Shared animation-disabling utility
└── update-snapshots.sh # Baseline update helper script
# Create the directory structure
mkdir -p tests/visual/specs/components
mkdir -p tests/visual/__screenshots__
mkdir -p tests/visual/helpers
# Ensure the empty screenshots directory is tracked by git
touch tests/visual/__screenshots__/.gitkeep
git add tests/visual/__screenshots__/.gitkeep
.gitattributes ConfigurationAdd to .gitattributes at the repository root:
# Visual regression baselines — track with Git LFS
tests/visual/__screenshots__/**/*.png filter=lfs diff=lfs merge=lfs -text
Initialize LFS and apply tracking:
git lfs install
git lfs track "tests/visual/__screenshots__/**/*.png"
# Verify tracking
git lfs ls-files
tests/visual/helpers/disable-animations.tsimport { Page } from '@playwright/test';
/**
* Injects a style tag that sets all CSS animation and transition durations to 0.
* Call this after navigation and before every toHaveScreenshot() assertion.
*/
export async function disableAnimations(page: Page): Promise<void> {
await page.addStyleTag({
content: `
*, *::before, *::after {
animation-duration: 0s !important;
animation-delay: 0s !important;
transition-duration: 0s !important;
transition-delay: 0s !important;
}
`,
});
}
tests/visual/helpers/update-snapshots.sh#!/usr/bin/env bash
# Usage:
# ./tests/visual/helpers/update-snapshots.sh # update all baselines
# ./tests/visual/helpers/update-snapshots.sh "hero" # update matching pattern
set -euo pipefail
PATTERN="${1:-}"
if [[ -n "$PATTERN" ]]; then
echo "Updating baselines matching: $PATTERN"
npx playwright test --project=visual --update-snapshots --grep "$PATTERN"
else
echo "Updating ALL visual baselines"
npx playwright test --project=visual --update-snapshots
fi
echo ""
echo "Review the diff in the HTML report before committing:"
echo " npx playwright show-report"
echo ""
echo "Stage changed baselines:"
echo " git diff --stat tests/visual/__screenshots__/"
Make executable:
chmod +x tests/visual/helpers/update-snapshots.sh
| Surface | File name |
|---|---|
| Full page | <page-name>.visual.spec.ts |
| Component | components/<component-name>.visual.spec.ts |
| Responsive sweep | <page-name>-responsive.visual.spec.ts |
playwright.config.ts Pointerexport default defineConfig({
snapshotDir: 'tests/visual/__screenshots__',
projects: [
{
name: 'visual',
testMatch: 'tests/visual/**/*.visual.spec.ts',
use: { ...devices['Desktop Chrome'], viewport: { width: 1280, height: 800 } },
},
],
});
tests/visual/specs/; never mix visual specs with functional E2E specs.__screenshots__/ directory must be tracked by Git (or Git LFS for large repos); do not gitignore it.disableAnimations from the shared helper rather than inlining the style tag in every spec.npx playwright show-report before staging baseline changes.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub gagandeepp/software-agent-teams --plugin playwright-visualNone: SKILL.md is the whole skill.
6 skills in this plugin
/screenshot-baselineSkill: screenshot-baselineManage the full lifecycle of visual regression baselines: initial capture, intentional updates, platform-specific naming conventions, Git LFS storage, and PR review gates./visual-assertionsSkill: visual-assertionsPatterns for `toHaveScreenshot` and `toMatchSnapshot` assertions: full-page vs element captures, all supported options, masking dynamic regions, and DO / DON'T examples./visual-comparison