Full-stack-skills svelte
Guides Svelte and SvelteKit development including reactive components, stores, transitions, lifecycle hooks, SSR, file-based routing, and deployment. Use when the user needs to build Svelte components, create SvelteKit applications, implement reactivity patterns, or configure Svelte with Vite.
install
source · Clone the upstream repo
git clone https://github.com/partme-ai/full-stack-skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/partme-ai/full-stack-skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/svelte-skills/svelte" ~/.claude/skills/partme-ai-full-stack-skills-svelte && rm -rf "$T"
manifest:
skills/svelte-skills/svelte/SKILL.mdsource content
When to use this skill
Use this skill whenever the user wants to:
- Build Svelte components with reactive declarations and bindings
- Create a SvelteKit application with file-based routing and SSR
- Implement Svelte stores for shared state management
- Add transitions, animations, or lifecycle hooks (onMount, onDestroy)
- Configure Svelte with Vite or deploy a SvelteKit app
How to use this skill
Workflow
- Set up the project -
for SvelteKit or Vite+Sveltenpm create svelte@latest my-app - Create components - Write
files with script, markup, and style blocks.svelte - Add reactivity - Use
reactive declarations and Svelte stores$: - Build and deploy -
with adapter-auto, adapter-node, or adapter-staticnpm run build
Quick-Start Example: Reactive Counter Component
<script> let count = 0; $: doubled = count * 2; $: if (count > 10) console.log('Count is high!'); function increment() { count += 1; } </script> <button on:click={increment}> Clicked {count} {count === 1 ? 'time' : 'times'} </button> <p>Doubled: {doubled}</p> <style> button { padding: 0.5rem 1rem; border-radius: 4px; background: #ff3e00; color: white; border: none; cursor: pointer; } </style>
Store Example: Shared State
// stores.js import { writable, derived } from 'svelte/store'; export const todos = writable([]); export const completedCount = derived(todos, $todos => $todos.filter(t => t.done).length );
<script> import { todos, completedCount } from './stores.js'; let newTodo = ''; function addTodo() { todos.update(t => [...t, { text: newTodo, done: false }]); newTodo = ''; } </script> <input bind:value={newTodo} /> <button on:click={addTodo}>Add</button> <p>Completed: {$completedCount}</p>
Best Practices
- Keep reactive dependencies explicit - Avoid side effects in
blocks; use them for derived values$: - Split into small components - Each
file should handle one concern.svelte - Use stores for shared state - Avoid prop drilling; writable/derived stores are lightweight
- Add TypeScript - Use
for type safety in components<script lang="ts"> - Leverage SvelteKit features - Use
for server-side data loading, form actions for mutations+page.server.ts
Resources
- Official Docs: https://svelte.dev/docs
- SvelteKit Docs: https://kit.svelte.dev/docs
Keywords
svelte, SvelteKit, reactive, component, store, transition, SSR, Vite, 响应式, 编译时, file-based routing