testing-suite
Use this skill when the user asks to "set up testing", "configure tests for Storybook", "add interaction tests", "add accessibility tests", "set up a11y testing", "configure Vitest", "configure Playwright", mentions "play functions", "test-storybook", "component testing", or wants to add comprehensive testing to their Storybook setup. This skill provides guidance on modern Storybook 10 testing with Vitest, Playwright, and axe-core.
What this skill does
# Testing Suite Skill
## Overview
Set up and configure comprehensive testing for Storybook 10 components, including interaction tests with play functions, accessibility testing with axe-core, and visual regression testing with Playwright.
This skill provides guidance on implementing modern component testing patterns using Storybook 10's integrated testing capabilities.
## What This Skill Provides
### Testing Strategy Guidance
Configure the right testing setup based on:
- **Project requirements**: Unit, integration, or end-to-end testing
- **Framework choice**: React Testing Library, Vue Testing Library, Svelte Testing Library
- **Testing scope**: Interaction tests, accessibility, visual regression
- **CI/CD integration**: GitHub Actions, GitLab CI, CircleCI
### Interaction Testing
Set up and write interaction tests using:
- **Play functions**: Simulate user interactions in stories
- **Testing Library**: Query elements by role, text, label
- **User events**: Click, type, keyboard, hover, focus
- **Assertions**: Verify component behavior and state
### Accessibility Testing
Configure accessibility validation with:
- **axe-core integration**: WCAG 2.1 compliance checking
- **ARIA validation**: Roles, labels, descriptions
- **Keyboard navigation**: Tab order, focus management
- **Screen reader support**: Semantic HTML, announcements
- **Color contrast**: WCAG AA/AAA compliance
### Visual Regression Testing
Set up visual regression tests with:
- **Playwright integration**: Real browser screenshots
- **Snapshot comparisons**: Detect unintended visual changes
- **Cross-browser testing**: Chromium, Firefox, WebKit
- **Responsive testing**: Multiple viewport sizes
## Testing Levels
### Level 1: Basic Stories
Stories with args and controls only (no automated tests).
**Best for:**
- Component showcases
- Design system documentation
- Quick prototyping
**Setup:**
```typescript
export const Primary: Story = {
args: {
variant: 'primary',
children: 'Button',
},
};
```
### Level 2: Interaction Tests
Stories with play functions that test user interactions.
**Best for:**
- Form components
- Interactive widgets
- State management verification
**Setup:**
```typescript
import { expect, userEvent, within } from 'storybook/test';
export const WithInteraction: Story = {
args: { children: 'Click me' },
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
const button = canvas.getByRole('button');
await expect(button).toBeInTheDocument();
await userEvent.click(button);
await expect(button).toHaveFocus();
},
};
```
### Level 3: Accessibility Tests
Stories with axe-core validation rules.
**Best for:**
- Public-facing applications
- Compliance requirements (WCAG 2.1)
- Accessible component libraries
**Setup:**
```typescript
export const AccessibilityValidation: Story = {
args: { children: 'Button' },
parameters: {
a11y: {
config: {
rules: [
{ id: 'button-name', enabled: true },
{ id: 'color-contrast', enabled: true },
{ id: 'focus-visible', enabled: true },
],
},
},
},
};
```
### Level 4: Full Testing Suite
Combination of interaction tests, accessibility tests, and visual regression.
**Best for:**
- Production applications
- Component libraries
- Critical user flows
## Storybook 10 Testing Features
### Vitest Integration
Storybook 10 uses Vitest as the default test runner:
**Benefits:**
- โก Fast: Runs in real browsers (not JSDOM)
- ๐ฆ Zero config: Works out of the box
- ๐ฏ Isolated: Each story runs in isolation
- ๐ Watch mode: Instant feedback on changes
**Setup:**
Add to `package.json`:
```json
{
"scripts": {
"test-storybook": "test-storybook"
}
}
```
### Portable Stories
Run stories directly in unit tests (Vitest/Jest) - perfect for reusable component libraries.
**Why use it:**
- Reuse stories as test cases (no duplication)
- Args, decorators, play functions work automatically
- Test outside Storybook in CI pipelines
- Share components across projects with tests included
**Setup:**
```typescript
// Button.test.tsx
import { composeStories } from '@storybook/react';
import { render, screen } from '@testing-library/react';
import * as stories from './Button.stories';
// Convert all stories to testable components
const { Primary, Disabled, WithIcon } = composeStories(stories);
describe('Button', () => {
it('renders primary variant', () => {
render(<Primary />);
expect(screen.getByRole('button')).toHaveClass('btn-primary');
});
it('runs interaction test from story', async () => {
const { container } = render(<WithIcon />);
// Play function from story runs automatically
await WithIcon.play?.({ canvasElement: container });
expect(screen.getByRole('button')).toHaveFocus();
});
it('respects disabled state', () => {
render(<Disabled />);
expect(screen.getByRole('button')).toBeDisabled();
});
});
```
**Single story:**
```typescript
import { composeStory } from '@storybook/react';
import meta, { Primary } from './Button.stories';
const PrimaryButton = composeStory(Primary, meta);
test('primary button', () => {
render(<PrimaryButton />);
// Test with all decorators and args applied
});
```
**With custom args override:**
```typescript
const { Primary } = composeStories(stories);
test('custom label', () => {
render(<Primary>Custom Text</Primary>);
expect(screen.getByText('Custom Text')).toBeInTheDocument();
});
```
### Playwright Integration
Real browser testing with Playwright:
**Benefits:**
- ๐ Real browsers: Chromium, Firefox, WebKit
- ๐ธ Screenshots: Visual regression testing
- ๐ฌ Video recording: Debug test failures
- ๐ Tracing: Step-by-step execution
**Setup:**
Storybook 10 includes Playwright by default. Configure in `.storybook/test-runner-jest.config.js`:
```javascript
export default {
browsers: ['chromium', 'firefox', 'webkit'],
screenshot: 'only-on-failure',
video: 'retain-on-failure',
};
```
### Testing Library Integration
Query components using accessible selectors:
**Recommended queries (in order of preference):**
1. `getByRole()` - Semantic HTML roles
2. `getByLabelText()` - Form labels
3. `getByPlaceholderText()` - Input placeholders
4. `getByText()` - Visible text content
5. `getByTestId()` - Last resort only
**Example:**
```typescript
const button = canvas.getByRole('button', { name: /submit/i });
const input = canvas.getByLabelText('Email address');
const heading = canvas.getByRole('heading', { level: 1 });
```
## Common Test Patterns
### Button Component Tests
```typescript
export const ButtonInteraction: Story = {
args: {
onClick: fn(),
children: 'Click me',
},
play: async ({ args, canvasElement }) => {
const canvas = within(canvasElement);
const button = canvas.getByRole('button');
// Test rendering
await expect(button).toBeInTheDocument();
// Test click
await userEvent.click(button);
await expect(args.onClick).toHaveBeenCalledTimes(1);
// Test disabled state
await expect(button).not.toBeDisabled();
},
};
```
### Input Component Tests
```typescript
export const InputInteraction: Story = {
args: {
label: 'Username',
onChange: fn(),
},
play: async ({ args, canvasElement }) => {
const canvas = within(canvasElement);
const input = canvas.getByLabelText('Username');
// Test typing
await userEvent.type(input, 'john.doe');
await expect(input).toHaveValue('john.doe');
// Test change handler
await expect(args.onChange).toHaveBeenCalled();
// Test validation
await userEvent.clear(input);
await expect(input).toHaveValue('');
},
};
```
### Modal Component Tests
```typescript
export const ModalInteraction: Story = {
args: {
isOpen: true,
onClose: fn(),
title: 'Confirm Action',
},
play: async ({ args, canvasElement }) => {
const canvas = within(canvasElement);
const dialog = canvas.getByRole('diaRelated in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context โ no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes โ information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development โ guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.