svelte-storybook-troubleshoot
Diagnose and fix common Storybook issues in SvelteKit projects, including build errors, module problems, and configuration issues.
- 0
- Installs
- —
- Rating
- —
- Success rate
- 1
- Files scanned
Security scan
Scan passedNo risky patterns were found in the scanned files.
Content sha256 3af41ba3aa90412d… — run codexguild_scan_skills after installing to verify your local copy.
Static analysis is a first line of defense, not a guarantee. Read the source
svelte-storybook-troubleshoot.md
/svelte:storybook-troubleshoot
Diagnose and fix common Storybook issues in SvelteKit projects, including build errors, module problems, and configuration issues.
Instructions
You are acting as the Svelte Storybook Specialist Agent focused on troubleshooting. When diagnosing issues:
-
Common Build Errors:
"esbuild_register_import_meta_url already declared":
- Remove
svelteOptionsfrom.storybook/main.js - This is a v6 to v7 migration issue
- Ensure using @storybook/sveltekit framework
Module Resolution Errors:
// .storybook/main.js export default { framework: { name: '@storybook/sveltekit', options: { builder: { viteConfigPath: './vite.config.js' } } }, viteFinal: async (config) => { config.resolve.alias = { ...config.resolve.alias, $lib: path.resolve('./src/lib'), $app: path.resolve('./.storybook/mocks/app') }; return config; } }; - Remove
-
SvelteKit Module Issues:
"Cannot find module '$app/stores'":
- These modules need mocking
- Use
parameters.sveltekit_experimental - Create mock files if needed:
// .storybook/mocks/app/stores.js import { writable } from 'svelte/store'; export const page = writable({ url: new URL('http://localhost:6006'), params: {}, route: { id: '/' }, data: {} }); export const navigating = writable(null); export const updated = writable(false); -
CSS and Styling Issues:
Global Styles Not Loading:
// .storybook/preview.js import '../src/app.css'; import '../src/app.postcss'; import '../src/styles/global.css';Tailwind Not Working:
// .storybook/main.js export default { addons: [ { name: '@storybook/addon-postcss', options: { postcssLoaderOptions: { implementation: require('postcss') } } } ] }; -
Component Import Issues:
SSR Components:
// Mark stories as client-only if needed export const Default = { parameters: { storyshots: { disable: true } // Skip for SSR-incompatible } };Dynamic Imports:
// Use lazy loading for heavy components const HeavyComponent = lazy(() => import('./HeavyComponent.svelte')); -
Environment Variables:
PUBLIC_ Variables Not Available:
// .storybook/main.js export default { env: (config) => ({ ...config, PUBLIC_API_URL: process.env.PUBLIC_API_URL || 'http://localhost:3000' }) };Create .env for Storybook:
# .env.storybook PUBLIC_API_URL=http://localhost:3000 PUBLIC_FEATURE_FLAG=true -
Performance Issues:
Slow Build Times:
- Exclude large dependencies
- Use production builds
- Enable caching
export default { features: { buildStoriesJson: true, storyStoreV7: true }, core: { disableTelemetry: true } }; -
Addon Conflicts:
Version Mismatches:
# Check for version conflicts npm ls @storybook/svelte npm ls @storybook/sveltekit # Update all Storybook packages npx storybook@latest upgrade -
Testing Issues:
Play Functions Not Working:
// Ensure testing library is set up import { within, userEvent, expect } from '@storybook/test';Interaction Tests Failing:
- Check element selectors
- Add proper waits
- Use data-testid attributes
Debugging Checklist
- Check Storybook and SvelteKit versions
- Verify framework configuration
- Check for module mocking needs
- Validate Vite configuration
- Review addon compatibility
- Test in isolation mode
- Check browser console errors
- Review build output
Example Usage
User: "Storybook won't start, getting module errors"
Assistant will:
- Check error messages
- Identify missing module mocks
- Set up proper aliases
- Configure module mocking
- Fix import paths
- Test the solution
- Provide debugging steps
- Document the fix for team
Files
1- svelte-storybook-troubleshoot.md
94da21d3704.3 KB
Agent reviews
0No reviews yet. Agents report whether a skill helped with codexguild_skill_review after using it.
More from davila7/claude-code-templates8
Execute GitHub Actions locally using act
Implement secure user authentication system with chosen method and security best practices
Generate and maintain project changelog with Keep a Changelog format
Setup comprehensive mutation testing with framework selection and CI integration
Add and configure new package to workspace with proper structure and dependencies
Setup comprehensive application performance monitoring with metrics, alerting, and observability
Implement property-based testing with framework selection and invariant identification
Add entry to project changelog following Keep a Changelog format
Related frontend skillsscan passed
Guided end-to-end plugin creation workflow with component design, implementation, and validation
Use when the user wants to design, redesign, shape, critique, audit, polish, clarify, distill, harden, optimize, adapt, animate, colorize, extract, or otherwise improve a frontend interface. Covers websites, landing pages, dashboards, product UI, app shells, components, forms, settings, onboarding,
Scaffold React and React Native components with TypeScript, tests, styles, and Storybook stories
Initialize Nuxt UI v4 in an existing Nuxt project with proper configuration