Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Storybook Knowledge Patch?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nevaberry-storybook-knowledge-patch-nevaberry-plugins)
---
name: storybook-knowledge-patch
description: Storybook
version: "10.6.9"
license: MIT
metadata:
author: Nevaberry
---
# Storybook knowledge patch
Load this skill when configuring Storybook, authoring stories and docs,
working with framework integrations, or running component tests and CLI automation.
Use the quick references below for common changes and the topic files for details.
## Reference index
| Reference | Topics |
| --- | --- |
| [Configuration and manager](references/configuration-and-manager.md) | ESM, Vite configuration and build stats, initialization, tag filters, favicon, viewport, Measure and Outline, security patches, embedding |
| [Frameworks and migrations](references/frameworks-and-migrations.md) | Angular, Svelte, SvelteKit, React Native, Preact, Next.js mocks, TanStack routing and preview typing |
| [Story authoring and docs](references/story-authoring-and-docs.md) | UI authoring and validation, React CSF Factories Preview, composed Controls, Docs modules, standalone MDX IDs, accessible actions, experimental docgen |
| [Testing and automation](references/testing-and-automation.md) | Test widget, automocking, experimental story and RSC tests, Vitest, Pseudo States, Oxlint, experimental Review and MCP CLI, browser launch, MCP validation and schema |
## Breaking changes and deprecations
### ESM-only distribution
Storybook 10 publishes only ES modules and requires Node support for loading
them with `require()`. The release notes list Node 20.16+, 22.19+, or 24+.
### Legacy viewport default
Storybook warns on the legacy `viewport.defaultViewport` parameter.
Set the initial viewport in the preview's `initialGlobals`, for example
`initialGlobals: { viewport: { value: 'mobile1', isRotated: false } }`.
### ExternalDocs
`ExternalDocs` is deprecated.
## Security and development boundaries
Storybook 10.6.2 contains fixes for `GHSA-f2ph-cmg5-wxc8` and `GHSA-px85-f4q5-jh77`.
### Dev server embedding and preview messages
Storybook 8.6.19 and 9.1.21 restrict dev server iframe embedding to localhost
origins. The preview accepts `postMessage` traffic only from known manager origins.
Storybook 10.6.6 restores support for embedding the dev server in StackBlitz.
### Authoring, MCP, and browser permissions
Storybook 8.6.19 and 9.1.21 limit component searches and story save paths to the
project root. Story creation validates the component export name, and saving
validates the story name and arg keys as identifiers.
Storybook 8.6.19 and 9.1.21 validate MCP request origins and add a host validation
warning. These versions disable file writes and command execution from the
browser in the Vitest addon.
## Stories and component tests
### UI authoring and Test widget
Storybook 9 can create and edit stories from the UI. With the Test Codegen addon,
record interactions, add assertions, and save the generated test from Storybook.
Run selected test types across all stories from the Test widget, then filter the
sidebar to stories with warnings or errors. Watch mode reruns affected tests
when you save a file.
### React CSF Factories Preview
CSF Factories are in Preview for React in Storybook 10. A factory-based preview
infers the types for metadata and stories, and existing CSF files can stay in
their current format.
```ts
import preview from '../.storybook/preview';
import Button from './Button';
const meta = preview.meta({ component: Button });
export const Primary = meta.story({ args: { label: 'Button', primary: true } });
```
### Experimental tests attached to stories
CSF factory stories can attach named tests through `.test()`. The callback
receives the story's play context, and tag filters can hide test entries from
the sidebar.
```ts
Primary.test('renders a button', async ({ canvas }) => {
await canvas.findByRole('button');
});
```
Tags that mark a CSF factory story to be skipped also apply to its `.test()` children.
### Automocking and Vitest globals
Storybook 10's `sb.mock` works with Vite and Webpack. Mocks are available both in
development and in static production builds.
Pass `initialGlobals` to `storybookTest()` to pin globals for a Vitest project.
For a Storybook with a `theme` global,
`storybookTest({ initialGlobals: { theme: 'dark' } })` lets that project run under
the dark theme.
Starting in Storybook 10.6.1, the Vitest addon supports running browser tests
with Vitest 5.
### Experimental React Server Component tests
Storybook 10 offers experimental component testing for React Server Components
through its early access program. RSC component testing is also available
directly in Vitest.
## Framework setup
### Angular on Vite (Preview)
Set `framework: '@storybook/angular-vite'` in `.storybook/main.ts` to use Vite for
Angular stories, docs, and component tests. The Angular-to-Vite automigration
installs `@analogjs/vite-plugin-angular`, preserves `zone.js`, and configures the
Vitest addon when applicable.
In 10.5.1, `@storybook/angular-vite` adds TypeScript 6 peer support and drops its
peer dependency on `@angular/platform-browser-dynamic`.
Starting in Storybook 10.6.2, `@storybook/angular-vite` requires
`@analogjs/vite-plugin-angular` 2.7.3 or later.
### Svelte snippets
Svelte CSF supports Svelte 5 runes and snippets. Use a `template` snippet to render
a story with its supplied args.
```svelte
<Story name="Default" args={{ exampleProp: true }}>
{#snippet template(args)}
<MyComponent {...args} />
{/snippet}
</Story>
```
Storybook 10 supports Svelte async components and can mock SvelteKit's `$app/state` module.
### Shared React Native and web stories
Storybook 9 lets React Native and React Native Web run side by side in one mobile
project. Use the same stories on devices or simulators and with the web Docs
and Test addons.
## Configuration and manager shortcuts
### Vite configuration loader
Set `configLoader` in the Vite builder options to select how Vite loads its
configuration. In a Vite framework's options, use
`builder: { configLoader: 'runner' }` to select the runner loader.
### Default tag exclusion
The sidebar can exclude stories by tag. Set the initial filter state in
`.storybook/main.ts` to hide stories tagged `experimental` by default.
```ts
export default {
tags: { experimental: { defaultFilterSelection: 'exclude' } },
};
```
### Measure and Outline
Measure and Outline honor their `disable` parameters. To turn off both for a
story, use `parameters: { measure: { disable: true }, outline: { disable: true } }`.
## Docs and component metadata
Docs blocks can resolve CSF factory modules that use only named exports.
Controls load for stories from composed Storybook refs, including when a user
opens a composed story through a direct link.
Set `id` on a standalone page's `<Meta>` block to choose an explicit ID, for
example `<Meta title="Guides/Setup" id="setup-guide" />`.
Set `ariaLabel` on a Docs `ActionItem` to give the action an accessible name,
for example `ariaLabel: 'Open component source'`.
### Experimental React docgen service
Set `features.experimentalDocgenServer` to `true` in `.storybook/main.ts` to share
React component metadata across MCP, Docs, and Controls. In this mode, arg types
inferred from initial args yield to docgen and explicit `argTypes`.
## Review and CLI automation
### Experimental Agentic Review
Enable AI-curated visual changesets and story search results with
`features.experimentalReview: true` in `.storybook/main.ts`.
The flag is unset by default so the CLI plugins can enable it.
### Experimental MCP CLI
Enable the `STORYBOOK_FEATURE_AI_CLI` environment flag to use `storybook ai` as an
MCP passthrough. Instance discovery considers the working directory and Storybook
config directory. Use `--port` or `-p` to select an instance by port.
### Browser launch and agent-run upgrades
The CLI honors `BROWSER` and `BROWSER_ARGS` when opening a browser. Under an agent,
`storybook dev` skips automatic browser launch and `storybook upgrade` installs
the MCP integration.