Agent skill
svelte
Expert knowledge for Svelte 5 development. Use when building Svelte components, using runes, or integrating with SvelteKit and Litestar.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/development/svelte
SKILL.md
Svelte 5 Framework Skill
Quick Reference
Svelte 5 Runes
<script lang="ts">
interface Props {
title: string;
items: Item[];
onSelect?: (item: Item) => void;
}
let { title, items, onSelect }: Props = $props();
let selected = $state<Item | null>(null);
let filteredItems = $derived(items.filter(i => i.active));
function handleSelect(item: Item) {
selected = item;
onSelect?.(item);
}
$effect(() => {
console.log('Selected changed:', selected);
});
</script>
<div>
<h2>{title}</h2>
<ul>
{#each filteredItems as item (item.id)}
<li onclick={() => handleSelect(item)}>
{item.name}
</li>
{/each}
</ul>
</div>
API Integration with Litestar
<script lang="ts">
import type { Item } from './generated/api';
let items = $state<Item[]>([]);
let loading = $state(true);
async function fetchItems() {
try {
const response = await fetch('/api/items');
items = await response.json();
} finally {
loading = false;
}
}
$effect(() => {
fetchItems();
});
</script>
{#if loading}
<p>Loading...</p>
{:else}
<ul>
{#each items as item}
<li>{item.name}</li>
{/each}
</ul>
{/if}
Vite + Svelte Setup
// vite.config.ts
import { defineConfig } from 'vite';
import { svelte } from '@sveltejs/vite-plugin-svelte';
import { litestarVitePlugin } from 'litestar-vite-plugin';
export default defineConfig({
plugins: [
svelte(),
litestarVitePlugin({ input: ['src/main.ts'] }),
],
});
Svelte with Inertia.js
// main.ts
import { createInertiaApp } from '@inertiajs/svelte';
import { mount } from 'svelte';
createInertiaApp({
resolve: (name) => {
const pages = import.meta.glob('./pages/**/*.svelte', { eager: true });
return pages[`./pages/${name}.svelte`];
},
setup({ el, App }) {
mount(App, { target: el });
},
});
SvelteKit Integration
// svelte.config.js
import adapter from '@sveltejs/adapter-static';
export default {
kit: {
adapter: adapter({
fallback: 'index.html',
}),
},
};
Project-Specific Patterns
- Use Svelte 5 runes (
$state,$derived,$effect,$props) - TypeScript with strict mode
- Entry point:
src/main.ts
Context7 Lookup
mcp__context7__get-library-docs(
context7CompatibleLibraryID="/sveltejs/svelte",
topic="runes state reactivity",
mode="code"
)
Related Files
examples/svelte/- Svelte SPA exampleexamples/sveltekit/- SvelteKit examplesrc/py/litestar_vite/templates/svelte/- Svelte templates
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?