Skip to content
storybook-config logo

Storybook Configuration Skill

storybook-config

Generate and configure Storybook 9 for any framework with automatic detection, SOTA best practices, and platform-specific optimizations (Web, Tauri, Electron)

SKILL.md

Full skill instructions

Storybook Configuration Skill

Overview

This skill generates production-ready Storybook 9 configurations with:

  • Automatic framework detection (React, Vue, Svelte, Angular, Next.js, Solid, Lit)
  • SOTA 2026 best practices
  • Platform-specific optimizations (Tauri full support, Electron partial support)
  • Optional visual generation integration
  • Testing framework setup (Vitest + Playwright)

When to Use This Skill

This skill should be used when:

  • Initializing Storybook 9 in a new project
  • Updating existing Storybook configuration to SOTA standards
  • Adding framework-specific optimizations
  • Configuring platform-specific setups (Tauri, Electron)
  • Setting up testing infrastructure (interaction, a11y, visual)

Quick Start

# Detect project framework and configuration
bash ${CLAUDE_PLUGIN_ROOT}/​scripts/​detect-framework.sh

# Use skill to generate configuration
# The skill will use AskUserQuestion for user preferences

Configuration Generation

Supported Frameworks

FrameworkStorybook PackageMinimum VersionBundler
React@storybook/​react-vite18.0.0Vite (preferred), Webpack
Vue@storybook/​vue3-vite3.0.0Vite (preferred), Webpack
Svelte@storybook/​svelte-vite5.0.0Vite
Angular@storybook/​angular18.0.0Webpack
Next.js@storybook/​nextjs-vite14.0.0Vite
Solid.js@storybook/​solid-vite1.8.0Vite
Lit@storybook/​web-components-vite3.0.0Vite

SOTA Patterns (2026)

1. Vitest Integration for Testing

// main.ts - Enable Vitest addon
addons: [
  '@storybook/​addon-vitest', // Real browser testing
]

2. Accessibility Testing

// preview.ts - Configure axe-core
parameters: {
  a11y: {
    config: {
      rules: [
        { id: 'color-contrast', enabled: true },
        { id: 'button-name', enabled: true },
      ],
    },
  },
}

3. Autodocs with Tags

// main.ts - Auto-generate documentation
docs: {
  autodocs: 'tag', // Stories with 'autodocs' tag get automatic docs
}

// story.tsx
export default {
  tags: ['autodocs'], // Enable automatic documentation
}

4. Performance Optimization

// main.ts - Vite optimization
viteFinal: async (config) => {
  return {
    ...config,
    optimizeDeps: {
      include: ['@storybook/​blocks'],
    },
  };
}

// Build optimization for CI
build: {
  test: {
    disabledAddons: ['@storybook/​addon-docs'], // 2-4x faster
  },
}

5. Modern Controls

// preview.ts - Enhanced controls
controls: {
  matchers: {
    color: /(background|color)$/​i,
    date: /​Date$/​i,
  },
  expanded: true, // Show all controls by default
}

Platform-Specific Configuration

Web Projects (Full Support)

Standard configuration with all features:

  • Interaction tests
  • Accessibility tests
  • Visual regression tests
  • Code coverage

Tauri Projects (Full Support)

Additional configuration:

// preview.ts - Tauri IPC mocks
decorators: [
  (Story) => {
    if (typeof window !== 'undefined' && !window.__TAURI__) {
      window.__TAURI__ = tauriMocks;
    }
    return Story();
  },
]

Best Practices:

  • Run Storybook on separate port (6006) from Tauri dev server (5173)
  • Mock window.__TAURI__ APIs in stories
  • Keep UI components decoupled from IPC logic

Electron Projects (Partial Support)

Webpack overrides required:

// main.ts - Electron configuration
webpackFinal: async (config) => {
  config.target = 'web'; // Override electron-renderer
  config.externals = {}; // Clear Electron externals
  config.resolve.alias = {
    electron: false, // Mock electron module
  };
  return config;
}

// preview.ts - Electron preload API mocks
decorators: [
  (Story) => {
    if (typeof window !== 'undefined' && !window.api) {
      window.api = electronMocks;
    }
    return Story();
  },
]

Limitations:

  • Only pure UI components fully testable
  • Components with direct electron imports need refactoring
  • IPC integration requires E2E tests separately

Design System Integration

Detected Design Systems

The skill detects and integrates with:

  • Material UI (MUI) - Theme provider wrapper
  • Ant Design - ConfigProvider wrapper
  • shadcn/​ui - Tailwind + Radix UI setup
  • Chakra UI - ChakraProvider wrapper
  • Mantine - MantineProvider wrapper

Example: MUI Integration

// preview.ts
import { ThemeProvider, createTheme } from '@mui/​material/​styles';
import CssBaseline from '@mui/​material/​CssBaseline';

const theme = createTheme({
  palette: {
    mode: 'light',
  },
});

export const decorators = [
  (Story) => (
    <ThemeProvider theme={theme}>
      <CssBaseline />
      <Story />
    </​ThemeProvider>
  ),
];

Testing Configuration

Interaction Tests (Play Functions)

// Install dependencies
npm install --save-dev @testing-library/​react @testing-library/​user-event

// Enable addon
npx storybook@latest add @storybook/​addon-vitest

Accessibility Tests

// Install addon
npx storybook@latest add @storybook/​addon-a11y

// Configure in preview.ts
parameters: {
  a11y: {
    element: '#storybook-root',
    config: {
      rules: [
        { id: 'color-contrast', enabled: true },
      ],
    },
  },
}

Coverage Reports

// Install V8 coverage
npm install --save-dev @vitest/​coverage-v8

// Run with coverage
npm run storybook:coverage

Configuration Templates

React with TypeScript (SOTA)

// .storybook/​main.ts
import type { StorybookConfig } from '@storybook/​react-vite';

const config: StorybookConfig = {
  stories: ['../​src/​**/​*.mdx', '../​src/​**/​*.stories.@(js|jsx|mjs|ts|tsx)'],
  addons: [
    '@storybook/​addon-essentials',
    '@storybook/​addon-vitest',
    '@storybook/​addon-a11y',
    '@storybook/​addon-links',
  ],
  framework: {
    name: '@storybook/​react-vite',
    options: {
      strictMode: true,
    },
  },
  docs: {
    autodocs: 'tag',
  },
  viteFinal: async (config) => {
    return {
      ...config,
      optimizeDeps: {
        include: ['@storybook/​blocks'],
      },
    };
  },
};

export default config;
// .storybook/​preview.ts
import type { Preview } from '@storybook/​react-vite';
import '../​src/​index.css'; // Global styles

const preview: Preview = {
  parameters: {
    actions: { argTypesRegex: '^on[A-Z].*' },
    controls: {
      matchers: {
        color: /(background|color)$/​i,
        date: /​Date$/​i,
      },
      expanded: true,
    },
    layout: 'centered',
    a11y: {
      config: {
        rules: [
          { id: 'color-contrast', enabled: true },
        ],
      },
    },
    backgrounds: {
      default: 'light',
      values: [
        { name: 'light', value: '#ffffff' },
        { name: 'dark', value: '#1a1a1a' },
      ],
    },
  },
  globalTypes: {
    theme: {
      description: 'Global theme for components',
      defaultValue: 'light',
      toolbar: {
        title: 'Theme',
        icon: 'circlehollow',
        items: ['light', 'dark'],
        dynamicTitle: true,
      },
    },
  },
};

export default preview;

Quality Checklist

Before completing configuration:

  • Framework detected correctly
  • Correct Storybook 9 packages installed
  • Addons configured based on user preferences
  • Theme/​design system integrated (if applicable)
  • Platform-specific setup complete (Tauri/​Electron)
  • Example stories generated
  • package.json scripts added
  • README created with setup instructions
  • Tests run successfully

Best Practices

Do's

  • Use Vite for faster builds (when possible)
  • Enable autodocs with tags
  • Configure a11y testing by default
  • Optimize Vite dependencies
  • Use V8 coverage (faster than Istanbul)
  • Provide platform-specific guidance

Don'ts

  • Don't use Webpack unless required (Angular, legacy projects)
  • Don't skip accessibility configuration
  • Don't forget to add example stories
  • Don't configure features user didn't select
  • Don't assume all components work in Electron (document limitations)

Integration with Other Skills

  • story-generation: Use configuration to generate framework-specific stories
  • visual-design: Use detected design system for visual generation
  • platform-support: Apply platform-specific patterns (Tauri/​Electron)
  • testing-suite: Configure test infrastructure based on user selections

More skills from diegosouzapw

accessibility logo
diegosouzapw/awesome-omni-skill

accessibility

Accessibility guidelines for VS Code features — covers accessibility help dialogs, accessible views, verbosity settings, accessibility signals, ARIA alerts/status announcements, keyboard navigation, and ARIA labels/roles. Applies to both new interactive UI surfaces and updates to existing feature...

62 1
View
mermaid-diagrams logo
diegosouzapw/awesome-omni-skill

mermaid-diagrams

Mermaid diagram creation for flowcharts, sequences, ERDs, and more. Generate diagrams from text in markdown files. Use for documentation, architecture diagrams, and visual representations. Triggers on mermaid, flowchart, sequence diagram, ERD, entity relationship, gantt chart, pie chart, class di...

62 1
View
tauri2-react-rust logo
diegosouzapw/awesome-omni-skill

tauri2-react-rust

Guides development of cross-platform desktop apps with Tauri 2, TypeScript, React, and Rust. Use when building Tauri apps, implementing IPC, designing Rust backend or TypeScript/React frontend, when researching or cloning a website (open site, snapshot elements), when verifying local dev or built...

62 1
View
fp-ts-errors logo
diegosouzapw/awesome-omni-skill

fp-ts-errors

Handle errors as values using fp-ts Either and TaskEither for cleaner, more predictable TypeScript code. Use when implementing error handling patterns with fp-ts.

62 0
View
ring:pre-dev-research logo
diegosouzapw/awesome-omni-skill

ring:pre-dev-research

Gate 0 research phase for pre-dev workflow. Dispatches 3 parallel research agents to gather codebase patterns, external best practices, and framework documentation BEFORE creating PRD/TRD. Outputs research.md with file:line references.

62 0
View
create-assistant logo
diegosouzapw/awesome-omni-skill

create-assistant

Create and configure Vapi voice AI assistants with models, voices, transcribers, tools, hooks, and advanced settings. Use when building voice agents, phone bots, customer support assistants, or any conversational AI that handles phone or web calls.

62 0
View
codex-headless logo
diegosouzapw/awesome-omni-skill

codex-headless

Delegiere Aufgaben an OpenAI Codex CLI im Headless-Mode. Nutzt ChatGPT Subscription (KEIN API Key). Nur Workspace-Zugriff, KEIN System-Zugriff. Auto-Accept mit --full-auto. Web-Recherche mit --search.

62 0
View
social-media-scheduler logo
diegosouzapw/awesome-omni-skill

social-media-scheduler

Generate a full week of social media content for any topic. Outputs platform-optimized posts for Twitter/X, LinkedIn, and Instagram with hashtags and posting times.

62 0
View
Data Privacy Compliance logo
diegosouzapw/awesome-omni-skill

Data Privacy Compliance

Data privacy and regulatory compliance specialist for GDPR, CCPA, HIPAA, and international data protection laws. Use when implementing privacy controls, conducting data protection impact assessments, ensuring regulatory compliance, or managing data subject rights. Expert in consent management, da...

62 0
View
triple-review logo
diegosouzapw/awesome-omni-skill

triple-review

Reviews a task using the TRIPLE protocol, as the review agent.

62 0
View
Tech Stack & Architecture Decision logo
diegosouzapw/awesome-omni-skill

Tech Stack & Architecture Decision

Define and document the technology stack and architecture decisions for a project. Use when the user needs to choose a tech stack, make architecture decisions, define infrastructure choices, or document technology selections. Triggers on requests like "define the tech stack", "choose technologies...

62 0
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View