Back to list
spences10

svelte-template-directives

by spences10

🦀 Claude Code Skills for Svelte and SvelteKit

12🍴 0📅 Jan 21, 2026

SKILL.md


name: svelte-template-directives

prettier-ignore

description: Svelte template directives ({@attach}, {@html}, {@render}, {@const}, {@debug}). Use for DOM manipulation, third-party libs, tooltips, canvas, dynamic HTML. @attach replaces use: actions.

Svelte Template Directives

@attach (Svelte 5.29+)

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>

Quick Reference

DirectivePurposeReactive?
{@attach}DOM manipulation, 3rd-partyYes
{@html}Render raw HTML stringsYes
{@render}Render snippetsYes
{@const}Local constants in blocksN/A
{@debug}Pause debugger on value changeN/A

@attach vs use: Actions

Featureuse:@attach
Re-runs on arg changeNoYes
ComposableLimitedFully
Pass through propsManualAuto via spread
Convert legacyN/AfromAction()

Reference Files

Notes

  • @attach requires Svelte 5.29+
  • Use fromAction from svelte/attachments to convert legacy actions
  • Attachments pass through wrapper components when you spread props
  • Last verified: 2025-01-13

Score

Total Score

55/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

1ヶ月以内に更新

+10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

+5

Reviews

💬

Reviews coming soon