Build full-stack web apps with Svelte and SvelteKit. Minimal runtime overhead, reactive components, and server-side rendering. The most admired frontend framework of 2025.
#Svelte/SvelteKitFull-StackDeveloperSkill##WhatThisSkillEnablesClaudecanbuildreactivewebapplicationsusingSvelte's compile-time approach and SvelteKit'sfull-stackframework.SveltecompilescomponentstovanillaJavaScriptatbuildtime,resultinginminimalruntimeoverheadandexceptionalperformance.SvelteKitaddsfile-basedrouting,server-siderendering,APIroutes,andadaptersforanyplatform.Fromsimplecomponentstoproductionappswithauthenticationanddatabases,ClaudehandlestheSvelteecosystemend-to-end.##Prerequisites**Required:**-ClaudeProsubscriptionorClaudeCodeCLI-Node.js18+(20+recommended)-npmorpnpmpackagemanager-BasicJavaScriptknowledge**WhatClaudehandlesautomatically:**-CreatingreactiveSveltecomponentswithstores-BuildingSvelteKitrouteswith+page.sveltefiles-Implementingserver-sidelogicin+page.server.ts-Settingupformactionswithprogressiveenhancement-Addingauthenticationwithhooksandloadfunctions-ConfiguringdatabaseconnectionsandORMs-Implementingreal-timefeatureswithSveltestores-DeployingtoVercel,Netlify,orNodeservers##HowtoUseThisSkill###ReactiveComponentDevelopment**Prompt:**"Create Svelte component for user profile with: editable bio, avatar upload with preview, reactive form validation, and optimistic UI updates. Use Svelte stores for state."Claudewill:1.Createcomponentwith$:reactivestatements2.Setupwritablestoresforformstate3.Addtwo-waybindingwithbind:value4.ImplementfileuploadwithFileReader5.Addreactivevalidationwith$:6.Showoptimisticupdates7.Handlesubmissionwithfetch###SvelteKitFull-StackApp**Prompt:**"Build SvelteKit blog with: file-based routing, Markdown posts with frontmatter, server-side API routes for CRUD, authentication with JWT, and SQLite database with Prisma."Claudewill:1.SetupSvelteKitprojectstructure2.Create+page.svelteroutes3.Add+page.server.tsloadfunctions4.ImplementAPIroutesin+server.ts5.ConfigurePrismawithSQLite6.Addauthenticationhooks7.ParseMarkdownwithgray-matter###FormHandlingwithActions**Prompt:**"Create SvelteKit form for product creation with: server-side validation, progressive enhancement (works without JS), file uploads, and optimistic UI. Show errors next to fields."Claudewill:1.Createformin+page.svelte2.Addformactionin+page.server.ts3.Implementserver-sidevalidation4.Useenhanceforprogressiveenhancement5.Addfileuploadhandling6.Displayfield-specificerrors7.Showsuccessmessages###Real-TimeDashboard**Prompt:**"Build real-time analytics dashboard with Svelte: WebSocket connection, reactive charts with Chart.js, derived stores for calculated metrics, and auto-refreshing data every 30s."Claudewill:1.SetupWebSocketinSvelteKit2.Createwritablestoresfordata3.Addderivedstoresforcalculations4.IntegrateChart.jsreactively5.Implementauto-refreshwithsetInterval6.Addconnectionstatusindicator7.Handlereconnectionlogic##TipsforBestResults1.**UseReactiveStatements**:The`$:`syntaxautomaticallyre-runswhendependencieschange.Useforderivedvalues,sideeffects,andreactivelogic.2.**EmbraceTwo-WayBinding**:`bind:value`,`bind:checked`,`bind:group`simplifyformhandling.NoneedforonChangehandlers.3.**StoresforGlobalState**:Usewritable,readable,orderivedstoresinsteadofReactContext.Accesswith`$`prefixincomponents.4.**ServerLoadFunctions**:Fetchdatain`+page.server.ts`loadfunctionsforSSR.Accesswith`data`propincomponents.5.**FormActionsOverAPIs**:SvelteKitformactionsprovideprogressiveenhancement.NoJavaScriptrequiredforbasicfunctionality.6.**Compile-TimeOptimization**:SveltecompilestooptimalJavaScript.AvoidruntimeoverheadofvirtualDOM.Componentsarejustfunctions.##CommonWorkflows###E-CommerceStore```"Build SvelteKit e-commerce with:1. Product catalog: +page.svelte with load function, search/filter2. Product detail: dynamic [slug]/+page.svelte route3. Cart: writable store with localStorage persistence4. Checkout: form actions with Stripe integration5. Auth: hooks for JWT validation, protected routes6. Admin: +layout.server.ts for role-based access7. Database: Prisma with PostgreSQL8. Images: static adapter with CDN"```###SaaSDashboard```"Create multi-tenant SvelteKit SaaS:1. Auth: +hooks.server.ts for session management2. Multi-tenant: load function filters by tenant ID3. Dashboard: reactive charts with derived stores4. Settings: form actions for account updates5. API: +server.ts routes for external integrations6. Billing: Stripe webhooks in API routes7. Real-time: Server-Sent Events for notifications8. Deploy: Node adapter with PM2"```###StaticSiteGenerator```"Build Svelte static site generator:1. Content: Markdown files with frontmatter2. Processing: +page.server.ts loads and parses MD3. Templates: layout components for post types4. Navigation: derived store from post metadata5. Search: client-side with Fuse.js6. RSS: +server.ts generates feed.xml7. Sitemap: prerender all routes8. Deploy: Static adapter to Netlify"```###Real-TimeCollaboration```"Build collaborative doc editor with Svelte:1. Editor: rich text with ProseMirror2. Sync: WebSocket for real-time updates3. Presence: writable store showing active users4. Conflict resolution: operational transforms5. Persistence: auto-save to database6. Auth: session-based with refresh tokens7. Rooms: dynamic [roomId] routes8. Cursor positions: reactive SVG overlays"```##Troubleshooting**Issue:**"Reactive statements not updating when I expect"**Solution:**Ensurereactivestatementdependsonreactivevalue($:result=calculate(value),notconst).Use=forassignmentinreactiveblock.Checkthatdependenciesareinscope.Array/objectmutationsneedreassignment:`items = [...items, newItem]`.**Issue:**"Load function data not available in component"**Solution:**Exportdatapropin+page.svelte:`export let data;`.Check+page.server.tsreturnsobjectfromload().Verifyroutehas+page.server.tsfile.Use$page.datafornestedlayouts.**Issue:**"Form action not being called"**Solution:**Addnametoformaction:`<form method="POST" action="?/create">`.Exportactionsin+page.server.ts.Useenhancefrom$app/formsforprogressiveenhancement.CheckmethodisPOST.**Issue:**"Stores not persisting across page navigation"**Solution:**Usewritablestoreinseparate.tsfile,notcomponent.Importsamestoreinstanceeverywhere.Forpersistence,synctolocalStoragewithcustomstore.CheckSvelteKitisn't destroying store on navigation.**Issue:** "Deployment build failing with adapter errors"**Solution:** Install correct adapter (@sveltejs/adapter-node, -vercel, -static). Check svelte.config.js has adapter configured. Verify build command in package.json. For static, ensure all routes are prerenderable.## Learn More- [Svelte Official Tutorial](https://svelte.dev/tutorial)- [SvelteKit Documentation](https://kit.svelte.dev/docs)- [Svelte GitHub Repository](https://github.com/sveltejs/svelte)- [SvelteKit Examples](https://github.com/sveltejs/kit/tree/master/examples)- [Svelte Society Recipes](https://sveltesociety.dev/recipes)- [Svelte REPL](https://svelte.dev/repl)
Features
Key capabilities and functionality
Compile-time optimization with zero runtime overhead
Reactive programming with $: syntax for auto-updates
Ask Claude: 'Create Svelte component for [your feature]'
Run dev server: npm run dev
Use Cases
Common scenarios and applications
Building reactive dashboards with minimal JavaScript
Full-stack apps with authentication and databases
Static sites with Markdown content processing
Troubleshooting
Common issues and solutions
Reactive statements not updating
Ensure reactive statement uses $: syntax and depends on reactive value. Array/object mutations need reassignment: items = [...items, newItem]. Check dependencies are in component scope.
Load function data not available
Export data prop in +page.svelte: export let data;. Verify +page.server.ts returns object from load(). Check route has server file. Use $page.data for nested layouts.
Form action not being called
Add action name to form: <form method="POST" action="?/create">. Export actions in +page.server.ts. Use enhance from $app/forms. Verify method is POST.
Usage Examples
Practical code examples demonstrating common use cases and implementation patterns
Reactive Counter Component
reactive-counter-component.js
javascript
<script> let count = 0;// Reactive statement - automatically re-runs when count changes $: doubled = count * 2; $: console.log(`Count is now ${count}`); function increment() {count+=1;}</script><div><buttonon:click={increment}>Count: {count}</button><p>Doubled: {doubled}</p></div><style> div {padding:1rem;} button {background:#ff3e00;color:white;border:none;padding:0.5rem1rem;cursor:pointer;}</style>
SvelteKit Page with Server Load
sveltekit-page-with-server-load.ts
typescript
// src/routes/posts/+page.server.tsimporttype{PageServerLoad}from'./$types';import{prisma}from'$lib/server/database';exportconstload:PageServerLoad=async()=>{constposts=awaitprisma.post.findMany({orderBy:{createdAt:'desc'},take:10,});return{posts};};// src/routes/posts/+page.svelte<scriptlang="ts"> import type {PageData} from './$types'; export let data: PageData;</script><h1>Recent Posts</h1><ul>{#eachdata.postsaspost}<li><ahref="/posts/{post.slug}">{post.title}</a><time>{post.createdAt.toLocaleDateString()}</time></li>{/each}</ul>
Form with Server Action
form-with-server-action.ts
typescript
// src/routes/create/+page.server.tsimporttype{Actions}from'./$types';import{fail}from'@sveltejs/kit';import{z}from'zod';constschema=z.object({title:z.string().min(3),content:z.string().min(10),});exportconstactions:Actions={create:async({request})=>{constformData=awaitrequest.formData();constdata={title:formData.get('title'),content:formData.get('content'),};constresult=schema.safeParse(data);if(!result.success){returnfail(400,{errors:result.error.flatten().fieldErrors,data,});}// Save to database// await prisma.post.create({ data: result.data });return{success:true};},};// src/routes/create/+page.svelte<scriptlang="ts"> import {enhance} from '$app/forms'; import type {ActionData} from './$types'; export let form: ActionData;</script><formmethod="POST"action="?/create"use:enhance><label> Title<inputname="title"value={form?.data?.title??''}/>{#ifform?.errors?.title}<spanclass="error">{form.errors.title[0]}</span>{/if}</label><label> Content<textareaname="content">{form?.data?.content??''}</textarea>{#ifform?.errors?.content}<spanclass="error">{form.errors.content[0]}</span>{/if}</label><buttontype="submit">Create Post</button>{#ifform?.success}<pclass="success">Post created successfully!</p>{/if}</form>
Writable Store with Persistence
writable-store-with-persistence.ts
typescript
// src/lib/stores/cart.tsimport{writable}from'svelte/store';import{browser}from'$app/environment';typeCartItem={id:string;name:string;quantity:number};functioncreateCartStore(){// Load from localStorage if in browserconststored=browser?localStorage.getItem('cart'):null;constinitial:CartItem[]=stored?JSON.parse(stored):[];const{subscribe,set,update}=writable<CartItem[]>(initial);// Persist to localStorage on changes if (browser) {subscribe((value)=>{localStorage.setItem('cart',JSON.stringify(value));});} return {subscribe,add:(item:CartItem)=>update((cart)=>{constexisting=cart.find((i)=>i.id===item.id);if(existing){existing.quantity+=item.quantity;return[...cart];} return [...cart, item];}), remove: (id: string) => update((cart) => cart.filter((i) => i.id !== id)), clear: () => set([]),};}export const cart = createCartStore();// Usage in component:// <script>// import { cart } from '$lib/stores/cart';// $: total = $cart.reduce((sum, item) => sum + item.quantity, 0);// </script>// <p>Cart: {total} items</p>
Reviews (0)
Loading reviews...
Get the latest Claude resources
Weekly roundup of the best Claude agents, tools, and guides.