Storybook Generator
When to activate
User runs /generate-storybook or requests Storybook story generation for a component with all prop variants and interactive controls.
When NOT to use
- Component audits (use
/component-auditor instead)
- Accessibility reviews (use
/review-a11y instead)
- Existing well-documented Storybook stories (update instead)
Instructions
Analyze component props
- Extract all props and their types (required vs. optional)
- Identify variant combinations (size, color, state, etc.)
- Map props to Storybook controls (boolean, select, text, etc.)
Generate story template
- Meta export with component, title, and controls config
- Default story showing primary variant
- Variant stories for each meaningful combination (Size, Variant, State, etc.)
- Edge case stories (empty state, error state, loading state)
Add interactive controls
- Boolean controls for toggles (disabled, loading, etc.)
- Select controls for variants (size: small/medium/large)
- Text controls for content
- Suggest control groups (e.g., "Button" group for size + variant)
Document usage examples
- Show primary use case
- Show edge cases
- Add JSDoc comments for prop descriptions
- Include accessibility notes if relevant
Export story code
- TypeScript with proper types
- Modern Storybook CSF 3.0+ syntax
- Ready to commit without modification
Example
User: "Generate Storybook for this Button component."
Response generates:
export default {
title: 'Components/Button',
component: Button,
argTypes: {
size: { control: 'select', options: ['small', 'medium', 'large'] },
variant: { control: 'select', options: ['primary', 'secondary', 'outline'] },
disabled: { control: 'boolean' },
children: { control: 'text' },
},
};
export const Primary = { args: { variant: 'primary', children: 'Click me' } };
export const Secondary = { args: { variant: 'secondary', children: 'Click me' } };
export const Disabled = { args: { disabled: true, children: 'Click me' } };
export const AllSizes = { render: () => <div>...</div> };
1---2name: storybook-generator3description: Storybook Generator4---5# Storybook Generator67## When to activate89User runs `/generate-storybook` or requests Storybook story generation for a component with all prop variants and interactive controls.1011## When NOT to use1213- Component audits (use `/component-auditor` instead)14- Accessibility reviews (use `/review-a11y` instead)15- Existing well-documented Storybook stories (update instead)1617## Instructions18191. **Analyze component props**20 - Extract all props and their types (required vs. optional)21 - Identify variant combinations (size, color, state, etc.)22 - Map props to Storybook controls (boolean, select, text, etc.)23242. **Generate story template**25 - Meta export with component, title, and controls config26 - Default story showing primary variant27 - Variant stories for each meaningful combination (Size, Variant, State, etc.)28 - Edge case stories (empty state, error state, loading state)29303. **Add interactive controls**31 - Boolean controls for toggles (disabled, loading, etc.)32 - Select controls for variants (size: small/medium/large)33 - Text controls for content34 - Suggest control groups (e.g., "Button" group for size + variant)35364. **Document usage examples**37 - Show primary use case38 - Show edge cases39 - Add JSDoc comments for prop descriptions40 - Include accessibility notes if relevant41425. **Export story code**43 - TypeScript with proper types44 - Modern Storybook CSF 3.0+ syntax45 - Ready to commit without modification4647## Example4849User: "Generate Storybook for this Button component."5051Response generates:52```53export default {54 title: 'Components/Button',55 component: Button,56 argTypes: {57 size: { control: 'select', options: ['small', 'medium', 'large'] },58 variant: { control: 'select', options: ['primary', 'secondary', 'outline'] },59 disabled: { control: 'boolean' },60 children: { control: 'text' },61 },62};6364export const Primary = { args: { variant: 'primary', children: 'Click me' } };65export const Secondary = { args: { variant: 'secondary', children: 'Click me' } };66export const Disabled = { args: { disabled: true, children: 'Click me' } };67export const AllSizes = { render: () => <div>...</div> };68```