Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
spences10 avatar

Svelte Template Directives

  • 95 installs
  • 92 repo stars
  • Updated April 29, 2026
  • spences10/svelte-skills-kit

Helps with ai & agent building tasks.

About

svelte-template-directives is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted development.

  • svelte-template-directives
  • AI & Agent Building
  • AI-coding skill

Svelte Template Directives by the numbers

  • 95 all-time installs (skills.sh)
  • +9 installs in the week ending Aug 5, 2026 (Skillselion tracking)
  • Ranked #4,606 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/spences10/svelte-skills-kit --skill svelte-template-directives

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs95
repo stars92
Last updatedApril 29, 2026
Repositoryspences10/svelte-skills-kit

What it does

Helps with ai & agent building tasks.

Files

SKILL.mdMarkdownGitHub ↗

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
{#each (key)}Keyed iteration (always key!)Yes
<svelte:window>Window event listenersN/A

@attach vs use: Actions

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

Reference Files

  • attach-patterns.md - Real-world @attach

examples

  • other-directives.md - @html, @render,

@const, @debug

Notes

  • @attach requires Svelte 5.29+
  • Use fromAction from svelte/attachments to convert legacy actions
  • Attachments pass through wrapper components when you spread props
  • Always use keyed each blocks — never use index as key
  • Use <svelte:window>/<svelte:document> for global events, not $effect
  • Last verified: 2026-03-12

<!-- PROGRESSIVE DISCLOSURE GUIDELINES:

  • Keep this file ~50 lines total (max ~150 lines)
  • Use 1-2 code blocks only (recommend 1)
  • Keep description <200 chars for Level 1 efficiency
  • Move detailed docs to references/ for Level 3 loading
  • This is Level 2 - quick reference ONLY, not a manual

-->

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.