# svelte-storybook

svelte-storybook documents SvelteKit components in Storybook and writes the story files with Svelte CSF. Handy when a single component needs checking away from the running app.

- subagent · `type=agent` · Claude Code, Codex, Cursor · ★ 1357 repo stars
- Author: qdhenry
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/qdhenry/Claude-Command-Suite/tree/HEAD/.claude/agents/svelte-storybook.md
- Updated: 2026-03-01
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/agents/svelte-storybook

## What it does

This is a Claude subagent tuned for the `@storybook/sveltekit` framework and the Svelte CSF addon. Tell it which component to show and it produces the story file: `defineMeta` for metadata, one `Story` block per state, `argTypes` with a `select` control for props such as `variant`.

SvelteKit modules that fail in isolation get replaced — `$app/environment`, `$app/paths`, `$lib`, `@sveltejs/kit/*`. The store and navigation fakes sit under the `sveltekit_experimental` parameter, and that mode is experimental, so stories you plan to keep shouldn't lean on it. Migrations are covered too: CSF v4 stories move to `defineMeta` with Svelte 5 snippets, and a project on `@storybook/svelte` switches to the SvelteKit framework.

For checks it reaches for Chromatic or Percy, `@storybook/addon-a11y` rules, and `play` functions driven by `userEvent` — type an email, click the button, assert the success text. The toolset is `Read`, `Write`, `Edit`, `MultiEdit`, `Glob`, `Grep`, `Bash` and `WebFetch`, so it edits story files and config directly in your project.

## Install

### Claude Code (native platform)

**Manually: put the files in place**
- File: `.claude/agents/svelte-storybook.md` — For all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention

### Codex

**Manually: put the files in place**
- File: `.codex/agents/svelte-storybook.toml` — Codex defines subagents in TOML: name, description, developer_instructions. Move the Markdown text into developer_instructions by hand. For all projects use ~/.codex/agents/

### Cursor

**Manually: put the files in place**
- File: `.cursor/agents/svelte-storybook.md` — Cursor also reads .claude/agents/

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/qdhenry/Claude-Command-Suite/tree/HEAD/.claude/agents/svelte-storybook.md

## When to use it
- write a story for a SvelteKit component without tuning `.storybook/main.js` by hand
- mock `$app/paths` so a story renders outside the app
- port CSF v4 stories to `defineMeta` and Svelte 5 snippets
- add a `play` function that fills a form and asserts the result
- turn on the `color-contrast` rule in `@storybook/addon-a11y`

## Example prompts
- Write a story for `Button.svelte` with `defineMeta` and separate variants for primary and danger
- The story crashes on `$app/paths` — mock that module so it renders on its own
- Move `Card.stories.svelte` from CSF v4 to `defineMeta` and snippets

## Similar
- [svelte-storybook-setup](https://affpapa.org/en/nevibecode/commands/svelte-storybook-setup.md) — command · 119 installs
- [svelte-storybook-mock](https://affpapa.org/en/nevibecode/commands/svelte-storybook-mock.md) — command · 121 installs
- [Svelte](https://affpapa.org/en/nevibecode/mcp/svelte.md) — MCP server · 1169 installs
- [svelte-llm-mcp](https://affpapa.org/en/nevibecode/mcp/khromov-svelte-llm-mcp.md) — MCP server · 910 installs
- [svelte-mcp-feedback](https://affpapa.org/en/nevibecode/skills/svelte-mcp-feedback.md) — skill · 102 installs
- [ux-ui-svelte-wasp-drone](https://affpapa.org/en/nevibecode/agents/ux-ui-svelte-wasp-drone.md) — subagent · ★ 96 repo stars

From the same set: [qdhenry/claude-command-suite](https://affpapa.org/en/nevibecode/by/qdhenry/claude-command-suite.md) — 112 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
