integrating-storybook
Storybook integration with spec.md. Auto-generates Stories from Component API. Triggers: storybook, stories, component api, props, argTypes, variants, csf, csf3, autodocs, frontend component
When & Why to Use This Skill
This Claude skill automates the creation of Storybook stories by extracting component APIs from specification files. It streamlines frontend development workflows by generating CSF3-compliant stories, including props, variants, and states, ensuring consistent UI documentation and testing environments without manual boilerplate coding.
Use Cases
- Rapidly scaffolding Storybook documentation for new UI components based on TypeScript interfaces and design specs.
- Ensuring all component variants (such as hover, active, and disabled states) are visually documented and accessible for UI testing.
- Maintaining synchronization between technical specifications in spec.md and the actual Storybook implementation to prevent documentation rot.
- Standardizing the use of CSF3 and autodocs across a frontend engineering team to improve code quality and component discoverability.
| name | integrating-storybook |
|---|---|
| description | > |
| allowed-tools | [Read, Write, Glob, Grep] |
| user-invocable | false |
Storybook Integration
Core Concepts
| Concept | Description |
|---|---|
| Component API | Props, Variants, States defined in spec.md |
| CSF3 | Component Story Format 3 + autodocs |
| Auto-generation | /code generates Stories from spec.md |
Component API Location
Add to spec.md when implementing frontend components.
| Content | Description |
|---|---|
| Props Interface | TypeScript interface |
| Variants | Style options |
| States | default, hover, active, disabled |
| Usage Examples | TSX code |
Workflow
| Command | Action |
|---|---|
/think "Add Button" |
Adds Component API section to spec.md |
/code |
Generates Button.stories.tsx from spec |
Existing Stories Handling
| Option | Action |
|---|---|
| [O] | Overwrite existing file |
| [S] | Skip - keep existing |
| [M] | Merge - show diff, manual |
| [D] | Diff only - append new |
References
| Topic | File |
|---|---|
| Component API | references/component-api-template.md |
| CSF3 Patterns | references/csf3-patterns.md |