plugins/smedjen/skills/storybook-patterns/SKILL.md
Storybook stories, args, decorators, interaction tests, visual testing, and addon configuration. Use when writing CSF3 stories, setting up play functions for interaction tests, configuring addons, integrating with Chromatic for visual regression, writing MDX documentation, or structuring stories for React, Vue, or Angular.
npx skillsauth add hjemmesidekongen/ai storybook-patternsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Storybook isolates components for development, documentation, and testing. Its value comes from CSF3's composable story model — args flow through the component tree, play functions automate interactions, and the same stories drive visual regression in CI.
Every story file has one default export (the meta) and named exports (the stories). The meta sets the component, title, argTypes, and decorators. Each story is an object with an args property and optionally a play function.
Stories should compose: define a base story with common args, then spread it for variants. This keeps variant stories focused on what differs.
Args are the inputs to a story. They map directly to component props. argTypes control how Controls renders and labels each arg. Storybook infers argTypes from TypeScript types and JSDoc, but explicit declarations override inference when needed.
Global args (defined in preview.js) apply to every story — useful for theme providers, locale, and other cross-cutting concerns.
Decorators wrap stories in additional context: providers, layout wrappers, mock data, CSS resets. They compose in order — story-level decorators run innermost, global decorators outermost. Keep decorators stateless; side effects in decorators cause flaky tests.
Play functions run after the story renders. They use @storybook/testing-library to simulate user interactions and @storybook/jest for assertions. The Interactions addon shows each step and its pass/fail status.
Play functions run automatically in storybook test (Storybook's test runner) — the same story drives both the visual preview and the interaction test.
Visual tests capture screenshots and compare against baselines. Chromatic is the primary integration — it runs on CI, tracks story changes, and manages baselines through a review workflow. Storybook's built-in --test mode runs interaction tests locally.
See references/process.md for CSF3 examples, argTypes config, decorator patterns, play function examples, visual testing setup, MDX documentation, Chromatic CI config, framework-specific notes, and anti-patterns.
development
Creates a brand from scratch through market research and interactive sparring. Runs competitive research via Perplexity, then guides the user through positioning, audience, voice, values, and content pillars. Produces the full brand guideline set at .ai/brand/{name}/. Use when building a new brand, defining brand strategy for a product, or when /våbenskjold:create is invoked.
testing
Loads brand guidelines from .ai/brand/{name}/ and makes them available to the current context. Progressive disclosure: L1 confirms brand exists, L2 loads summary, L3 loads specific files on demand. Use when a downstream skill or user needs brand context, or when /våbenskjold:apply is invoked.
documentation
Guided reinvention of an existing brand guideline. Loads current brand from .ai/brand/{name}/, identifies what to keep vs change, and walks the user through targeted evolution. Preserves brand equity while updating positioning, voice, or values. Use when refreshing a brand or when /våbenskjold:evolve is invoked.
development
Codifies an existing brand from materials, samples, and references. Analyzes provided content to extract voice patterns, values, and positioning. Produces the same guideline format as brand-strategy. Use when a brand already exists but isn't documented, or when /våbenskjold:audit is invoked.