Svelte Component
Create new Svelte components with best practices, TypeScript support, and testing
$ npx claude-code-templates@latest --command="svelte/svelte-component" --yesRequires 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
Create Svelte Component
Create new Svelte component: $ARGUMENTS
Current Svelte Project
- Svelte config: @svelte.config.js or @vite.config.js (if exists)
- Components directory: @src/components/ or @src/lib/ (if exists)
- TypeScript config: @tsconfig.json (detect TypeScript usage)
- Testing setup: @vitest.config.js or @jest.config.js (if exists)
Task
Create Svelte component with best practices. When creating components:
- Gather Requirements:
- Props interface
- Events to emit
- Slots needed
- State management requirements
- TypeScript preference
- Component Structure:
<!-- Markup -->
- Best Practices:
- Implement $bindable props where appropriate
- Create accessible markup by default
- Add proper ARIA attributes
- Use semantic HTML elements
- Include keyboard navigation support
- Component Types to Create:
- Form Components: Inputs with validation, custom form controls
- Layout Components: Headers, Sidebars, Grids
- Data Components: Tables, Lists, Data visualizations
- Utility Components: Portals, Transitions, Error boundaries
- Additional Files:
- Add Storybook story if applicable
- Create usage documentation
- Export from index file
Example Usage
User: "Create a Modal component with customizable header, footer slots, and close functionality"
Assistant will:
- Create Modal.svelte with proper structure
- Implement focus trap and keyboard handling
- Add transition effects
- Create Modal.test.js with basic tests
- Provide usage examples
- Suggest accessibility improvements
Related Claude Code Commands
Svelte Debug
A ready-to-install Claude Code component.
Svelte Test Coverage
A ready-to-install Claude Code component.
Svelte Optimize
A ready-to-install Claude Code component.
Svelte Test Setup
A ready-to-install Claude Code component.
Svelte Test
A ready-to-install Claude Code component.
Svelte A11y
A ready-to-install Claude Code component.
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.