> **Version 11 (RC)** — **React** / **TypeScript**
> Also available:
- `?codeOnly=true` for code snippets only
- other versions: Version 10.6 (latest) (`/docs/ai/skills/write-stories.md`), Version 9 (`/docs/9/ai/skills/write-stories.md`), Version 8 (`/docs/8/ai/skills/write-stories.md`)

# Write stories

The `/write-stories` skill gives your agent the rules for the stories of your project, so every component it creates or changes gets stories. It isn't available for your framework yet. See [supported frameworks](https://storybook.js.org/docs/11/ai/connect.md#supported-frameworks).

The `/write-stories` skill gives your agent the rules for the stories of your project: which states get a story, and how to write the imports, play functions, and mocks. Every component your agent creates or changes gets stories that show its states and test its behavior.

## When your agent uses it

The skill is step 2 of the [Storybook section in `AGENTS.md`](https://storybook.js.org/docs/11/ai/agents-md.md). With that section, your agent uses it for every component it creates or changes.

You can also ask for the skill by name, for example "Use the /write-stories skill to add stories for the user list".

## What the agent writes

- **One story for each state.** The agent writes a story for each state the component can reach, such as variants, loading, empty, error, and disabled, with realistic props.
- **Play functions.** An interactive component also gets a [play function](https://storybook.js.org/docs/11/writing-stories/play-function.md) that interacts with it and checks the result.
- **Network mocks.** A story never calls a real service. When your project has MSW set up for Storybook, the agent mocks [network requests](https://storybook.js.org/docs/11/writing-stories/mocking-data-and-modules/mocking-network-requests.md) with it. When it doesn't, the agent adds no dependency: it writes the stories that send no request, and tells you which stories would need a network mock. A component that fetches when it renders gets no story until MSW is set up, also not for its loading state.
- **Module mocks.** For other dependencies, the agent uses [module mocks](https://storybook.js.org/docs/11/writing-stories/mocking-data-and-modules/mocking-modules.md).

The agent follows your project's conventions. It writes stories in the [story format](https://storybook.js.org/docs/11/writing-stories/csf.md) that your project uses, and it doesn't rewrite your existing stories to match its own rules.

## Requirements

- Storybook 11 and a [supported framework](https://storybook.js.org/docs/11/ai/connect.md#supported-frameworks)

**More AI resources**

- [Connect your agent](https://storybook.js.org/docs/11/ai/connect.md)
- [The AGENTS.md section](https://storybook.js.org/docs/11/ai/agents-md.md)
- [Component docs](https://storybook.js.org/docs/11/ai/skills/component-docs.md)
- [Test stories](https://storybook.js.org/docs/11/ai/skills/test-stories.md)
- [UI review](https://storybook.js.org/docs/11/ai/skills/ui-review.md)
- [Best practices for using Storybook with AI](https://storybook.js.org/docs/11/ai/best-practices.md)