storybook-story
Proposes changes via cospec. Use this for guided artifact creation and project rule compliance.
Install
mkdir -p .claude/skills/storybook-story && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/18850" && unzip -o skill.zip -d .claude/skills/storybook-story && rm skill.zipInstalls to .claude/skills/storybook-story
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Storybookのstoryファイルを作成します。コンポーネントの各状態(デフォルト、バリエーション、エッジケース)を網羅したstoriesを生成します。Key capabilities
- →Create Storybook story files for React components
- →Define `meta` object with title, component, parameters, and tags
- →Configure `argTypes` for props control (e.g., `action`, `select`, `boolean`, `text`)
- →Generate default stories, variations, and state-based stories
- →Create edge case stories for extreme inputs
- →Implement interactive stories using `userEvent` and `within`
How it works
This skill generates Storybook story files for React components, covering various states, variations, and edge cases using Storybook v10.2.0.
Inputs & outputs
When to use storybook-story
- →Propose new project feature
- →Initialize maintenance change
- →Generate change artifacts
About this skill
Storybook Story Creation
Storybook v10.2.0を使用して、コンポーネントの包括的なstoriesを作成します。
作成手順
1. Storyファイルの構造
// ComponentName.stories.tsx
import type { Meta, StoryObj } from '@storybook/react';
import { ComponentName } from './ComponentName';
const meta = {
title: '[階層]/ComponentName', // 例: 'atoms/Button', 'molecules/SearchBar'
component: ComponentName,
parameters: {
layout: 'centered', // または 'fullscreen', 'padded'
},
tags: ['autodocs'],
argTypes: {
// Propsの制御を定義
onClick: { action: 'clicked' },
variant: {
control: 'select',
options: ['primary', 'secondary', 'outline'],
},
},
} satisfies Meta<typeof ComponentName>;
export default meta;
type Story = StoryObj<typeof meta>;
// デフォルトストーリー
export const Default: Story = {
args: {
// デフォルト値
},
};
// バリエーション
export const Primary: Story = {
args: {
variant: 'primary',
},
};
export const Secondary: Story = {
args: {
variant: 'secondary',
},
};
// エッジケース
export const LongText: Story = {
args: {
title: '非常に長いテキストの場合にどのように表示されるかをテストします',
},
};
export const Empty: Story = {
args: {
title: '',
},
};
2. 作成ガイドライン
Storyの種類:
- Default: 最も一般的な使用例
- バリエーション: 異なるpropsの組み合わせ
- 状態: ローディング、エラー、空など
- エッジケース: 極端に長いテキスト、空の値など
- インタラクティブ: ユーザー操作が必要な状態
argTypes設定:
- イベントハンドラーには
actionを使用 - 選択肢がある場合は
control: 'select'を使用 - 真偽値には
control: 'boolean'を使用 - テキストには
control: 'text'を使用
パラメータ設定:
layout: 'centered', 'fullscreen', 'padded' から選択backgrounds: 背景色のバリエーションをテストviewport: レスポンシブデザインのテスト
3. アクセシビリティテスト
Storybook の a11y アドオンを活用:
export const AccessibilityTest: Story = {
parameters: {
a11y: {
config: {
rules: [
{
id: 'color-contrast',
enabled: true,
},
],
},
},
},
};
4. インタラクティブストーリー
Play 関数を使用してユーザー操作をシミュレート:
import { userEvent, within } from '@storybook/test';
export const WithInteraction: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
const button = canvas.getByRole('button');
await userEvent.click(button);
},
};
テストコマンド
pnpm storybook # 開発サーバー起動 (localhost:6006)
pnpm build-storybook # 静的ビルド
出力
.stories.tsxファイルを作成- 作成したstoriesの一覧を説明
- Storybookで確認する方法を案内
- 次のステップとしてユニットテスト作成を提案
When not to use it
- →When creating Storybook stories for frameworks other than React
- →When the user asks to create unit tests instead of stories
- →When the user asks to use Storybook versions older than v10.2.0
Limitations
- →Specific to Storybook v10.2.0
- →Generates stories for React components only
- →Does not create unit tests
How it compares
This skill automates the creation of complete and well-structured Storybook stories, ensuring coverage of default, variations, states, and edge cases, unlike manual story creation.
Compared to similar skills
storybook-story side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| storybook-story (this skill) | 0 | 5mo | Review | Intermediate |
| openspec-onboard | 10 | 5mo | Review | Beginner |
| workflow-orchestration-patterns | 10 | 2mo | No flags | Advanced |
| meta-automation-architect | 7 | 8mo | Review | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
openspec-onboard
studyzy
Guided onboarding for OpenSpec - walk through a complete workflow cycle with narration and real codebase work.
workflow-orchestration-patterns
wshobson
Design durable workflows with Temporal for distributed systems. Covers workflow vs activity separation, saga patterns, state management, and determinism constraints. Use when building long-running processes, distributed transactions, or microservice orchestration.
meta-automation-architect
comzine
Use when user wants to set up comprehensive automation for their project. Generates custom subagents, skills, commands, and hooks tailored to project needs. Creates a multi-agent system with robust communication protocol.
hive-mind-advanced
ruvnet
Advanced Hive Mind collective intelligence system for queen-led multi-agent coordination with consensus mechanisms and persistent memory
openspec-new-change
studyzy
使用实验性的产出物工作流启动一个新的 OpenSpec 变更。当用户想要通过结构化的分步方法创建新功能、修复或修改时使用。
router-first-architecture
parcadei
Router-First Architecture