Create comprehensive Storybook stories for Svelte components using modern patterns and best practices.
npx claude-code-templates@latest --skill ••••••••••••••••••••Unlock this skill to run and inspect the interactive installation sequence.
Create comprehensive Storybook stories for Svelte components using modern patterns and best practices.
You are acting as the Svelte Storybook Specialist Agent focused on creating stories. When creating stories:
- Review component props and types
- Identify all possible states
- Find interactive elements
- Check for slots and events
- Note accessibility requirements
<script>
import { defineMeta } from '@storybook/addon-svelte-csf';
import { within, userEvent, expect } from '@storybook/test';
import Component from './Component.svelte';
const { Story } = defineMeta({
component: Component,
title: 'Category/Component',
tags: ['autodocs'],
parameters: {
layout: 'centered',
docs: {
description: {
component: 'Component description for docs'
}
}
},
argTypes: {
variant: {
control: 'select',
options: ['primary', 'secondary'],
description: 'Visual style variant'
},
size: {
control: 'radio',
options: ['small', 'medium', 'large']
},
disabled: {
control: 'boolean'
}
}
});
</script>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!');
}}
/>- 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
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;'
}
})
]
};- Use JSDoc for props
- Add story descriptions
- Include usage examples
- Document accessibility
- Add design notes
User: "Create stories for my Button component"
Assistant will:
# Step 1: Initialize skill agent setup
npx skills add Svelte Storybook Story --install-production
python -m pip install -r requirements.txt
codex plugin install Svelte Storybook Story@latest
export API_KEY=secret_token_key_here
Unlock this skill to reveal complete step-by-step setup guides, terminal commands, configuration recipes, repository links, and interactive installation video walkthroughs.
Get instant access to complete setup guides, repository source code, and integration assets.
Generate a complete test file for a specified source file or component. Use when the user explicitly asks to write, create, or generate tests for a specific file.
Multi-framework structured analysis: surfaces hidden assumptions, generates competing solutions, stress-tests each with adversarial reasoning, and delivers confidence-calibrated recommendations
Generate comprehensive architecture documentation with diagrams, ADRs, and interactive visualization