All jobs

Add Storybook to a SolidJS App

Yes. An agent adds Storybook with the Solid Vite framework to a SolidJS app, writes stories for its presentational components, builds it, and opens a pull request.

Run this on RushOpens the console with this prompt ready to send, in a Project that has your repository.

What the agent does

The agent reads the build before it adds a second one. In an app like solidjs/solid-realworld, package.json has two dependencies, solid-js ^1.3.3 and marked, and a Rollup 2.52.3 toolchain in devDependencies: @rollup/plugin-babel with babel-preset-solid, @rollup/plugin-node-resolve, @rollup/plugin-commonjs, rollup-plugin-delete and rollup-plugin-terser, with start running serve public beside rollup -w -c and build running rollup -c --environment production; test is the placeholder "test". rollup.config.js compiles src/index.js into public/ as ES modules, and public/index.html loads the RealWorld CSS and Ionicons from CDNs. package-lock.json resolves solid-js to 1.3.3. There is no Vite, no TypeScript and no test runner, and the source is .js files with JSX.

Then it sorts the components by what they need to render. src/components/ArticlePreview.js takes article, token and onClickFavorite props and renders a card with a favourite button that only appears when token is set; ListErrors.js takes an errors object and renders a list or nothing; both are pure props-in, markup-out, which is what a story needs. NavLink.js calls useRouter() from src/store, and NavBar.js calls useStore() for appName and currentUser, so both depend on the Provider in src/store/index.js, which also creates the agent that talks to the RealWorld API and reads jwt from localStorage. The pages under src/pages/ depend on the store throughout. So the first stories are ArticlePreview and ListErrors; NavLink and NavBar get a decorator that wraps them in a small router and store context with fixed values, and the pages are left for later with a note.

The framework for Solid is storybook-solidjs-vite, 10.7.4 at the time of writing, which needs storybook 10, Vite 5 or newer and solid-js 1.8.0 or newer, so the app's ^1.3.3 has to move first. The agent bumps solid-js to the current 1.x and babel-preset-solid to match, runs npm run build and loads public/index.html in its browser to confirm the app still renders its feed and navigates, since the bump crosses several minor releases of both packages. Then it runs npx create-storybook --type=solid, which installs storybook, vite, vite-plugin-solid and the framework and writes .storybook/main.js with framework: { name: 'storybook-solidjs-vite' } and a stories glob for src/**/*.stories.js. Storybook runs on its own Vite server and leaves the Rollup build alone, so start and build are unchanged; the agent adds storybook and build-storybook scripts and storybook-static/ to .gitignore. Because public/index.html loads the RealWorld stylesheet from a CDN, .storybook/preview-head.html loads the same two stylesheets so the stories look like the app.

The stories follow the CSF 3 form. ArticlePreview.stories.js has Default with a fixed article object, Favorited with favorited: true and a favoritesCount, SignedOut with token unset so the button disappears, and ManyTags; ListErrors.stories.js has Empty and WithErrors using the API's { field: [messages] } shape. NavBar.stories.js has SignedOut and SignedIn, each through a decorator that provides the two contexts with createStore values the story controls. The agent runs npm run build-storybook, opens storybook-static/index.html in its browser to check each story renders with the stylesheet, and adds a storybook job to CI, or a new workflow when the repository has none, that builds the static site on pull requests. The stylesheet CDN is noted in the pull request as the one network dependency the stories keep.

Start it with one API call

POST https://api.phoenix.so/o/{org}/sessions with this body:

{
  "agent": "claude",
  "input": "A Linear issue labelled agent says: \"Add Storybook so we can work on components without the API running.\" Do the work in this SolidJS app. Read package.json, the lock file, the bundler config, index.html and every file under src/components and src/store first, and sort the components into ones that take only props and ones that need the store or router context. Check the Solid version the Storybook framework for Solid requires; if the app is below it, bump solid-js and its Babel preset, rebuild and load the app in the browser to confirm it still works before going on. Install Storybook with its Solid Vite framework using the create command, keep the existing bundler and scripts untouched, and load the app's stylesheets in the Storybook preview head. Write CSF 3 stories for each props-only component covering its visible states, and for context-dependent components add a decorator that provides fixed store and router values. Build the static Storybook, open it in the browser to check every story, add a CI job that builds it on pull requests, and open a pull request that lists each story and what it shows.",
  "resources": [
    {
      "url": "https://github.com/your-org/your-app"
    }
  ]
}
  1. Get an API key. In the console, open Settings, then API keys, and create a key for your org. Send it in the Authorization header as a Bearer token.
  2. Send the request. POST the body in request.json to https://api.phoenix.so/o/{org}/sessions, with your repository as the resources URL. The run starts in its own cloud sandbox.
  3. Read what came back. Follow the run on its live stream or wait for the run.completed webhook, then read the result and its trajectory.

What comes back

A pull request with the solid-js and babel-preset-solid bump and its lock file change, .storybook/main.js, preview.js and preview-head.html, the new scripts, the .gitignore line, one *.stories.js beside each covered component, the context decorator, and the CI job. The description lists every story with the state it shows, a screenshot of each from the static build, the npm run build output and a screenshot of the app after the Solid bump, and the components left for a later issue with the reason; the full build logs are in the run's record.

A reviewer reads the Solid bump first, since it touches the app and not only the tooling, and the app screenshot and build output are the evidence it was safe. Then the stories: a reviewer checks that each state in the list is one a designer would want to see, and that the decorator's fixed store values are plausible rather than empty. The CI job is the part that keeps the stories building once people stop looking.

Run it on every Linear issue labelled agent

In the console, an automation with a linear trigger on linear.issue.labeled and the label agent starts one run per labelled issue, with the issue added after the prompt, in the Project's repository. Changes made by an app integration never fire it, so the agent's own comment on the issue does not start another run. Each run reads that app's own components and bundler, so an app already on Vite skips the version check and an app with TypeScript gets .stories.tsx.

From your own server, the same run is one POST /o/{org}/sessions per issue: put the repository in resources and add the issue's https://linear.app/<workspace>/issue/<ID> URL there too, so Rush reads it through your Linear connection into the prompt. A webhook URL on the API key reports run.completed or run.failed with the session_url when the turn finishes.

The use case this job follows, with its automation and trigger: Turn a Linear label into a PR.

Why run it on Rush?

Adding Storybook to an older Solid app is two changes pretending to be one: a dependency bump that touches the running app, and the tooling on top of it. The agent separates them, rebuilds and loads the app in its own browser after the bump, then builds the stories and opens each one, and the pull request carries screenshots of both, so a reviewer sees that the app survived and what the stories look like without checking out the branch.

The same run fits any Solid app, whether it builds with Rollup, Vite or inside SolidStart: the agent reads the bundler it finds and leaves it alone, because Storybook brings its own. Each app gets stories for the components that can stand alone and a decorator for the ones that cannot, and every run keeps the full record of the builds and the pages it opened.

Frequently asked questions

Does it replace my Rollup build with Vite?

No. Storybook runs its own Vite dev server through the Solid framework package, and the app's start and build scripts keep using Rollup. The only change to the app's own dependencies is the Solid bump the framework requires, and the pull request shows the app building and running after it.

Why bump solid-js at all?

The Solid Storybook framework requires solid-js 1.8 or newer, and an app on 1.3 cannot load it. The agent moves to the current 1.x, rebuilds, and loads the app in the browser before writing a story, so the bump is verified on its own.

What about components that use the store or the router?

They get a decorator that renders them inside the same context providers the app uses, with a store the story fills in: a signed-in user for one story, none for another. Pages that fetch from the API through the store are listed in the pull request as a later issue, since they need a mocked agent rather than a fixed value.

Will the stories look like the app?

Yes. The app loads its stylesheet and icon font from a CDN in index.html, and the agent loads the same two links in .storybook/preview-head.html, so the stories render with the real styles. That CDN is the one network dependency the stories keep, and the pull request says so.

More SolidJS jobs

The same job on other stacks

More jobs like this: Turn a Linear label into a PR

Keep reading