/svelte-storybook-migrate · Comandos slash para Claude Code | Prompt Studio
    1. Claude Code
    2. Comandos slash
    3. /svelte-storybook-migrate
    Claude Code · Comandos slashRefactor

    /svelte-storybook-migrate

    Migra Storybook y stories a versiones nuevas.

    por davila7/claude-code-templates

    svelte

    Licencia: MITVer original

    Instalación

    npx claude-code-templates@latest --command svelte/svelte-storybook-migrate

    Contenido

    Dónde va: .claude/commands/svelte-storybook-migrate.md

    ---
    description: "Migrate Storybook configurations and stories to newer versions, including Svelte CSF v5 and @storybook/sveltekit framework."
    ---
    
    # /svelte:storybook-migrate
    
    Migrate Storybook configurations and stories to newer versions, including Svelte CSF v5 and @storybook/sveltekit framework.
    
    ## Instructions
    
    You are acting as the Svelte Storybook Specialist Agent focused on migration. When migrating Storybook:
    
    1. **Version Migrations**:
       
       **Storybook 6.x to 7.x**:
       ```bash
       # Automated upgrade
       npx storybook@latest upgrade
       
       # Manual steps:
       # 1. Update dependencies
       # 2. Migrate to @storybook/sveltekit
       # 3. Remove obsolete packages
       # 4. Update configuration
       ```
       
       **Configuration Changes**:
       ```javascript
       // Old (.storybook/main.js)
       module.exports = {
         framework: '@storybook/svelte',
         svelteOptions: { ... } // Remove this
       };
       
       // New (.storybook/main.js)
       export default {
         framework: {
           name: '@storybook/sveltekit',
           options: {}
         }
       };
       ```
    
    2. **Svelte CSF Migration (v4 to v5)**:
       
       **Meta Component → defineMeta**:
       ```svelte
       <!-- Old -->
       <script context="module">
         import { Meta, Story } from '@storybook/addon-svelte-csf';
       </script>
       
       <Meta title="Button" component={Button} />
       
       <!-- New -->
       <script>
         import { defineMeta } from '@storybook/addon-svelte-csf';
         import Button from './Button.svelte';
         
         const { Story } = defineMeta({
           title: 'Button',
           component: Button
         });
       </script>
       ```
       
       **Template → Children/Snippets**:
       ```svelte
       <!-- Old -->
       <Story name="Default">
         <Template let:args>
           <Button {...args} />
         </Template>
       </Story>
       
       <!-- New -->
       <Story name="Default" args={{ label: 'Click' }}>
         {#snippet template(args)}
           <Button {...args} />
         {/snippet}
       </Story>
       ```
    
    3. **Package Migration**:
       
       **Remove Obsolete Packages**:
       ```bash
       npm uninstall @storybook/svelte-vite
       npm uninstall storybook-builder-vite
       npm uninstall @storybook/builder-vite
       npm uninstall @storybook/svelte
       ```
       
       **Install New Packages**:
       ```bash
       npm install -D @storybook/sveltekit
       npm install -D @storybook/addon-svelte-csf@latest
       ```
    
    4. **Story Format Migration**:
       
       **CSF 2 to CSF 3**:
       ```javascript
       // Old (CSF 2)
       export default {
         title: 'Button',
         component: Button
       };
       
       export const Primary = (args) => ({
         Component: Button,
         props: args
       });
       Primary.args = { variant: 'primary' };
       
       // New (CSF 3)
       export default {
         title: 'Button',
         component: Button
       };
       
       export const Primary = {
         args: { variant: 'primary' }
       };
       ```
    
    5. **Addon Updates**:
       
       **Actions → Tags**:
       ```javascript
       // Old
       export default {
         component: Button,
         parameters: {
           docs: { autodocs: true }
         }
       };
       
       // New
       export default {
         component: Button,
         tags: ['autodocs']
       };
       ```
    
    6. **Module Mocking Updates**:
       
       **New Parameter Structure**:
       ```javascript
       // Old approach (custom mocks)
       import { page } from './__mocks__/stores';
       
       // New approach (parameters)
       export const Default = {
         parameters: {
           sveltekit_experimental: {
             stores: { page: { ... } }
           }
         }
       };
       ```
    
    7. **Migration Script**:
       ```javascript
       // migration-helper.js
       import { readdir, readFile, writeFile } from 'fs/promises';
       import { parse, walk } from 'svelte/compiler';
       
       async function migrateStories() {
         // Find all .stories.svelte files
         // Parse and transform AST
         // Update syntax to v5
         // Write updated files
       }
       ```
    
    8. **Testing After Migration**:
       - Run `npm run storybook`
       - Check all stories render
       - Verify interactions work
       - Test addons functionality
       - Validate build process
    
    ## Migration Checklist
    
    1. [ ] Backup current setup
    2. [ ] Update Storybook to v7+
    3. [ ] Migrate to @storybook/sveltekit
    4. [ ] Update Svelte CSF addon
    5. [ ] Convert story syntax
    6. [ ] Update module mocks
    7. [ ] Test all stories
    8. [ ] Update CI/CD config
    
    ## Example Usage
    
    User: "Migrate my Storybook from v6 with Svelte to v7 with SvelteKit"
    
    Assistant will:
    - Analyze current setup
    - Create migration plan
    - Run upgrade command
    - Update framework config
    - Convert story formats
    - Migrate CSF syntax
    - Update module mocking
    - Test and validate
    - Document breaking changes

    Más en Comandos slash

    • /commit

      Redacta un commit con Conventional Commits a partir de los cambios en stage.

    • /review

      Revisa el diff actual buscando bugs, casos borde y problemas de seguridad.

    • /tests

      Escribe tests para el archivo o función que indiques.

    • /changelog

      Genera las notas de versión desde el último tag.

    • /explain

      Explica cómo funciona un archivo o módulo, con un diagrama del flujo.

    • /cleanup

      Elimina imports, variables y código muerto sin cambiar el comportamiento.

    Ver todo en Comandos slash (717) →

    Tu colección definitiva de prompts de IA. Inspírate, explora ejemplos y crea con IA.

    Hubs principales

    • Prompts
    • Imágenes
    • Videos
    • Generar Videos
    • Plantillas
    • Animaciones
    • Precios
    • Conoce
    • Afiliado

    Explorar por tipo

    • Kits de componentes
    • Etiquetas de imagen
    • Etiquetas de video
    • Webs

    Temas populares

    • Música
    • Portafolio
    • Gaming
    • Viajes
    • Nano Banana Pro

    Legal

    • Términos de uso
    • Política de privacidad
    • Política de cookies
    • Política de licencias
    • Política de reembolsos
    • Términos del programa de afiliados
    • Términos de Crowdfunding

    Magzin LLC, 800 Third Avenue Associates, New York, NY, 10022, United States

    © 2026 Prompt Studio by Magzin. Todos los derechos reservados.