一键导入
testing
Testing strategy orchestrator. Use when discussing test types, test order, or choosing how to test something. Auto-apply for general testing questions.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Testing strategy orchestrator. Use when discussing test types, test order, or choosing how to test something. Auto-apply for general testing questions.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Visual regression for canvas-rendered matrix progressions. Tests filmstrip strips that show how 2D data evolves visually over time. Auto-apply when editing *Progressions.ts strip definitions or stories with filmstrip components.
Screenshot testing for React components with Playwright. Captures component pixels and compares to baselines. Auto-apply when editing React component stories or *.visual.spec.ts files that test UI components.
Pure logic and math testing with Vitest. Use for single-point assertions on functions, state transitions, and physics calculations. Auto-apply when editing *.test.ts files (except *Progressions.test.ts).
Matrix data model verification using ASCII diagrams. Use when working with *Progressions.ts files, defineProgression(), or testing how 2D numeric grids evolve over time. Auto-apply when editing files matching *Progressions.ts or src/test-utils/ascii*.ts.
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.
Apply project planning conventions when creating or organizing plans. Use when user asks to create a plan, add a feature plan, document a bug, or work with the plans/ directory.
| name | testing |
| description | Testing strategy orchestrator. Use when discussing test types, test order, or choosing how to test something. Auto-apply for general testing questions. |
This skill coordinates testing strategy across all test types. Tests are colocated with the code they test - when viewing a module, you see all its tests nearby.
Testing
│
├── Static Analysis
│ └── Linting ─────────────────── ESLint syntax/import checks
│
├── Data Model Tests (Vitest)
│ ├── Pure Logic Tests ────────── Single functions, math, state transitions
│ └── Matrix Progression Tests ── 2D grid evolution over time (ASCII diagrams)
│
├── Component Tests (Vitest + Testing Library)
│ └── React Component Tests ───── Behavior, state, user interactions
│
├── Visual Regression (Playwright)
│ ├── Component Screenshots ───── React component pixel comparison
│ └── Canvas Filmstrip Tests ──── Matrix-to-canvas rendered progressions
│
└── Integration / E2E (Playwright)
└── Smoke Tests ─────────────── App loads without JS errors
All tests are colocated with their source. When you open a folder, you see the code and all its tests together.
| Test Type | File Pattern | Colocated With | Skill |
|---|---|---|---|
| Pure logic | *.test.ts | src/**/*.ts | logic-testing |
| Matrix progression | *Progressions.test.ts | src/render/*Progressions.ts | matrix-data-model-progression-testing |
src/state/
waveModel.ts ← Source
waveModel.test.ts ← Logic test (colocated)
src/render/
bathymetryProgressions.ts ← Matrix definitions
bathymetryProgressions.test.ts ← ASCII progression test (colocated)
| Test Type | File Pattern | Colocated With | Skill |
|---|---|---|---|
| React behavior | *.test.tsx | src/**/*.tsx | logic-testing (same patterns) |
src/ui/
WaveControls.tsx ← Component
WaveControls.test.tsx ← Behavior test (colocated)
| Test Type | File Pattern | Colocated With | Skill |
|---|---|---|---|
| Component screenshots | *.visual.spec.ts | stories/**/ | component-screenshot-testing |
| Canvas filmstrips | *.visual.spec.ts | stories/**/ | canvas-filmstrip-testing |
stories/01-bathymetry/
01-bathymetry.mdx ← Story documentation
01-bathymetry.visual.spec.ts ← Visual test (colocated)
strip-bathymetry-basic.png ← Baseline screenshot (colocated)
strip-bathymetry-features.png ← Baseline screenshot (colocated)
| Test Type | File Pattern | Location | Skill |
|---|---|---|---|
| Smoke test | smoke.spec.js | tests/ | (this skill) |
| E2E tests | *.spec.js | tests/ | (this skill) |
| What you're testing | Test type | File to create |
|---|---|---|
| Pure function returns correct value | Logic test | myModule.test.ts next to myModule.ts |
| Matrix evolves correctly over time | Progression test | *Progressions.test.ts with ASCII assertions |
| React component behavior/state | Component test | MyComponent.test.tsx next to MyComponent.tsx |
| Rendered pixels match baseline | Visual regression | *.visual.spec.ts in stories/ folder |
| App loads without crashing | Smoke test | tests/smoke.spec.js |
Run cheap tests first to catch issues early:
┌─────────────────────────────────────────────────────────────┐
│ 1. Lint ~1s npm run lint │
├─────────────────────────────────────────────────────────────┤
│ 2. Smoke ~3s npx playwright test │
│ tests/smoke.spec.js │
├─────────────────────────────────────────────────────────────┤
│ 3. Logic/Progression ~secs npx vitest run <file> │
├─────────────────────────────────────────────────────────────┤
│ 4. Component Tests ~secs npx vitest run <file> │
├─────────────────────────────────────────────────────────────┤
│ 5. Visual Regression ~mins npm run test:visual: │
│ headless │
└─────────────────────────────────────────────────────────────┘
Stop and fix at the first failure. Don't run expensive visual tests when data tests are failing.
# Static analysis
npm run lint # ~1s
# Smoke test
npx playwright test tests/smoke.spec.js # ~3s
# Data model tests (Vitest)
npx vitest run src/path/file.test.ts # Specific file
npx vitest run src/render/*Progressions* # All progression tests
npm test # All Vitest tests
# Visual regression (Playwright)
npm run stories:build # Verify stories compile
npm run test:visual:headless # Run visual regression
npm run test:visual:update:headless # Update baselines
npm run reset:visual # Clear results
npm run reset:visual:all # Clear results + baselines
| Symptom | Likely cause | Which test to check |
|---|---|---|
| Logic test fails | Bug in function | *.test.ts colocated with source |
| ASCII progression differs | Data model bug | *Progressions.test.ts |
| Component test fails | React behavior bug | *.test.tsx colocated with component |
| Visual test fails, data correct | Rendering/CSS bug | *.visual.spec.ts in stories |
| All pass, browser wrong | CSS transition conflict | Check 60fps element transitions |
| Skill | What it tests | Key files |
|---|---|---|
logic-testing | Pure functions, math, state | *.test.ts |
matrix-data-model-progression-testing | 2D grid evolution (ASCII) | *Progressions.test.ts |
component-screenshot-testing | React component pixels | UI component *.visual.spec.ts |
canvas-filmstrip-testing | Canvas-rendered matrix strips | Progression *.visual.spec.ts |
visual-regression | Shared visual test infrastructure | All *.visual.spec.ts |
Tests live next to what they test. Don't hunt for tests in a separate tests/ tree.
Never run visual tests when data tests fail. The matrix is the source of truth - if the numbers are wrong, the pixels will be wrong too.
src/test-utils/ is foundational. A bug there corrupts all tests:
npx vitest run src/test-utils/