Svelte Storybook Setup
$ npx claude-code-templates@latest --command="svelte/svelte-storybook-setup" --yesRequires Claude Code. The command adds this command to your project's .claudedirectory — nothing runs on ToolZip's servers.
What's inside this command
Component source
/svelte:storybook-setup
Initialize and configure Storybook for SvelteKit projects with optimal settings and structure.
Instructions
You are acting as the Svelte Storybook Specialist Agent focused on Storybook setup. When setting up Storybook:
- Installation Process:
New Installation:
npx storybook@latest init
Manual Setup:
- Install core dependencies
- Configure @storybook/sveltekit framework
- Add essential addons
- Set up Svelte CSF addon
- Configuration Files:
.storybook/main.js:
export default {
stories: ['../src/**/*.stories.@(js|ts|svelte)'],
addons: [
'@storybook/addon-essentials',
'@storybook/addon-svelte-csf',
'@storybook/addon-a11y',
'@storybook/addon-interactions'
],
framework: {
name: '@storybook/sveltekit',
options: {}
},
staticDirs: ['../static']
};
.storybook/preview.js:
import '../src/app.css'; // Global styles
export const parameters = {
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i
}
},
layout: 'centered'
};
- Project Structure:
src/
├── lib/
│ └── components/
│ ├── Button/
│ │ ├── Button.svelte
│ │ ├── Button.stories.svelte
│ │ └── Button.test.ts
│ └── Card/
│ ├── Card.svelte
│ └── Card.stories.svelte
└── stories/
├── Introduction.mdx
└── Configure.mdx
- Essential Addons:
- @storybook/addon-svelte-csf: Native Svelte stories
- @storybook/addon-a11y: Accessibility testing
- @storybook/addon-interactions: Play functions
- @chromatic-com/storybook: Visual testing
- Scripts Configuration:
{
"scripts": {
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"test-storybook": "test-storybook",
"chromatic": "chromatic --exit-zero-on-changes"
}
}
- SvelteKit Integration:
- Set up path aliases
- Handle SSR considerations
- Configure static assets
Example Usage
User: "Set up Storybook for my new SvelteKit project"
Assistant will:
- Check project structure and dependencies
- Run Storybook init command
- Configure for SvelteKit framework
- Add Svelte CSF addon
- Set up proper file structure
- Create example stories
- Configure preview settings
- Add helpful npm scripts
- Set up GitHub Actions for Chromatic
Related Claude Code Commands
Svelte Debug
A ready-to-install Claude Code component.
Svelte Test Coverage
A ready-to-install Claude Code component.
Svelte Component
Create new Svelte components with best practices, TypeScript support, and testing
Svelte Optimize
A ready-to-install Claude Code component.
Svelte Test Setup
A ready-to-install Claude Code component.
Svelte Test
A ready-to-install Claude Code component.
Catalog data and component content are sourced from the open-source davila7/claude-code-templates project (MIT license). ToolZip curates the listing and writes original descriptions; every component links back to its original source. Claude Code is a product of Anthropic. ToolZip is an independent catalog and is not affiliated with or endorsed by Anthropic.