/storybook-assistant:story-generationfrom storybook-assistant
Generates Storybook CSF 3.0 stories from React, Vue, and Svelte components by parsing props, detecting variants, and adding interaction tests with accessibility checks.
Ships in storybook-assistant. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Generate Storybook stories automatically from existing components by parsing prop types, detecting variants, and creating comprehensive CSF 3.0 stories with interaction tests and accessibility validation.
This skill provides a complete component analysis and story generation pipeline for React, Vue, and Svelte components.
Parse component files to extract:
Automatically detect story variants from:
'primary' | 'secondary' | 'outline'small, medium, largedisabled, loading, errorCreate complete story files with:
satisfies Meta<typeof Component>)The generator infers appropriate control types based on prop names and types:
| Prop Pattern | Control Type | Example |
|---|---|---|
boolean type | { control: 'boolean' } | disabled, loading |
number type | { control: 'number' } | count, index |
opacity, progress | { control: { type: 'range', min: 0, max: 1 } } | opacity, percent |
size, width, height | { control: { type: 'range', min: 0, max: 100 } } | padding, margin |
color, background, fill | { control: 'color' } | backgroundColor, textColor |
*Date, *Time, timestamp | { control: 'date' } | createdDate, startTime |
object, Record<> | { control: 'object' } | style, config |
array, [] | { control: 'object' } | items, options[] |
file, src, source | { control: 'file' } | avatarFile, imageSrc |
| Union type (2-4 options) | { options: [...], control: { type: 'radio' } } | 'sm' | 'md' | 'lg' |
| Union type (5+ options) | { options: [...], control: { type: 'select' } } | 'a' | 'b' | 'c' | 'd' | 'e' |
on* (callbacks) | { action: 'propName' } | onClick, onChange |
string type | { control: 'text' } | label, placeholder |
ReactNode, ReactElement | { control: false } | children, icon |
Example generated argTypes:
argTypes: {
variant: { options: ['primary', 'secondary', 'outline'], control: { type: 'radio' } },
size: { options: ['sm', 'md', 'lg'], control: { type: 'radio' } },
disabled: { control: 'boolean' },
backgroundColor: { control: 'color' },
onClick: { action: 'onClick' },
label: { control: 'text' },
}
Recommended preview.ts configuration:
// .storybook/preview.ts
const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
},
};
defineProps<T> and runtime propsexport let statementsThe skill provides four main scripts in scripts/:
Parse component files to extract metadata.
Usage:
python3 ${CLAUDE_PLUGIN_ROOT}/skills/story-generation/scripts/parse_component.py \
path/to/Component.tsx \
--json
Output: Component metadata (name, framework, props, type classification)
Detect story variants from component props.
Usage:
python3 ${CLAUDE_PLUGIN_ROOT}/skills/story-generation/scripts/detect_variants.py \
path/to/Component.tsx \
--json
Output: List of variants with args and priorities
Generate complete story file with tests.
Usage:
python3 ${CLAUDE_PLUGIN_ROOT}/skills/story-generation/scripts/generate_story.py \
path/to/Component.tsx \
--level full \
--output path/to/Component.stories.tsx
Testing levels:
full: All features (variants + interaction tests + a11y tests)standard: Variants + interaction testsbasic: Variants with args/controls onlyminimal: Single default storyScan project directories for components.
Usage:
python3 ${CLAUDE_PLUGIN_ROOT}/skills/story-generation/scripts/scan_components.py \
src \
--json
Output: JSON array of discovered components with metadata
Templates are located in templates/ directory:
react-full.template - React with full testingreact-basic.template - React basic storiesvue-full.template - Vue 3 with full testingsvelte-full.template - Svelte with full testingTemplates use variable replacement:
{{COMPONENT_NAME}} - Component name{{VARIANT_STORIES}} - Generated variant exports{{INTERACTION_TEST_CODE}} - Test code{{A11Y_RULES}} - Accessibility rulesThis skill integrates with the /generate-stories command:
scan_components.pyparse_component.pydetect_variants.pygenerate_story.pyThe parser automatically detects and generates appropriate tests for:
| Type | Example | Special Handling |
|---|---|---|
| button | Button, SubmitButton | Click tests, disabled check |
| input | TextField, Input | Type tests, value validation |
| checkbox | Checkbox | Click, checked state |
| select | Dropdown, Select | Option selection |
| card | Card, ProductCard | Render tests |
| modal | Dialog, Modal | Focus trap, ESC handler |
| table | DataTable, Table | Row/column tests |
15+ component types supported with custom test patterns.
# Parse component
python3 scripts/parse_component.py src/components/Button.tsx
# Output:
# Component: Button
# Framework: react
# Type: button
# Props (6):
# - variant: 'primary' | 'secondary' | 'outline' | 'ghost' (required)
# - size: 'small' | 'medium' | 'large' (optional)
# - disabled: boolean (optional)
# - loading: boolean (optional)
# - onClick: () => void (optional)
# - children: React.ReactNode (required)
# Detect variants
python3 scripts/detect_variants.py src/components/Button.tsx
# Output:
# Detected 11 variants:
# 1. Primary (variant: primary)
# 2. Secondary (variant: secondary)
# 3. Outline (variant: outline)
# 4. Ghost (variant: ghost)
# 5-7. Small/Medium/Large (size variants)
# 8. Disabled (boolean state)
# 9. Loading (boolean state)
# Generate story with full testing
python3 scripts/generate_story.py \
src/components/Button.tsx \
--level full \
--output src/components/Button.stories.tsx
Generated story includes:
Can process 100+ components in 2-3 seconds.
The scripts handle common errors gracefully:
When using this skill:
full for comprehensive testing, basic for simple stories/generate-stories - Interactive workflow using this skill/create-component - Creates components with auto-generated storiesParser Implementation:
Variant Detection:
Story Generation:
All scripts use Python 3.8+ standard library only (no external dependencies).
README.md (opens in a new tab)scripts/detect_variants.py (opens in a new tab)scripts/generate_story.py (opens in a new tab)scripts/parse_component.py (opens in a new tab)scripts/scan_components.py (opens in a new tab)scripts/test_parser.sh (opens in a new tab)scripts/test_samples/Button.tsx (opens in a new tab)templates/react-basic.template (opens in a new tab)templates/react-full.template (opens in a new tab)templates/svelte-full.template (opens in a new tab)templates/vue-full.template (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
18 skills in this plugin
/accessibility-remediationUse this skill when the user writes/edits components, asks to "fix accessibility issues", "add ARIA labels", "improve accessibility", "check WCAG compliance", "remediate a11y violations", mentions "screen reader support", "keyboard navigation", or wants AI-powered accessibility fixes with one-click application. Automatically analyzes components for a11y issues and suggests context-aware fixes. Trigger on PostToolUse hook or explicit request./ci-cd-generatorUse this skill when the user asks to "setup CI/CD", "configure GitHub Actions", "deploy Storybook", "setup Chromatic", "add visual regression to CI", "create deployment pipeline", or wants to generate complete CI/CD workflows for Storybook deployment and testing./Generated from the plugin's indexed repository (flight505/storybook-assistant) — no native marketplace selected
npx claudepluginhub p/flight505-storybook-assistantOther plugins' skills for the same job