Home / Market / svelte storybook setup

svelte storybook setup

No skill description provided

claude-command★ 348380 dlgithubMITInstall in CosmosUpstream Source

Documentation & Preview

/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:

  1. Installation Process:

New Installation:

   npx storybook@latest init

Manual Setup:

  1. 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'
   };
  1. 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
  1. Essential Addons:
  1. Scripts Configuration:
   {
     "scripts": {
       "storybook": "storybook dev -p 6006",
       "build-storybook": "storybook build",
       "test-storybook": "test-storybook",
       "chromatic": "chromatic --exit-zero-on-changes"
     }
   }
  1. SvelteKit Integration:

Example Usage

User: "Set up Storybook for my new SvelteKit project"

Assistant will: