svelte-storybook — Claude Code subagent: what it does, how to install
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.
no license ★ 1,357 updated 2026-03-01
.claude/agents/svelte-storybook.mdWhat svelte-storybook 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.
What it helps with
- write a story for a SvelteKit component without tuning
.storybook/main.jsby hand - mock
$app/pathsso a story renders outside the app - port CSF v4 stories to
defineMetaand Svelte 5 snippets - add a
playfunction that fills a form and asserts the result - turn on the
color-contrastrule in@storybook/addon-a11y
Example prompts for the agent
- Write a story for
Button.sveltewithdefineMetaand separate variants for primary and danger - The story crashes on
$app/paths— mock that module so it renders on its own - Move
Card.stories.sveltefrom CSF v4 todefineMetaand snippets
How to install svelte-storybook
Manually: put the files in place
.claude/agents/svelte-storybook.mdFor all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention
Manually: put the files in place
.codex/agents/svelte-storybook.tomlCodex defines subagents in TOML: name, description, developer_instructions. Move the Markdown text into developer_instructions by hand. For all projects use ~/.codex/agents/
Manually: put the files in place
.cursor/agents/svelte-storybook.mdCursor also reads .claude/agents/
Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean
Questions about svelte-storybook
How to install svelte-storybook in Claude Code?
Copy the subagent file into your project at .claude/agents/svelte-storybook.md; Claude picks it up from there.
What does svelte-storybook do?
It writes Storybook stories for SvelteKit components: defineMeta for the metadata, a Story per state, controls for the props. It also mocks $app/* and $lib modules so a story loads without the app running.
Does it require Svelte 5?
Snippets, the composition style it uses for stories, arrived in Svelte 5. It also converts older stories built on Template and slots to the newer syntax.