Skip to content
Back to skills

Collection

ASecurity

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.

  • 24 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added September 8, 2026
testingtypescriptbashreacttestingdebugging

Works with

  • mcp

Security analysis

A100/100

Pro scans all 21 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add mattnigh/skills_collection --skill collection --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Collection?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Collection
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/mattnigh-collection-bc6fd01e/badge)](https://www.skillsdirectory.com/skills/mattnigh-collection-bc6fd01e)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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.md15.1 KB
  • 17hz__nextjs-template__claude__skills__example-skill__SKILL.md316 B
  • 1ambda__dataops-platform__claude__skills__context-synthesis__SKILL.md3.5 KB
  • 1natsu172__dotfiles__claude__skills__git-analysis__SKILL.md5.4 KB
  • 1natsu172__dotfiles__claude__skills__github-pr-best-practices__SKILL.md7.7 KB
  • 23Maestro__prospect-pipeline__claude__skills__npid-fastapi-skill.md26.1 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-code-javascript__SKILL.md15.7 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-code-python__SKILL.md17.5 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-expression-syntax__SKILL.md9.4 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-mcp-tools-expert__SKILL.md12.5 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-node-configuration__SKILL.md16.6 KB
  • 360AYA25__ClaudeN8N__claude__skills__n8n-workflow-patterns__SKILL.md11.2 KB
  • 3x-Projetos__claude-memory-framework__claude__skills__scientist__SKILL.md14.8 KB
  • 5MinFutures__futures-arena__claude__skills__migration-tracker__SKILL.md16.2 KB
  • 5MinFutures__futures-arena__claude__skills__planning-guidelines__SKILL.md11.8 KB
  • 92Bilal26__TaskPilotAI__claude__skills__assessment-builder__SKILL.md17.5 KB
  • 92Bilal26__TaskPilotAI__claude__skills__book-scaffolding__SKILL.md19.1 KB
  • 92Bilal26__TaskPilotAI__claude__skills__code-validation-sandbox__SKILL.md6.2 KB
  • 92Bilal26__TaskPilotAI__claude__skills__exercise-designer__SKILL.md18.1 KB
  • 92Bilal26__TaskPilotAI__claude__skills__learning-objectives__SKILL.md24.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in testing →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.