storybook-config

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

16 stars

Best use case

storybook-config is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

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

Teams using storybook-config should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/storybook-config/SKILL.md --create-dirs "https://raw.githubusercontent.com/diegosouzapw/awesome-omni-skill/main/skills/development/storybook-config/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/storybook-config/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How storybook-config Compares

Feature / Agentstorybook-configStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

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

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# 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

```bash
# 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

| Framework | Storybook Package | Minimum Version | Bundler |
|-----------|------------------|----------------|---------|
| React | `@storybook/react-vite` | 18.0.0 | Vite (preferred), Webpack |
| Vue | `@storybook/vue3-vite` | 3.0.0 | Vite (preferred), Webpack |
| Svelte | `@storybook/svelte-vite` | 5.0.0 | Vite |
| Angular | `@storybook/angular` | 18.0.0 | Webpack |
| Next.js | `@storybook/nextjs-vite` | 14.0.0 | Vite |
| Solid.js | `@storybook/solid-vite` | 1.8.0 | Vite |
| Lit | `@storybook/web-components-vite` | 3.0.0 | Vite |

### SOTA Patterns (2026)

**1. Vitest Integration for Testing**
```typescript
// main.ts - Enable Vitest addon
addons: [
  '@storybook/addon-vitest', // Real browser testing
]
```

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

**3. Autodocs with Tags**
```typescript
// 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**
```typescript
// 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**
```typescript
// 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:
```typescript
// 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:
```typescript
// 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

```typescript
// 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)

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

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

### Accessibility Tests

```typescript
// 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

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

// Run with coverage
npm run storybook:coverage
```

## Configuration Templates

### React with TypeScript (SOTA)

```typescript
// .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;
```

```typescript
// .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

Related Skills

tailwind-configuration

16
from diegosouzapw/awesome-omni-skill

Use when setting up or customizing Tailwind CSS configuration, theme customization, plugins, and build setup. Covers tailwind.config.js setup and content paths.

storybook-setup

16
from diegosouzapw/awesome-omni-skill

Sets up Storybook for component documentation with controls, actions, accessibility testing, and visual regression. Use when users request "Storybook setup", "component documentation", "UI library", "component stories", or "design system docs".

storybook-configuration

16
from diegosouzapw/awesome-omni-skill

Use when setting up or configuring Storybook for a project. Covers main configuration, addons, builders, and framework-specific setup.

n8n-node-configuration

16
from diegosouzapw/awesome-omni-skill

Operation-aware node configuration guidance. Use when configuring nodes, understanding property dependencies, determining required fields, choosing between get_node detail levels, or learning common configuration patterns by node type.

greptile-config

16
from diegosouzapw/awesome-omni-skill

Generate production-ready Greptile AI code review configuration for any repository. Use this skill whenever the user mentions Greptile, AI code review setup, PR review configuration, automated code review rules, or wants to set up .greptile/ config files. Also trigger when someone says "set up code review", "configure PR reviews", "add review rules", or asks about Greptile configuration — even if they don't say "Greptile" explicitly but describe wanting AI-powered PR review automation. This skill analyzes the actual repository structure and produces tailored config, not generic boilerplate.

env-config-validator

16
from diegosouzapw/awesome-omni-skill

Validate environment configuration files across local, staging, and production environments. Ensure required secrets, database URLs, API keys, and public variables are properly scoped and set. Use this skill when setting up environments, validating configuration, checking for missing secrets, auditing environment variables, ensuring proper scoping of public vs private vars, or troubleshooting environment issues. Trigger terms include env, environment variables, secrets, configuration, .env file, environment validation, missing variables, config check, NEXT_PUBLIC, env vars, database URL, API keys.

configure

16
from diegosouzapw/awesome-omni-skill

Configure pattern-radar sources, weights, and domains.

configure-chatkit

16
from diegosouzapw/awesome-omni-skill

This skill should be used when setting up OpenAI ChatKit in Next.js, adding domain allowlist to environment, building chat UI component, integrating with /api/chat endpoint, displaying history and tool calls visually, and integrating Better Auth session.

config-generate

16
from diegosouzapw/awesome-omni-skill

Generate configuration files for development tools

config-builder

16
from diegosouzapw/awesome-omni-skill

Creates new KrakenD configurations with best practices, proper structure, and edition-appropriate features

config-audit

16
from diegosouzapw/awesome-omni-skill

This skill should be used when auditing or comparing Claude Code and Cursor IDE configurations to identify feature gaps, equivalencies, and migration opportunities. Useful when managing AI development tooling across both platforms or deciding how to structure AI workflows.

babel-config

16
from diegosouzapw/awesome-omni-skill

Generates Babel configuration for JavaScript transpilation in tests. Creates babel.config.js file.