{"id":"584bedc0-55be-4f6f-9479-777a81b51e54","shortId":"7MgYfh","kind":"skill","title":"svelte","tagline":"Auto-activate for .svelte files, svelte.config.js. Expert knowledge for Svelte 5 development with Runes. Use when: building Svelte components (`.svelte` files), using runic states ($state, $derived), or working with SvelteKit. Not for React (see react), Vue (see vue), or Svelte 4","description":"# Svelte 5 Framework Skill\n\n<workflow>\n\n## Quick Reference\n\n### Svelte 5 Runes\n\n<example>\n\n```svelte\n<script lang=\"ts\">\n  interface Props {\n    title: string;\n    items: Item[];\n    onselect?: (item: Item) => void;\n  }\n\n  let { title, items, onselect }: Props = $props();\n\n  let selected = $state<Item | null>(null);\n  let count = $derived(items.length);\n\n  function handleSelect(item: Item) {\n    selected = item;\n    onselect?.(item);\n  }\n\n  $effect(() => {\n    console.log('Selected changed:', selected);\n  });\n</script>\n\n<div>\n  <h2>{title} ({count})</h2>\n  <ul>\n    {#each items as item (item.id)}\n      <li onclick={() => handleSelect(item)}>\n        {item.name}\n      </li>\n    {/each}\n  </ul>\n</div>\n```\n\n</example>\n\n### State Management with Runes\n\n<example>\n\n```ts\n// stores/counter.svelte.ts\nclass Counter {\n  count = $state(0);\n  doubled = $derived(this.count * 2);\n\n  increment() {\n    this.count++;\n  }\n\n  decrement() {\n    this.count--;\n  }\n}\n\nexport const counter = new Counter();\n```\n\n</example>\n\n### Bindable Props\n\n<example>\n\n```svelte\n<script lang=\"ts\">\n  let { value = $bindable('') }: { value: string } = $props();\n</script>\n\n<input bind:value />\n```\n\n</example>\n\n### Snippets (Svelte 5)\n\n<example>\n\n```svelte\n<script lang=\"ts\">\n  import type { Snippet } from 'svelte';\n\n  interface Props {\n    header: Snippet;\n    children: Snippet;\n    footer?: Snippet<[{ count: number }]>;\n  }\n\n  let { header, children, footer }: Props = $props();\n  let count = $state(0);\n</script>\n\n<div class=\"card\">\n  <header>{@render header()}</header>\n  <main>{@render children()}</main>\n  {#if footer}\n    <footer>{@render footer({ count })}</footer>\n  {/if}\n</div>\n```\n\n</example>\n\n### SvelteKit Load Functions\n\n<example>\n\n```ts\n// +page.server.ts\nimport type { PageServerLoad, Actions } from './$types';\n\nexport const load: PageServerLoad = async ({ params, fetch }) => {\n  const res = await fetch(`/api/items/${params.id}`);\n  if (!res.ok) throw error(404, 'Not found');\n\n  return {\n    item: await res.json()\n  };\n};\n\nexport const actions: Actions = {\n  update: async ({ request, params }) => {\n    const data = await request.formData();\n    await updateItem(params.id, data);\n    return { success: true };\n  }\n};\n```\n\n</example>\n\n### Form Actions\n\n<example>\n\n```svelte\n<script lang=\"ts\">\n  import { enhance } from '$app/forms';\n  import type { ActionData } from './$types';\n\n  let { form }: { form: ActionData } = $props();\n</script>\n\n<form method=\"POST\" action=\"?/update\" use:enhance>\n  <input name=\"title\" required />\n  <button type=\"submit\">Save</button>\n  {#if form?.success}\n    <p>Saved!</p>\n  {/if}\n</form>\n```\n\n</example>\n\n## Key Differences from Svelte 4\n\n| Svelte 4 | Svelte 5 |\n|----------|----------|\n| `export let prop` | `let { prop } = $props()` |\n| `$: derived` | `$derived(expr)` |\n| `$: { effect }` | `$effect(() => { })` |\n| `<slot>` | `{@render children()}` |\n| `on:click` | `onclick` |\n| `bind:this` | Still `bind:this` |\n\n</workflow>\n\n## Best Practices\n\n- Use TypeScript with Svelte 5\n- Prefer `$state` over stores for local state\n- Use `$derived` for computed values\n- Extract reusable state into classes with runes\n- Use `$effect.pre` for DOM measurements\n- Use snippets instead of slots\n\n## References Index\n\n- **[Litestar-Vite Integration](references/litestar_vite.md)** — Backend integration with Litestar-Vite plugin.\n\n## Official References\n\n- <https://svelte.dev/docs/svelte/what-are-runes>\n- <https://svelte.dev/docs/svelte/v5-migration-guide>\n- <https://svelte.dev/docs/kit/load>\n- <https://svelte.dev/docs/kit/form-actions>\n- <https://svelte.dev/docs/cli/overview>\n- <https://github.com/sveltejs/svelte/releases>\n\n## Shared Styleguide Baseline\n\n- Use shared styleguides for generic language/framework rules to reduce duplication in this skill.\n- [General Principles](https://github.com/cofin/flow/blob/main/templates/styleguides/general.md)\n- [Svelte](https://github.com/cofin/flow/blob/main/templates/styleguides/frameworks/svelte.md)\n- [TypeScript](https://github.com/cofin/flow/blob/main/templates/styleguides/languages/typescript.md)\n- Keep this skill focused on tool-specific workflows, edge cases, and integration details.\n\n<guardrails>\n## Guardrails\n\n- **Always use Svelte 5 Runes for state management** -- Use `$state` for reactive variables and `$derived` for computed logic. Avoid legacy Svelte 4 store patterns for local state.\n- **Use Snippets instead of Slots** -- Svelte 5 introduces snippets for more explicit and flexible content composition. Avoid `<slot>` as it is deprecated in the new version.\n- **Prefer TypeScript for component logic** -- Use `<script lang=\"ts\">` to ensure type safety for props and event handlers.\n- **Avoid `$effect` for simple state updates** -- Use `$derived` whenever possible to keep reactivity declarative. `$effect` should only be used for side effects (e.g., DOM interactions).\n- **Use `$bindable()` only when necessary** -- Two-way binding should be used sparingly; prefer one-way data flow via props and callbacks where possible.\n</guardrails>\n\n<validation>\n## Validation Checkpoint\n\n- [ ] Component uses Svelte 5 Runes (`$state`, `$derived`, `$props`)\n- [ ] No legacy `<slot>` tags are used; snippets rendering is verified\n- [ ] TypeScript types are defined for all props\n- [ ] `$effect` is not misused for logic that can be handled by `$derived`\n- [ ] Component uses modern event handlers (e.g., `onclick` instead of `on:click`)\n- [ ] Any two-way bindings use the `$bindable()` rune\n</validation>","tags":["svelte","flow","cofin","agent-skills","ai-agents","beads","claude-code","codex","cursor","developer-tools","gemini-cli","opencode"],"capabilities":["skill","source-cofin","skill-svelte","topic-agent-skills","topic-ai-agents","topic-beads","topic-claude-code","topic-codex","topic-cursor","topic-developer-tools","topic-gemini-cli","topic-opencode","topic-plugin","topic-slash-commands","topic-spec-driven-development"],"categories":["flow"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/cofin/flow/svelte","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add cofin/flow","source_repo":"https://github.com/cofin/flow","install_from":"skills.sh"}},"qualityScore":"0.455","qualityRationale":"deterministic score 0.46 from registry signals: · indexed on github topic:agent-skills · 11 github stars · SKILL.md body (5,487 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-04-24T07:03:20.365Z","embedding":null,"createdAt":"2026-04-23T13:04:02.027Z","updatedAt":"2026-04-24T07:03:20.365Z","lastSeenAt":"2026-04-24T07:03:20.365Z","tsv":"'/api/items':130 '/cofin/flow/blob/main/templates/styleguides/frameworks/svelte.md)':295 '/cofin/flow/blob/main/templates/styleguides/general.md)':291 '/cofin/flow/blob/main/templates/styleguides/languages/typescript.md)':299 '/docs/cli/overview':267 '/docs/kit/form-actions':264 '/docs/kit/load':261 '/docs/svelte/v5-migration-guide':258 '/docs/svelte/what-are-runes':255 '/each':66 '/if':107,170 '/sveltejs/svelte/releases':270 '0':77 '2':81 '4':43,175,177,336 '404':136 '5':13,45,51,96,179,207,318,348 'action':116,145,146,163 'activ':4 'alway':315 'async':123,148 'auto':3 'auto-activ':2 'avoid':333,358 'await':128,141,153,155 'backend':244 'baselin':273 'best':201 'bind':196,199 'bindabl':91 'build':19 'case':310 'children':101,192 'class':73,224 'click':194 'compon':21,370 'composit':357 'comput':218,331 'const':87,120,126,144,151 'content':356 'count':55,75,106 'counter':74,88,90 'data':152,158 'decrement':84 'deprec':362 'deriv':28,79,186,187,216,329 'detail':313 'develop':14 'differ':172 'dom':230 'doubl':78 'duplic':283 'edg':309 'effect':189,190 'effect.pre':228 'error':135 'expert':9 'explicit':353 'export':86,119,143,180 'expr':188 'extract':220 'fetch':125,129 'file':7,23 'flexibl':355 'focus':303 'footer':103,105 'form':162,167 'found':138 'framework':46 'function':110 'general':287 'generic':278 'github.com':269,290,294,298 'github.com/cofin/flow/blob/main/templates/styleguides/frameworks/svelte.md)':293 'github.com/cofin/flow/blob/main/templates/styleguides/general.md)':289 'github.com/cofin/flow/blob/main/templates/styleguides/languages/typescript.md)':297 'github.com/sveltejs/svelte/releases':268 'guardrail':314 'handleselect':63 'header':99 'import':113 'increment':82 'index':238 'instead':234,344 'integr':242,245,312 'introduc':349 'item':57,59,64,140 'item.id':60 'item.name':65 'keep':300 'key':171 'knowledg':10 'language/framework':279 'legaci':334 'let':181,183 'li':61 'litestar':240,248 'litestar-vit':239,247 'load':109,121 'local':213,340 'logic':332,371 'manag':68,322 'measur':231 'new':89,365 'offici':251 'onclick':62,195 'page.server.ts':112 'pageserverload':115,122 'param':124,150 'params.id':131,157 'pattern':338 'plugin':250 'practic':202 'prefer':208,367 'principl':288 'prop':92,182,184,185 'quick':48 'react':35,37 'reactiv':326 'reduc':282 'refer':49,237,252 'references/litestar_vite.md':243 'render':98,100,104,191 'request':149 'request.formdata':154 'res':127 'res.json':142 'res.ok':133 'return':139,159 'reusabl':221 'rule':280 'rune':16,52,70,226,319 'runic':25 'save':165,169 'see':36,39 'share':271,275 'skill':47,286,302 'skill-svelte' 'slot':236,346 'snippet':94,233,343,350 'source-cofin' 'specif':307 'state':26,27,67,76,209,214,222,321,324,341 'still':198 'store':211,337 'stores/counter.svelte.ts':72 'styleguid':272,276 'success':160,168 'svelt':1,6,12,20,22,42,44,50,53,93,95,97,164,174,176,178,206,292,317,335,347 'svelte.config.js':8 'svelte.dev':254,257,260,263,266 'svelte.dev/docs/cli/overview':265 'svelte.dev/docs/kit/form-actions':262 'svelte.dev/docs/kit/load':259 'svelte.dev/docs/svelte/v5-migration-guide':256 'svelte.dev/docs/svelte/what-are-runes':253 'sveltekit':32,108 'this.count':80,83,85 'throw':134 'titl':54 'tool':306 'tool-specif':305 'topic-agent-skills' 'topic-ai-agents' 'topic-beads' 'topic-claude-code' 'topic-codex' 'topic-cursor' 'topic-developer-tools' 'topic-gemini-cli' 'topic-opencode' 'topic-plugin' 'topic-slash-commands' 'topic-spec-driven-development' 'true':161 'ts':71,111 'type':114,118 'typescript':204,296,368 'updat':147 'updateitem':156 'use':17,24,203,215,227,232,274,316,323,342,372 'valu':219 'variabl':327 'version':366 'vite':241,249 'vue':38,40 'work':30 'workflow':308","prices":[{"id":"c1442ee9-0fab-4efa-b13d-360c20580c21","listingId":"584bedc0-55be-4f6f-9479-777a81b51e54","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"cofin","category":"flow","install_from":"skills.sh"},"createdAt":"2026-04-23T13:04:02.027Z"}],"sources":[{"listingId":"584bedc0-55be-4f6f-9479-777a81b51e54","source":"github","sourceId":"cofin/flow/svelte","sourceUrl":"https://github.com/cofin/flow/tree/main/skills/svelte","isPrimary":false,"firstSeenAt":"2026-04-23T13:04:02.027Z","lastSeenAt":"2026-04-24T07:03:20.365Z"}],"details":{"listingId":"584bedc0-55be-4f6f-9479-777a81b51e54","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"cofin","slug":"svelte","github":{"repo":"cofin/flow","stars":11,"topics":["agent-skills","ai-agents","beads","claude-code","codex","context-driven-development","cursor","developer-tools","gemini-cli","opencode","plugin","slash-commands","spec-driven-development","subagents","tdd","workflow"],"license":"apache-2.0","html_url":"https://github.com/cofin/flow","pushed_at":"2026-04-19T23:22:27Z","description":"Context-Driven Development toolkit for AI agents — spec-first planning, TDD workflow, and Beads integration.","skill_md_sha":"6448eca75e202dc5b77ea3753d2ca9ebad3a9aa2","skill_md_path":"skills/svelte/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/cofin/flow/tree/main/skills/svelte"},"layout":"multi","source":"github","category":"flow","frontmatter":{"name":"svelte","description":"Auto-activate for .svelte files, svelte.config.js. Expert knowledge for Svelte 5 development with Runes. Use when: building Svelte components (`.svelte` files), using runic states ($state, $derived), or working with SvelteKit. Not for React (see react), Vue (see vue), or Svelte 4 (this covers Svelte 5 with Runes)."},"skills_sh_url":"https://skills.sh/cofin/flow/svelte"},"updatedAt":"2026-04-24T07:03:20.365Z"}}