Back to skills
SKILL.md
Collection
ASecurityScreenshot-based regression testing with Playwright. Compares rendered pixels against baseline PNGs. Use when working with stories, *.visual.spec.ts files, or baseline screenshots. Auto-apply when editing files in stories/ or *.visual.spec.ts.
- 24 stars
- 0 votes
- 0 copies
- 4 views
- Added September 8, 2026
Works with
Security analysis
100/100Pro scans all 21 files and shows the line behind each finding
npx -y skills add mattnigh/skills_collection --skill collection --agent claude-codeAre you the author of Collection?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/mattnigh-collection-bc6fd01e)---
name: visual-regression
description: Screenshot-based regression testing with Playwright. Compares rendered pixels against baseline PNGs. Use when working with stories, *.visual.spec.ts files, or baseline screenshots. Auto-apply when editing files in stories/ or *.visual.spec.ts.
---
# Visual Regression Skill
Orchestrates **screenshot-based regression testing** with Playwright. Compares rendered pixels against baseline PNGs to detect unintended visual changes.
## Specialized Skills
Visual regression has two specialized skills:
| Skill | Purpose | Use When |
|-------|---------|----------|
| `component-screenshot-testing` | React component pixels | Testing UI components, buttons, panels |
| `canvas-filmstrip-testing` | Canvas-rendered matrix progressions | Testing 8-layer filmstrip visualizations |
## Shared Infrastructure
### Directory Structure
```
stories/
01-bathymetry/
01-bathymetry.mdx → MDX story page
01-bathymetry.visual.spec.ts → Playwright visual test
strip-bathymetry-basic.png → Baseline screenshot (colocated)
02-energy-field/
...
components/ → Shared story components
visual-test-helpers.ts → Test helper utilities
App.tsx → Story viewer app
```
### Playwright Configuration
```typescript
// playwright.visual.config.js
testDir: './stories',
testMatch: '**/*.visual.spec.ts',
snapshotPathTemplate: 'stories/{testFileDir}/{arg}{ext}',
```
## Commands
```bash
# Verify stories compile (fast, no dev server)
npm run stories:build
# Run visual regression tests
npm run test:visual:headless # CI/agents
npm run test:visual:headed # Debugging with browser UI
# Update baselines after intentional changes
npm run test:visual:update:headless
npm run test:visual:update:headed
# Clear test artifacts
npm run reset:visual # Clear results/reports only
npm run reset:visual:all # Clear results + colocated baselines
# Start stories dev server for interactive debugging
npm run stories # Starts on http://localhost:3001
```
## Interactive Debugging with Chrome DevTools MCP
**IMPORTANT**: Always use the dev server (localhost), NOT `file://` URLs. The `file://` protocol triggers CORS errors.
### Start Dev Server
```bash
npm run stories # Starts on http://localhost:3001
```
### Launch in Browser
```typescript
mcp__chrome-devtools__new_page({ url: "http://localhost:3001" })
// Navigate to specific page
mcp__chrome-devtools__new_page({ url: "http://localhost:3001/?page=01-bathymetry" })
// With presentation mode and theme
mcp__chrome-devtools__new_page({ url: "http://localhost:3001/?mode=presentation&theme=light" })
```
### Take Snapshots and Screenshots
```typescript
// Get element UIDs
mcp__chrome-devtools__take_snapshot()
// Screenshot specific element
mcp__chrome-devtools__take_screenshot({ uid: "<element-uid>" })
// Reload after changes
mcp__chrome-devtools__navigate_page({ type: "reload" })
```
## Workflow: Data Before Visual
**CRITICAL**: When modifying progression data, verify data first:
1. **Run data tests** - `npx vitest run *Progressions.test.ts`
2. **Verify matrix values** - Check ASCII output shows expected changes
3. **Then update visuals** - Only after data tests pass
```
Wrong: Change coefficient → Update visual → "Looks the same"
Right: Change coefficient → Check matrix → Verify numbers → Update visual
```
## Verifying Stories
After code changes, verify stories still build:
```bash
npm run stories:build
```
This catches broken imports, type errors, missing dependencies.
**Do NOT start dev server** just to verify - use the build.
## Common Issues
### Import Extensions After TS Migration
```typescript
// Wrong
import { foo } from '../state/waveModel.js';
// Correct
import { foo } from '../state/waveModel';
```
### Missing Exports
```typescript
// In *Progressions.ts - ensure strips are exported
export const BATHYMETRY_STRIPS = [BATHYMETRY_STRIP_BASIC];
```
## Related Skills
- **component-screenshot-testing** - React component pixel testing
- **canvas-filmstrip-testing** - Matrix-to-canvas filmstrip testing
- **matrix-data-model-progression-testing** - Data verification before visual
Files in this skill
- 0Chan-smc__claude-code-workflow-lab__claude__skills__frontend-dev-guidelines__SKILL.md
- 17hz__nextjs-template__claude__skills__example-skill__SKILL.md
- 1ambda__dataops-platform__claude__skills__context-synthesis__SKILL.md
- 1natsu172__dotfiles__claude__skills__git-analysis__SKILL.md
- 1natsu172__dotfiles__claude__skills__github-pr-best-practices__SKILL.md
- 23Maestro__prospect-pipeline__claude__skills__npid-fastapi-skill.md
- 360AYA25__ClaudeN8N__claude__skills__n8n-code-javascript__SKILL.md
- 360AYA25__ClaudeN8N__claude__skills__n8n-code-python__SKILL.md
- 360AYA25__ClaudeN8N__claude__skills__n8n-expression-syntax__SKILL.md
- 360AYA25__ClaudeN8N__claude__skills__n8n-mcp-tools-expert__SKILL.md
- 360AYA25__ClaudeN8N__claude__skills__n8n-node-configuration__SKILL.md
- 360AYA25__ClaudeN8N__claude__skills__n8n-workflow-patterns__SKILL.md
- 3x-Projetos__claude-memory-framework__claude__skills__scientist__SKILL.md
- 5MinFutures__futures-arena__claude__skills__migration-tracker__SKILL.md
- 5MinFutures__futures-arena__claude__skills__planning-guidelines__SKILL.md
- 92Bilal26__TaskPilotAI__claude__skills__assessment-builder__SKILL.md
- 92Bilal26__TaskPilotAI__claude__skills__book-scaffolding__SKILL.md
- 92Bilal26__TaskPilotAI__claude__skills__code-validation-sandbox__SKILL.md
- 92Bilal26__TaskPilotAI__claude__skills__exercise-designer__SKILL.md
- 92Bilal26__TaskPilotAI__claude__skills__learning-objectives__SKILL.md
Attribution
Related skills
View all in testing →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.