Svelte5 Best Practices
Svelte 5 runes, snippets, SvelteKit patterns, and modern best practices for TypeScript and component development. Use when writing, reviewing, or refactoring Svelte 5 components and SvelteKit applications. Triggers on: Svelte components, runes ($state, $derived, $effect, $props, $bindable, $inspect), snippets ({ snippet}, {@render}), event handling, SvelteKit data loading, form actions, Svelte 4 to Svelte 5 migration, store to rune migration, slots to snippets migration, TypeScript props typing, generic components, SSR state isolation, performance optimization, or component testing.
- Скачивания
- 0
- В избранном
- 0
- Комментарии
- 0
- Просмотры
- 2
Установить скилл
Добавьте инструмент одной командой или скачайте проверенный архив версии.
npx skills add ejirocodes/agent-skills --skill svelte5-best-practices- Версия
- 1.0.0+6e805e4cc8a4
- Автор
- Владимир Ломтев
- Репозиторий
- ejirocodes/agent-skills
Как установить
- 1Скопируйте команду из блока установки.
- 2Запустите её в терминале из каталога проекта.
Документация
Svelte 5 Best Practices
Quick Reference
| Topic | When to Use | Reference |
|---|---|---|
| Runes | $state, $derived, $effect, $props, $bindable, $inspect | runes.md |
| Snippets | Replacing slots, {#snippet}, {@render} | snippets.md |
| Events | onclick handlers, callback props, context API | events.md |
| TypeScript | Props typing, generic components | typescript.md |
| Migration | Svelte 4 to 5, stores to runes | migration.md |
| SvelteKit | Load functions, form actions, SSR, page typing | sveltekit.md |
| Performance | Universal reactivity, avoiding over-reactivity, streaming | performance.md |
Essential Patterns
Reactive State
<script>
let count = $state(0); // Reactive state
let doubled = $derived(count * 2); // Computed value
</script>
Component Props
<script>
let { name, count = 0 } = $props();
let { value = $bindable() } = $props(); // Two-way binding
</script>
Snippets (replacing slots)
<script>
let { children, header } = $props();
</script>
{@render header?.()}
{@render children()}
Event Handlers
<!-- Svelte 5: use onclick, not on:click -->
<button onclick={() => count++}>Click</button>
Callback Props (replacing createEventDispatcher)
<script>
let { onclick } = $props();
</script>
<button onclick={() => onclick?.({ data })}>Click</button>
Common Mistakes
- Using
letwithout$state- Variables are not reactive without$state() - Using
$effectfor derived values - Use$derivedinstead - Using
on:clicksyntax - Useonclickin Svelte 5 - Using
createEventDispatcher- Use callback props instead - Using
<slot>- Use snippets with{@render} - Forgetting
$bindable()- Required forbind:to work - Setting module-level state in SSR - Causes cross-request leaks
- Sequential awaits in load functions - Use
Promise.allfor parallel requests
Требования и возможности
Источник пакета
https://github.com/ejirocodes/agent-skills/tree/6e805e4cc8a4378444c791d4a08e304347152bd0/svelte/skills/svelte5-best-practices
Файлы версии
| Путь | Размер | SHA256 |
|---|---|---|
| SKILL.md | 2914 | eeb2be3e32085d47... |
| references/events.md | 7137 | c311631df6f8707d... |
| references/migration.md | 6795 | c2c574ce8290ef56... |
| references/performance.md | 9954 | ee1ddf521fd3d827... |
| references/runes.md | 7117 | 9c7b6330607aa14d... |
Частые вопросы
- Как установить Svelte5 Best Practices?
- Используйте команду
npx skills add ejirocodes/agent-skills --skill svelte5-best-practicesили скачайте ZIP-архив. - Можно ли скачать Svelte5 Best Practices бесплатно?
- Да, опубликованную версию можно скачать из маркетплейса бесплатно.
Похожие инструменты
Смотреть всеReact DoctorUse when finishing a feature, fixing a bug, before committing React code, or when the user types `/doctor`, asks to scan, triage, or clean up React diagnostics. Covers lint, accessibility, bundle size, architecture. Includes a regression check and a full local-triage workflow that fetches the canonical playbook.Argent Android Emulator SetupSet up and connect to an Android emulator using argent MCP tools. Use when starting a new session on Android, booting an emulator, getting a device serial, or before any UI interaction task.Fireworks Tech GraphCreate technical diagrams such as software architecture, data flow, flowcharts, sequence diagrams, C4 reviews, cloud deployments, event streams, observability investigations, agent/memory systems, UML, ER, network topology, timelines, and technical concept maps, then export SVG, PNG, focused semantic SVG-to-GIF motion, or offline interactive HTML. Treat direct requests such as "Generate a GIF", "生成 GIF", or "制作 GIF" as motion requests, and use this skill when the user asks to visualize a system or engineering concept. Do not use for photos, raster artwork, or quantitative data charts.
Комментарии
Войдите, чтобы оставить комментарий.
Комментариев пока нет.