storybook-configuration
БесплатноБез исполняемых скриптовНе проверенUse when setting up or configuring Storybook for a project. Covers main configuration, addons, builders, and framework-specific setup.
от TheBushidoCollective★ 202 звезды на GitHubОб этом скилле
Storybook - Configuration
Configure Storybook for optimal development experience with the right addons, builders, and framework integrations.
Key Concepts
Main Configuration
.storybook/main.ts is the primary configuration file:
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-interactions',
'@storybook/addon-a11y',
],
framework: {
name: '@storybook/react-vite',
options: {},
},
docs: {
autodocs: 'tag',
},
};
export default config;
Preview Configuration
.storybook/preview.ts configures how stories are rendered:
import type { Preview } from '@storybook/react';
import '../src/index.css';
const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
globalTypes: {
theme: {
description: 'Global theme for components',
defaultValue: 'light',
toolbar: {
title: 'Theme',
icon: 'circlehollow',
items: ['light', 'dark'],
dynamicTitle: true,
},
},
},
};
export default preview;
Addons
Addons extend Storybook functionality:
- @storybook/addon-essentials - Core addons bundle
- @storybook/addon-interactions - Interaction testing
- @storybook/addon-a11y - Accessibility testing
- @storybook/addon-links - Story navigation
- @storybook/addon-coverage - Code coverage
- storybook-dark-mode - Dark mode toggle
Best Practices
1. Use TypeScript Configuration
Type-safe configuration prevents errors:
import type { StorybookConfig } from '@storybook/react-vite';
const config: StorybookConfig = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(ts|tsx)'],
addons: [
'@storybook/addon-essentials',
'@storybook/addon-interactions',
],
framework: {
name: '@storybook/react-vite',
options: {
builder: {
viteConfigPath: './vite.config.ts',
},
},
},
};
export default config;
2. Configure Story Patterns
Specify where stories are located:
const config: StorybookConfig = {
stories: [
'../src/**/*.mdx',
'../src/**/*.stories.@(js|jsx|ts|tsx)',
// Include specific directories
'../components/**/*.stories.tsx',
'../features/**/*.stories.tsx',
// Exclude patterns
'!../src/**/*.test.stories.tsx',
],
};
3. Enable Autodocs
Generate documentation automatically:
const config: StorybookConfig = {
docs: {
autodocs: 'tag', // Autodocs for stories with 'autodocs' tag
// OR
autodocs: true, // Autodocs for all stories
},
};
4. Configure Essential Addons
Customize addon behavior in preview:
import type { Preview } from '@storybook/react';
const preview: Preview = {
parameters: {
// Actions addon
actions: { argTypesRegex: '^on[A-Z].*' },
// Controls addon
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
exclude: ['className', 'style'],
},
// Viewport addon
viewport: {
viewports: {
mobile: {
name: 'Mobile',
styles: { width: '375px', height: '667px' },
},
tablet: {
name: 'Tablet',
styles: { width: '768px', height: '1024px' },
},
},
},
// Backgrounds addon
backgrounds: {
default: 'light',
values: [
{ name: 'light', value: '#ffffff' },
{ name: 'dark', value: '#1a1a1a' },
],
},
},
};
5. Add Global Decorators
Wrap all stories with providers:
import { Preview } from '@storybook/react';
import { ThemeProvider } from '../src/theme';
const preview: Preview = {
decorators: [
(Story) => (
<ThemeProvider>
<div style={{ padding: '2rem' }}>
<Story />
</div>
</ThemeProvider>
),
],
};
Common Patterns
Next.js Configuration
import type { StorybookConfig } from '@storybook/nextjs';
const config: StorybookConfig = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
'@storybook/addon-essentials',
'@storybook/addon-interactions',
],
framework: {
name: '@storybook/nextjs',
options: {
nextConfigPath: '../next.config.js',
},
},
staticDirs: ['../public'],
typescript: {
reactDocgen: 'react-docgen-typescript',
reactDocgenTypescriptOptions: {
shouldExtractLiteralValuesFromEnum: true,
propFilter: (prop) => (prop.parent ? !/node_modules/.test(prop.parent.fileName) : true),
},
},
};
Vite Configuration
import type { StorybookConfig } from '@storybook/react-vite';
import { mergeConfig }
Установить storybook-configuration в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadWriteEditBashGrepGlobFAQ
Что делает скилл storybook-configuration?
Use when setting up or configuring Storybook for a project. Covers main configuration, addons, builders, and framework-specific setup.
Как установить скилл storybook-configuration?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл storybook-configuration запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic