Agent skill
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 this agent skill to your Project
npx add-skill https://github.com/partme-ai/full-stack-skills/tree/main/skills/svelte-skills/svelte
SKILL.md
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 -
npm create svelte@latest my-appfor SvelteKit or Vite+Svelte - Create components - Write
.sveltefiles with script, markup, and style blocks - Add reactivity - Use
$:reactive declarations and Svelte stores - Build and deploy -
npm run buildwith adapter-auto, adapter-node, or adapter-static
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
.sveltefile should handle one concern - Use stores for shared state - Avoid prop drilling; writable/derived stores are lightweight
- Add TypeScript - Use
<script lang="ts">for type safety in components - Leverage SvelteKit features - Use
+page.server.tsfor server-side data loading, form actions for mutations
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
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
ocrmypdf-batch
OCRmyPDF batch processing skill — process multiple PDFs, Docker automation, shell scripting, and CI/CD integration. Use when the user needs to OCR many PDFs, set up automated OCR pipelines, or integrate OCR into workflows.
ocrmypdf-optimize
OCRmyPDF optimization skill — compress PDFs, configure PDF/A output, JBIG2 encoding, and lossless optimization. Use when the user needs to reduce PDF file size, create archival PDF/A files, or optimize OCR output.
ocrmypdf-image
OCRmyPDF image processing skill — deskew, rotate, clean, despeckle, remove border from scanned documents. Use when the user needs to improve scanned PDF quality, fix skewed pages, remove noise, or clean up scanned documents before OCR.
ocrmypdf-api
OCRmyPDF Python API and plugin skill — use OCRmyPDF programmatically from Python, integrate with applications, and extend with plugins (EasyOCR, PaddleOCR, AppleOCR). Use when the user needs to call OCRmyPDF from Python code, build OCR pipelines, or use alternative OCR engines.
ocrmypdf
OCRmyPDF core skill — add searchable OCR text layer to scanned PDFs, convert images to searchable PDFs, support 100+ languages via Tesseract. Use when the user needs to OCR a PDF, make a scanned PDF searchable, or extract text from scanned documents.
tui-empty
Generate and render a pixel-precise ASCII TUI Empty State component with complete output blocks (TUI_RENDER, COMPONENT_SPEC, PENCIL_SPEC, PENCIL_BATCH_DESIGN) for Pencil MCP drawing workflows. Use when the user asks to create an empty state in a terminal UI, text-based interface, or Pencil MCP project.
Didn't find tool you were looking for?