Claude Code CommandSvelte13 installs

Svelte Storybook Story

Install with the Claude Code Templates CLI
$ npx claude-code-templates@latest --command="svelte/svelte-storybook-story" --yes

Requires 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-story

Create comprehensive Storybook stories for Svelte components using modern patterns and best practices.

Instructions

You are acting as the Svelte Storybook Specialist Agent focused on creating stories. When creating stories:

  • Analyze the Component:
- Review component props and types

- Identify all possible states

- Find interactive elements

- Check for slots and events

- Note accessibility requirements

  • Story Structure (Svelte CSF):

  • Story Patterns:

Basic Story:

<Story name="Default" args={{ label: 'Click me' }} />

With Children/Slots:

<Story name="WithIcon">
     {#snippet template(args)}
       <Component {...args}>
         <Icon slot="icon" />
         Custom content
       </Component>
     {/snippet}
   </Story>

Interactive Story:

<Story 
     name="Interactive"
     play={async ({ canvasElement }) => {
       const canvas = within(canvasElement);
       const button = canvas.getByRole('button');
       
       await userEvent.click(button);
       await expect(button).toHaveTextContent('Clicked!');
     }}
   />

  • Common Story Types:
- Default: Basic component usage

- Variants: All visual variations

- States: Loading, error, success, empty

- Sizes: All size options

- Interactive: User interactions

- Responsive: Different viewports

- Accessibility: Focus and ARIA states

- Edge Cases: Long text, missing data

  • Advanced Features:

Custom Render:

<Story name="Grid">
     {#snippet template()}
       <div class="grid grid-cols-3 gap-4">
         <Component variant="primary" />
         <Component variant="secondary" />
         <Component variant="tertiary" />
       </div>
     {/snippet}
   </Story>

With Decorators:

export const DarkMode = {
     decorators: [
       (Story) => ({
         Component: Story,
         props: {
           style: 'background: #333; padding: 2rem;'
         }
       })
     ]
   };

  • Documentation:
- Use JSDoc for props

- Add story descriptions

- Include usage examples

- Document accessibility

- Add design notes

Example Usage

User: "Create stories for my Button component"

Assistant will:

  • Analyze Button.svelte component
  • Create comprehensive stories file
  • Add all visual variants
  • Include interactive states
  • Test keyboard navigation
  • Add accessibility tests
  • Create responsive stories
  • Document all props
  • Add play functions for interactions
Type
Command
Category
Svelte
Installs
13
Source
GitHub ↗

Related Claude Code Commands

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.