From svelte-skills
Explains Svelte template directives (@attach, @html, @render, @const, @debug) for DOM manipulation, third-party libs, tooltips, canvas, dynamic HTML. @attach replaces use: actions with reactive re-runs.
npx claudepluginhub spences10/svelte-skills-kit --plugin svelte-skillsThis skill uses the workspace's default tool permissions.
**The reactive alternative to `use:` actions.** Re-runs when dependencies
Guides Svelte 5 best practices for reactivity using $state, $derived, $effect, $props; covers event handling, styling, library integration. For writing/editing Svelte components.
Provides Svelte 5.0 knowledge patch on runes ($state, $derived, $effect, $props), snippets replacing slots, callback props for events, mount/hydrate API. Auto-loads for Svelte tasks.
Guides Svelte 5 runes for reactive state ($state), derived values ($derived), effects ($effect), props ($props/$bindable), migration from Svelte 4, and common mistake prevention.
Share bugs, ideas, or general feedback.
The reactive alternative to use: actions. Re-runs when dependencies
change, passes through components via spread, supports cleanup functions.
<script>
import ImageZoom from 'js-image-zoom';
function useZoom(options) {
return (element) => {
new ImageZoom(element, options);
return () => console.log('cleanup');
};
}
</script>
<!-- Re-runs if options changes (use: wouldn't!) -->
<figure {@attach useZoom({ width: 400 })}>
<img src="photo.jpg" alt="zoomable" />
</figure>
| Directive | Purpose | Reactive? |
|---|---|---|
{@attach} | DOM manipulation, 3rd-party | Yes |
{@html} | Render raw HTML strings | Yes |
{@render} | Render snippets | Yes |
{@const} | Local constants in blocks | N/A |
{@debug} | Pause debugger on value change | N/A |
{#each (key)} | Keyed iteration (always key!) | Yes |
<svelte:window> | Window event listeners | N/A |
| Feature | use: | @attach |
|---|---|---|
| Re-runs on arg change | No | Yes |
| Composable | Limited | Fully |
| Pass through props | Manual | Auto via spread |
| Convert legacy | N/A | fromAction() |
@attach requires Svelte 5.29+fromAction from svelte/attachments to convert legacy actions<svelte:window>/<svelte:document> for global events, not $effect