storybook
Skill1 starsChanged 3 months agoApache-2.0View on GitHub
Write and test Storybook stories for React components. Use for component isolation, visual testing, and documentation.
8 other projects use a version of this.
Adopted by
Most recently taken up by
- mthines/agent-skillstheir own version, first seen Sep 25, 2026
- microsoft/scopetheir own version, first seen Sep 23, 2026
- monegit/agent-skillstheir own version, first seen Aug 11, 2026
- Dragoon0x/dragoon-skillstheir own version, first seen Apr 28, 2026
- FelipeAngeli/skillstheir own version, first seen Apr 10, 2026
- DaleStudy/skillstheir own version, first seen Feb 21, 2026
Other versions8 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 8
- Mindrally/skills★ 266same name
- dylantarre/design-system-skills★ 50same name
- mthines/agent-skills★ 13same name
- microsoft/scope★ 7same name
- DaleStudy/skills★ 4same name
- Dragoon0x/dragoon-skills★ 4same name
- FelipeAngeli/skills★ 2same name
- monegit/agent-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository13 other files it gives its agents.
- humanizer/AGENTS.mdAGENTS.md
- aaif-notebooklm-syncSkill
- asciinema-explainer-walkthroughsSkill
- cuj-screenshotsSkill
- developer-trends-intelSkill
- diagram-designSkill
- elixir-best-practicesSkill
- engineering-disciplineSkill
- humanizerSkill
- intent-refinementSkill
- manim-video-qualitySkill
- opm-trackingSkill
- ui-developerSkill
The file
We split this skill into the rules it gives an agent
7 rules. 0 are common, 4 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Create, test, and capture Storybook stories for React components.
- Distinctive: line 85
Use Playwright to capture story screenshots:
- Very specific: line 300
autodocs tag: Add tags: ['autodocs'] for auto-generated docs
- Very specific: line 301
Args vs render: Use args for simple prop changes, render for complex setups
- Very specific: line 302
Naming: Use ComponentName--VariantName format for story IDs
- Distinctive: line 303
Mock API: Use MSW addon for mocking API calls in stories
- Distinctive: line 305
Backgrounds: Add background switcher for light/dark mode testing
“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Storybook Skill
Create, test, and capture Storybook stories for React components.
When to Use This
- Creating new React components that need isolation testing
- Documenting component variants and states
- Capturing visual snapshots for documentation
- Testing responsive behavior across viewport sizes
Quick Start
1. Install Storybook (if not present)
cd frontend
npx storybook@latest init2. Create a Story
For a component at src/components/Button.tsx:
// src/components/Button.stories.tsx
import type { Meta, StoryObj } from '@storybook/react';
import { Button } from './Button';
const meta: Meta<typeof Button> = {
title: 'Components/Button',
component: Button,
tags: ['autodocs'],
argTypes: {
variant: {
control: 'select',
options: ['primary', 'secondary', 'danger'],
},
},
};
export default meta;
type Story = StoryObj<typeof Button>;
export const Primary: Story = {
args: {
variant: 'primary',
children: 'Click me',
},
};
export const Secondary: Story = {
args: {
variant: 'secondary',
children: 'Click me',
},
};
export const Disabled: Story = {
args: {
variant: 'primary',
children: 'Disabled',
disabled: true,
},
};3. Run Storybook
npm run storybook
# or
bun storybookDefault: http://localhost:6006
4. Capture Screenshots
Use Playwright to capture story screenshots:
import asyncio
from playwright.async_api import async_playwright
async def capture_stories():
async with async_playwright() as p:
browser = await p.chromium.launch(headless=True)
page = await browser.new_page(viewport={"width": 1280, "height": 720})
# Navigate to specific story
await page.goto("http://localhost:6006/iframe.html?id=components-button--primary")
await page.wait_for_timeout(1000)
await page.screenshot(path="button-primary.png")
await browser.close()
asyncio.run(capture_stories())Story Patterns
With Decorators (Providers, Theme)
const meta: Meta<typeof MyComponent> = {
title: 'Components/MyComponent',
component: MyComponent,
decorators: [
(Story) => (
<ThemeProvider theme={lightTheme}>
<Story />
</ThemeProvider>
),
],
};With Mock Data
export const WithData: Story = {
args: {
items: [
{ id: 1, name: 'Item 1' },
{ id: 2, name: 'Item 2' },
],
},
};
export const Empty: Story = {
args: {
items: [],
},
};
export const Loading: Story = {
args: {
loading: true,
},
};Responsive Stories
export const Mobile: Story = {
args: { /* ... */ },
parameters: {
viewport: {
defaultViewport: 'mobile1',
},
},
};
export const Tablet: Story = {
args: { /* ... */ },
parameters: {
viewport: {
defaultViewport: 'tablet',
},
},
};With Actions
import { action } from '@storybook/addon-actions';
export const Interactive: Story = {
args: {
onClick: action('clicked'),
onSubmit: action('submitted'),
},
};Play Functions (Interaction Testing)
import { within, userEvent } from '@storybook/testing-library';
import { expect } from '@storybook/jest';
export const Filled: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
await userEvent.type(
canvas.getByRole('textbox', { name: /email/i }),
'test@example.com'
);
await userEvent.click(canvas.getByRole('button', { name: /submit/i }));
await expect(canvas.getByText('Success')).toBeInTheDocument();
},
};Storybook Configuration
.storybook/main.ts
import type { StorybookConfig } from '@storybook/react-vite';
const config: StorybookConfig = {
stories: ['../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
'@storybook/addon-interactions',
],
framework: {
name: '@storybook/react-vite',
options: {},
},
docs: {
autodocs: 'tag',
},
};
export default config;.storybook/preview.ts
import type { Preview } from '@storybook/react';
import '../src/index.css'; // Global styles
const preview: Preview = {
parameters: {
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
},
};
export default preview;Batch Screenshot Capture
#!/usr/bin/env python3
"""Capture all Storybook stories as screenshots."""
import asyncio
import json
from playwright.async_api import async_playwright
STORYBOOK_URL = "http://localhost:6006"
async def get_stories(page):
"""Fetch story list from Storybook."""
await page.goto(f"{STORYBOOK_URL}/index.json")
content = await page.content()
# Parse JSON from page
data = json.loads(await page.evaluate("() => document.body.innerText"))
return [
story_id for story_id, story in data.get("entries", {}).items()
if story.get("type") == "story"
]
async def capture_all():
async with async_playwright() as p:
browser = await p.chromium.launch(headless=True)
page = await browser.new_page(viewport={"width": 1280, "height": 720})
stories = await get_stories(page)
for story_id in stories:
url = f"{STORYBOOK_URL}/iframe.html?id={story_id}&viewMode=story"
await page.goto(url)
await page.wait_for_timeout(500)
filename = story_id.replace("--", "-").replace("/", "-")
await page.screenshot(path=f"screenshots/{filename}.png")
print(f"Captured: {story_id}")
await browser.close()
if __name__ == "__main__":
asyncio.run(capture_all())Tips
- autodocs tag: Add
tags: ['autodocs']for auto-generated docs - Args vs render: Use
argsfor simple prop changes,renderfor complex setups - Naming: Use
ComponentName--VariantNameformat for story IDs - Mock API: Use MSW addon for mocking API calls in stories
- Viewport addon: Configure common viewports in preview.ts
- Backgrounds: Add background switcher for light/dark mode testing
Integration with CUJ Screenshots
Storybook stories can be captured as part of CUJ workflows:
# In your CUJ script
await page.goto("http://localhost:6006/iframe.html?id=components-taskcard--default")
await page.screenshot(path="docs/screenshots/taskcard.png")This gives you both isolated component shots and full-app journey shots.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

