Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

storybook

БесплатноБез исполняемых скриптовНе проверен

Use whenever creating, configuring, or extending Storybook for a TS/React component library — covers main.ts/preview.ts setup, CSF3 story authoring…

pproencaот 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

  1. Setup — main.ts, preview.ts, framework selection (Vite vs Webpack, Next.js vs React-only), addon installation via the CLI, staticDirs.
  2. Story authoring (CSF3) — satisfies Meta<typeof Component>, named exports = stories, tags: ['autodocs'] placement, when render is appropriate, story naming conventions.
  3. Args, argTypes, controls — when to rely on inference, when to declare control: 'select', fn() from storybook/test for callbacks, args vs parameters vs globals.
  4. Decorators & composition — global providers in preview.ts, MSW for network mocks, subpath-import module mocking (Storybook 9+), decorator signature pitfalls.
  5. Interaction testing — play functions, the storybook/test import path (NOT @storybook/test), destructured canvas/userEvent, findBy* over waitFor, addon-vitest for CI, portable stories.
  6. Accessibility (axe-core via @storybook/addon-a11y) — parameters.a11y.test = 'error' as a real gate, per-rule disables, runOnly scoped to your WCAG target, portal context, globals.a11y.manual for intentional-violation fixtures.
  7. Documentation & design system — autodocs vs MDX, MDX referencing stories with <Canvas of={...} />, status tags, design tokens as stories, Figma links via parameters.design.
  8. 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, or vitest.config.ts that loads storybookTest.
  • Setting up Storybook on a new project (framework choice, npx storybook init follow-up).
  • Adding or upgrading an addon (a11y, vitest, designs, msw).
  • Wiring component tests through play functions 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-react for the underlying component design.
  • react-testing-library for render/screen/userEvent semantics outside Storybook.
  • WCAG/ARIA reference docs for the spec itself; this skill assumes you know what aria-labelledby does and tells you how addon-a11y checks 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)

2. Story Authoring — CSF3 (CRITICAL)

Полный SKILL.md на GitHub

Установить storybook в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

AGENTS.mdassets/templates/_template.mdgotchas.mdmetadata.jsonreferences/_sections.mdreferences/args-derive-from-component-props.mdreferences/args-explicit-control-for-unions.mdreferences/args-no-jsx-in-args.mdreferences/args-pick-args-vs-parameters-vs-globals.mdreferences/args-use-fn-for-callbacks.mdreferences/axe-context-for-portals.mdreferences/axe-disable-rules-not-stories.mdreferences/axe-globals-manual-for-intentional-violations.mdreferences/axe-restrict-runonly-to-wcag-aa.mdreferences/axe-set-test-error-globally.mdreferences/build-cache-storybook-in-ci.mdreferences/build-chromatic-modes-multi-theme.mdreferences/build-deploy-static-build-to-shareable-host.mdreferences/build-manager-brand.mdreferences/build-prefer-vite-over-webpack.mdreferences/build-storybook-composition-refs.mdreferences/build-trim-test-bundle.mdreferences/config-add-addons-via-cli.mdreferences/config-narrow-stories-glob.mdreferences/config-pick-the-right-framework-package.mdreferences/config-static-dirs-not-bundler-imports.mdreferences/config-story-sort-for-large-libraries.mdreferences/config-tokens-css-vars-in-preview.mdreferences/config-typed-main-config.mdreferences/config-typed-preview.mdreferences/csf-co-locate-stories-with-component.mdreferences/csf-default-export-is-the-meta.mdreferences/csf-name-stories-by-state.mdreferences/csf-prefer-args-over-render.mdreferences/csf-satisfies-meta-not-typed.mdreferences/csf-set-meta-component-explicitly.mdreferences/csf-tags-autodocs-on-meta.mdreferences/csf-title-hierarchy-for-design-systems.mdreferences/deco-context-aware-decorators.mdreferences/deco-decorator-component-not-call.md

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), без исполняемых скриптов.

Похожие скиллы

Сравнить storybook с