{"id":"584bedc0-55be-4f6f-9479-777a81b51e54","shortId":"7MgYfh","kind":"skill","title":"svelte","tagline":"Use when editing Svelte components, .svelte files, svelte.config.js, Svelte 5 runes, $state, $derived, SvelteKit, component state, or migrating away from Svelte 4 patterns.","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-05-18T19:07:39.797Z","embedding":null,"createdAt":"2026-04-23T13:04:02.027Z","updatedAt":"2026-05-18T19:07:39.797Z","lastSeenAt":"2026-05-18T19:07:39.797Z","tsv":"'/api/items':111 '/cofin/flow/blob/main/templates/styleguides/frameworks/svelte.md)':276 '/cofin/flow/blob/main/templates/styleguides/general.md)':272 '/cofin/flow/blob/main/templates/styleguides/languages/typescript.md)':280 '/docs/cli/overview':248 '/docs/kit/form-actions':245 '/docs/kit/load':242 '/docs/svelte/v5-migration-guide':239 '/docs/svelte/what-are-runes':236 '/each':47 '/if':88,151 '/sveltejs/svelte/releases':251 '0':58 '2':62 '4':23,156,158,317 '404':117 '5':11,26,32,77,160,188,299,329 'action':97,126,127,144 'alway':296 'async':104,129 'avoid':314,339 'await':109,122,134,136 'away':20 'backend':225 'baselin':254 'best':182 'bind':177,180 'bindabl':72 'case':291 'children':82,173 'class':54,205 'click':175 'compon':6,16,351 'composit':338 'comput':199,312 'const':68,101,107,125,132 'content':337 'count':36,56,87 'counter':55,69,71 'data':133,139 'decrement':65 'deprec':343 'deriv':14,60,167,168,197,310 'detail':294 'differ':153 'dom':211 'doubl':59 'duplic':264 'edg':290 'edit':4 'effect':170,171 'effect.pre':209 'error':116 'explicit':334 'export':67,100,124,161 'expr':169 'extract':201 'fetch':106,110 'file':8 'flexibl':336 'focus':284 'footer':84,86 'form':143,148 'found':119 'framework':27 'function':91 'general':268 'generic':259 'github.com':250,271,275,279 'github.com/cofin/flow/blob/main/templates/styleguides/frameworks/svelte.md)':274 'github.com/cofin/flow/blob/main/templates/styleguides/general.md)':270 'github.com/cofin/flow/blob/main/templates/styleguides/languages/typescript.md)':278 'github.com/sveltejs/svelte/releases':249 'guardrail':295 'handleselect':44 'header':80 'import':94 'increment':63 'index':219 'instead':215,325 'integr':223,226,293 'introduc':330 'item':38,40,45,121 'item.id':41 'item.name':46 'keep':281 'key':152 'language/framework':260 'legaci':315 'let':162,164 'li':42 'litestar':221,229 'litestar-vit':220,228 'load':90,102 'local':194,321 'logic':313,352 'manag':49,303 'measur':212 'migrat':19 'new':70,346 'offici':232 'onclick':43,176 'page.server.ts':93 'pageserverload':96,103 'param':105,131 'params.id':112,138 'pattern':24,319 'plugin':231 'practic':183 'prefer':189,348 'principl':269 'prop':73,163,165,166 'quick':29 'reactiv':307 'reduc':263 'refer':30,218,233 'references/litestar_vite.md':224 'render':79,81,85,172 'request':130 'request.formdata':135 'res':108 'res.json':123 'res.ok':114 'return':120,140 'reusabl':202 'rule':261 'rune':12,33,51,207,300 'save':146,150 'share':252,256 'skill':28,267,283 'skill-svelte' 'slot':217,327 'snippet':75,214,324,331 'source-cofin' 'specif':288 'state':13,17,48,57,190,195,203,302,305,322 'still':179 'store':192,318 'stores/counter.svelte.ts':53 'styleguid':253,257 'success':141,149 'svelt':1,5,7,10,22,25,31,34,74,76,78,145,155,157,159,187,273,298,316,328 'svelte.config.js':9 'svelte.dev':235,238,241,244,247 'svelte.dev/docs/cli/overview':246 'svelte.dev/docs/kit/form-actions':243 'svelte.dev/docs/kit/load':240 'svelte.dev/docs/svelte/v5-migration-guide':237 'svelte.dev/docs/svelte/what-are-runes':234 'sveltekit':15,89 'this.count':61,64,66 'throw':115 'titl':35 'tool':287 'tool-specif':286 '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':142 'ts':52,92 'type':95,99 'typescript':185,277,349 'updat':128 'updateitem':137 'use':2,184,196,208,213,255,297,304,323,353 'valu':200 'variabl':308 'version':347 'vite':222,230 'workflow':289","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-05-18T19:07:39.797Z"}],"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-27T19:07:26Z","description":"Context-Driven Development toolkit for AI agents — spec-first planning, TDD workflow, and Beads integration.","skill_md_sha":"5e518a8c817dce6d7e0fdab00982c3a4a2bd728b","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":"Use when editing Svelte components, .svelte files, svelte.config.js, Svelte 5 runes, $state, $derived, SvelteKit, component state, or migrating away from Svelte 4 patterns."},"skills_sh_url":"https://skills.sh/cofin/flow/svelte"},"updatedAt":"2026-05-18T19:07:39.797Z"}}