Use this skill when the user asks to "generate stories for components", "parse component props", "detect component variants", "analyze components", "create stories automatically", mentions "component parser", "story automation", or wants to generate Storybook stories from existing component files. This skill provides intelligent component analysis and CSF 3.0 story generation with interaction tests and accessibility checks.
/plugin marketplace add flight505/storybook-assistant-plugin/plugin install flight505-storybook-assistant@flight505/storybook-assistant-pluginThis skill inherits all available tools. When active, it can use any tool Claude has access to.
README.mdscripts/detect_variants.pyscripts/generate_story.pyscripts/parse_component.pyscripts/scan_components.pyscripts/test_parser.shscripts/test_samples/Button.tsxtemplates/react-basic.templatetemplates/react-full.templatetemplates/svelte-full.templatetemplates/vue-full.templateGenerate 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>)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).