skills/storybook-rsbuild/SKILL.md
Set up or migrate Storybook to use the Rsbuild builder. Handles fresh setup for React, Vue 3, HTML, Web Components, and React Native Web, migration from webpack5 or Vite frameworks, and integrations with Rslib, Modern.js, and Rspack. Use when asked to add Storybook, migrate Storybook to Rsbuild, configure rsbuildFinal, or integrate Storybook with Rslib/Modern.js/Rspack.
npx skillsauth add rstackjs/agent-skills storybook-rsbuildInstall 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.
Set up Storybook on Rsbuild, or migrate an existing Storybook to it. Factual mappings — version compatibility, package names, install commands, config conversion patterns — live in upstream docs at storybook.rsbuild.rs. This skill is an action router and a behavioral checklist; it does not duplicate the docs.
Single source of truth is upstream. Fetch the relevant storybook.rsbuild.rs page for version tables, install commands, and config conversion patterns. Do not infer version pins or package names from training memory — the ecosystem moves faster than the model's prior.
Pin from the framework guide's Requirements table. Each framework guide page (e.g. https://storybook.rsbuild.rs/guide/framework/react) carries a Requirements section listing the canonical compatible version ranges — that is the authoritative source for version pins. For fresh setups, install the latest stable storybook major and the matching storybook-rsbuild major. Do not pin from version numbers you see in code snippets elsewhere; only the docs are authoritative.
Declare @rsbuild/core directly. storybook-<framework>-rsbuild lists @rsbuild/core as a peer dependency, but you must still add @rsbuild/core to the project's own devDependencies so version pins and lockfile audits remain unambiguous and a future framework-package release that drops the peer cannot silently break the build.
Migration is one task with two ordered phases — both required. Phase A: install the new framework package and update config; leave the old framework package, old builder package, and old webpackFinal / viteFinal blocks in place so Verification has a rollback path. Phase B: as soon as Verification passes, in the same task, remove the old framework package (e.g. @storybook/react-webpack5, @storybook/vue3-vite), the old builder package (e.g. @storybook/builder-webpack5, @storybook/builder-vite), and the old webpackFinal / viteFinal block. A migration that ends with both builders' framework packages still in package.json is incomplete — leaving them is the most common silent regression in this skill's evals. Phase A on its own is not a valid stopping point; if you ran Verification, you must also run cleanup.
Preserve addons; never silently drop. When migrating, webpack-only addons (e.g. @storybook/addon-styling-webpack) must either be passed through webpackAddons (so upstream auto-translation handles them) or replaced with the equivalent Rsbuild-native pipeline (@rsbuild/plugin-postcss, tools.postcss, etc.). A migration that removes a styling addon and produces a passing storybook build but a visually broken story tree is still a regression.
Operate in scope. In monorepos, modify only the package that hosts stories. Do not edit business source files unless the migration strictly requires it.
Read package.json and project structure to determine existing Storybook state:
.storybook/ directory (in monorepos, check both root and per-package)package.json for storybook scripts or @storybook/* / storybook-*-rsbuild in dependencies or devDependenciesstorybook-*-rsbuild → already set up; go to Configuration or Troubleshooting as needed@storybook/*-webpack5, @storybook/*-vite, etc.) → go to Migration WorkflowRead package.json dependencies and devDependencies, check in order:
| Signal | Ecosystem | Integration guide |
| -------------------------------------- | ----------- | -------------------------------------------------------- |
| @rslib/core | Rslib | https://storybook.rsbuild.rs/guide/integrations/rslib |
| @modern-js/app-tools | Modern.js | https://storybook.rsbuild.rs/guide/integrations/modernjs |
| @rspack/core without @rsbuild/core | Pure Rspack | https://storybook.rsbuild.rs/guide/integrations/rspack |
If matched, read the integration guide and apply its constraints as an overlay alongside the steps below.
Infer the UI framework from app dependencies (react, vue, lit, etc.):
| UI Framework | Framework package | Guide |
| ---------------- | ------------------------------------ | ------------------------------------------------------------- |
| React | storybook-react-rsbuild | https://storybook.rsbuild.rs/guide/framework/react |
| Vue 3 | storybook-vue3-rsbuild | https://storybook.rsbuild.rs/guide/framework/vue |
| Vanilla JS/TS | storybook-html-rsbuild | https://storybook.rsbuild.rs/guide/framework/vanilla |
| Web Components | storybook-web-components-rsbuild | https://storybook.rsbuild.rs/guide/framework/web-components |
| React Native Web | storybook-react-native-web-rsbuild | https://storybook.rsbuild.rs/guide/framework/react-native-web |
storybook major and the matching storybook-<framework>-rsbuild major (Principle 2)@rsbuild/core to devDependencies directly, alongside storybook-<framework>-rsbuild (Principle 3).storybook/main.* uses the correct framework: '<storybook-*-rsbuild>'package.json has storybook dev and storybook build scriptssrc/stories/Example.stories.*) so Verification step 2 has something to renderRead the upstream migration guide: https://storybook.rsbuild.rs/guide/migration
Follow these steps in order:
.storybook/main.* (framework field and/or core.builder) and package.json dependencies to classify as "from webpack5" or "from Vite", then select the matching section in the migration guidestorybook-rsbuild major based on installed Storybook version@rsbuild/core as a direct devDep alongside the new framework package (Principle 3). Do not remove the old framework package or old devDeps yet — that happens after Verification (Principle 4).storybook/main.* — apply the config changes exactly as shown in the migration guide for the detected frameworkwebpackFinal / viteFinal); if found, convert following the upstream configuration guide (https://storybook.rsbuild.rs/guide/configuration)webpackAddons for upstream auto-translation, or replace it with the Rsbuild-native equivalent — never silently drop it (Principle 5). Consult the migration guide's addon section for the recommended fixpackage.json devDependencies (e.g. @storybook/react-webpack5, @storybook/vue3-webpack5, @storybook/react-vite, @storybook/vue3-vite, @storybook/html-webpack5, @storybook/web-components-webpack5, etc.)@storybook/builder-webpack5, @storybook/builder-vite)webpackFinal / viteFinal block from .storybook/main.*pnpm install (or the project's package manager equivalent) so the lockfile reflects the cleanupIf a factual mapping is needed (version table, package names, conversion patterns) and not present in this skill, fetch it from the upstream docs — do not guess.
storybook dev starts without errorsstories or a broken framework wiring will only surface here)storybook build completesnode_modules/.cache/storybook and retryrsbuildFinal block to isolate the issue, then re-add incrementally.storybook/ dirs: pick the one referenced by package.json scriptsrsbuildFinalFor rsbuildFinal, builder options, TypeScript, and framework-specific options → read https://storybook.rsbuild.rs/guide/configuration
development
Debug Rstest issues systematically, including performance regressions. First determine whether the slowdown is in build startup or test execution, then run controlled config or code experiments and compare before/after timings.
development
Opinionated Rslib recommendations for modern JS/TS npm package design covering pure ESM, strict TypeScript, explicit exports, small stable APIs, pragmatic dependencies, accurate sideEffects, correct declarations, package validation, provenance, README.md, and AGENTS.md. Use when the user wants to make a JS/TS package more modern, check whether the current package setup is healthy, review package.json/exports/types/dependencies/docs/release readiness, or apply a modern library baseline.
development
Create or update draft GitHub releases for the current project's main GitHub repository, then organize GitHub-generated release notes into user-friendly sections without rewriting release note items. Use for preparing, formatting, categorizing, creating, or updating GitHub release notes or draft releases, including optional highlights when the user asks for them.
tools
Migrate ESLint or other linters to Rslint. Use when asked to replace ESLint flat config, lint scripts, VS Code ESLint settings, inline directives, rules, presets, plugins, or lint dependencies with Rslint equivalents.