storybook
БесплатноБез исполняемых скриптовНе проверенUse whenever creating, configuring, or extending Storybook for a TS/React component library — covers main.ts/preview.ts setup, CSF3 story authoring…
от pproenca★ 231 звезда на GitHubОб этом скилле
dot-skills Storybook Best Practices
Comprehensive guide for using Storybook 9+ as the workshop and test bench for a TypeScript/React component library. 52 rules across 8 categories, ordered by the lifecycle of a component in your design system: a wrong .storybook/main.ts cascades into every story; a malformed CSF Meta blocks autodocs, controls, tests, and the a11y panel for that file.
What this skill covers
- Setup —
main.ts,preview.ts, framework selection (Vite vs Webpack, Next.js vs React-only), addon installation via the CLI,staticDirs. - Story authoring (CSF3) —
satisfies Meta<typeof Component>, named exports = stories,tags: ['autodocs']placement, whenrenderis appropriate, story naming conventions. - Args, argTypes, controls — when to rely on inference, when to declare
control: 'select',fn()fromstorybook/testfor callbacks, args vs parameters vs globals. - Decorators & composition — global providers in
preview.ts, MSW for network mocks, subpath-import module mocking (Storybook 9+), decorator signature pitfalls. - Interaction testing —
playfunctions, thestorybook/testimport path (NOT@storybook/test), destructuredcanvas/userEvent,findBy*overwaitFor,addon-vitestfor CI, portable stories. - Accessibility (
axe-corevia@storybook/addon-a11y) —parameters.a11y.test = 'error'as a real gate, per-rule disables,runOnlyscoped to your WCAG target, portalcontext,globals.a11y.manualfor intentional-violation fixtures. - Documentation & design system — autodocs vs MDX, MDX referencing stories with
<Canvas of={...} />, status tags, design tokens as stories, Figma links viaparameters.design. - Build & deployment — Vite over Webpack, on-demand bundling for large libraries, deploy to Chromatic/Vercel for designer review, CI cache configuration.
When to Apply
Reach for this skill when:
- Editing or creating a
*.stories.tsx,*.mdx,.storybook/main.ts,.storybook/preview.ts, orvitest.config.tsthat loadsstorybookTest. - Setting up Storybook on a new project (framework choice,
npx storybook initfollow-up). - Adding or upgrading an addon (a11y, vitest, designs, msw).
- Wiring component tests through
playfunctions and the Vitest addon. - Investigating "Storybook is slow", "controls show text instead of select", "a11y panel shows nothing for my dialog", "play function is flaky in CI".
Skip this skill and use:
react-optimise/clean-code-ts-reactfor the underlying component design.react-testing-libraryforrender/screen/userEventsemantics outside Storybook.- WCAG/ARIA reference docs for the spec itself; this skill assumes you know what
aria-labelledbydoes and tells you howaddon-a11ychecks it.
Rule Categories by Priority
Order reflects the component lifecycle (configure → author → wire → decorate → test → audit → document → ship). Earlier stages cascade.
| Priority | Category | Impact | Prefix | Rules |
|---|---|---|---|---|
| 1 | Setup & Configuration | CRITICAL | config- |
8 |
| 2 | Story Authoring (CSF3) | CRITICAL | csf- |
8 |
| 3 | Args, ArgTypes & Controls | HIGH | args- |
5 |
| 4 | Decorators & Composition | HIGH | deco- |
7 |
| 5 | Interaction Testing | HIGH | test- |
7 |
| 6 | Accessibility (axe) | HIGH | axe- |
5 |
| 7 | Documentation & Design System | MEDIUM-HIGH | docs- |
5 |
| 8 | Build, Performance & Deployment | MEDIUM | build- |
7 |
Quick Reference
1. Setup & Configuration (CRITICAL)
config-typed-main-config— Typemain.tswithsatisfies StorybookConfigconfig-pick-the-right-framework-package— Use the framework package that matches your build (@storybook/nextjs-vitefor Next.js, etc.)config-narrow-stories-glob— Narrow thestoriesglob to story files onlyconfig-typed-preview— Typepreview.tswith the framework'sPreviewtypeconfig-add-addons-via-cli— Install addons withnpx storybook add, never by handconfig-static-dirs-not-bundler-imports— Serve assets viastaticDirs, not bundler importsconfig-tokens-css-vars-in-preview— Wire Style Dictionary / Tokens Studio output intopreview.tsas CSS variablesconfig-story-sort-for-large-libraries—parameters.options.storySortorder for design-system sidebars (Foundations → Components → Patterns)
2. Story Authoring — CSF3 (CRITICAL)
csf-satisfies-meta-not-typed—satisfies Meta<typeof Component>, never: Meta<typeof Component>
Установить storybook в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл storybook?
Use whenever creating, configuring, or extending Storybook for a TS/React component library — covers main.ts/preview.ts setup, CSF3 story authoring, args/argTypes/controls, decorators and providers, MSW and module mocking, play-function interaction tests via the Vitest addon, the @storybook/addon-a11y workflow (axe-core), autodocs vs MDX docs, design tokens, Figma linking, Chromatic deployment, and on-demand build performance. Triggers on tasks like "write a story", "set up Storybook", "configure addon-a11y", "fix this play function", "deploy Storybook", "test Storybook in CI" — even when the user doesn't say "storybook" but is editing `*.stories.tsx`, `.storybook/main.ts`, or `.storybook/preview.ts`. Targets Storybook 9+/10 (modern `storybook/test` import, Vitest addon, CSF3 + `satisfies Meta`). Does NOT cover generic React patterns (use the `react` skill), generic Testing Library queries (use `react-testing-library`), or WCAG primer (points at addon-a11y + axe rule config).
Как установить скилл storybook?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл storybook запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic