Join live: Storybook 11 AMA with the team
Docs
Storybook Docs

The AGENTS.md section

The Storybook section in AGENTS.md gives your agent one way to make every UI change: reuse your components, write stories, and know how to test them. You get UI that fits your project, with stories for it. When you want to see the result, ask for a review.

How it works

Storybook adds the section when it installs the skills. It lists these steps in order:

StepWhat the agent does
1Looks up the components to reuse, with their props and usage examples, with the /component-docs skill
2Writes stories for every component it creates or changes, with the /write-stories skill
3Can test the stories with the command the section names, npx storybook tools test run
4Ends its reply with a line that tells you about the /ui-review skill, after a change you can see

Your agent opens the skills of steps 1 and 2 before it edits any file, then follows each skill at its step. Steps 3 and 4 need no skill: step 3 is the command itself, and step 4 is the line "Use the /ui-review skill to see the changed components in Storybook". The agent creates a review only when you ask for it. See UI review.

When your agent follows it

With the Storybook section in AGENTS.md, your agent follows these steps for every change to how your UI looks: when it creates, changes, or deletes a component, story, style, theme, or design token.

Some steps also run on their own:

  • /component-docs, when you ask about a component's props, API, or usage
  • /ui-review, when you ask for a review or to see components or stories

Without that section, an agent connected only through skills doesn't follow these steps automatically. It can still use a skill that fits its task, and you can ask for one by name, for example "Use the /write-stories skill to add stories for the user list". An agent connected to the MCP server receives the same steps from the server instead.

What the agent does

For example, you ask your agent to "Build a login form". The agent:

  1. Looks up your components. Before it edits any file, it lists the components in your Storybook and reads the props and examples of the ones it needs, such as TextField and Button. It uses only documented props. See Component docs.
  2. Writes the component and its stories. It writes one story for each state the component can reach, such as empty, filled, invalid, and submitting, with realistic data. Interactive states get a play function that tests the behavior. When your project has MSW set up, it mocks the network requests the stories need; otherwise it tells you which stories would need a network mock. See Write stories.
  3. Knows how to test the stories. If your project has the Vitest addon, the section names the command that runs the component tests of the stories, with accessibility checks. When your agent runs it is up to the agent and the tool it runs in. See Test stories.
  4. Offers a review. It ends its reply with a line that offers the /ui-review skill. When you ask for the review, it finds the stories that its change affects, such as those of a LoginPage that renders the form, and groups them into a review. See UI review.

Change the section

To change the steps, remove both markers around the Storybook section in AGENTS.md, then edit the steps. For example, delete the step that tells you about the review, or tell the agent to create a review after every change. Storybook doesn't change a section without markers when you upgrade.

A step also skips itself when your project can't do it. The test step is left out when the main config of your Storybook doesn't list the Vitest addon.

Requirements

These addons are optional. Without one, the agent skips the step that needs it:

Tips

  • Monorepos: the agent runs Storybook commands from the package where Storybook is installed, such as packages/ui.
  • Sandboxed agents: some agents block network access and ports by default. Allow the agent to run Storybook commands and start the dev server.

More AI resources