svelte-template-directives

Use Svelte template directives for reactive DOM manipulation and HTML rendering.

15|1|Updated Apr 24, 2026
One-click install
npx skills add https://github.com/spences10/skills --skill svelte-template-directives-spences10
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: svelte-template-directives
Source: https://github.com/spences10/skills/tree/main/svelte-template-directives
Command: npx skills add https://github.com/spences10/skills --skill svelte-template-directives-spences10

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides guidance and code examples for effectively utilizing Svelte template directives, simplifying common tasks like DOM manipulation, rendering raw HTML, and more, while ensuring reactive and efficient code execution.

Core Features & Use Cases

  • DOM Manipulation with @attach: Reactive alternatives to use: actions for components like image zooms.
  • HTML Rendering: Safe HTML insertion using the @html directive with security considerations.
  • Rendering Snippets: Replaces slots with @render for structured content embedding.
  • Local Variables: Local declarations with {let ...} / {const ...} for scope-specific variables.
  • Debugging: Use {@debug} to pause on value changes and aid in debugging.

Quick Start

Use the 'svelte-template-directives' skill to learn how to incorporate Svelte template directives into your projects.

Frequently Asked Questions about svelte-template-directives

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I use Svelte template directives for reactive DOM manipulation?

You can use Svelte template directives for reactive DOM manipulation by applying specialized directives like @attach for interactive components, @html for raw HTML insertion, and @render for structured content embedding.

What is the best way to render raw HTML safely in Svelte templates?

The best way to render raw HTML in Svelte templates is using the @html directive, which allows direct HTML insertion while requiring security considerations to prevent vulnerabilities like cross-site scripting.

How do I replace slots with snippets for content embedding in Svelte?

You can replace slots with snippets for content embedding in Svelte by using the @render template directive, which provides a structured approach to inject and display content within your components.

Can I declare local variables inside Svelte templates for scope-specific logic?

Yes, you can declare local variables inside Svelte templates using the {let ...} and {const ...} syntax, allowing you to define scope-specific variables directly within your reactive template logic.

Why does my Svelte component need template directives instead of standard actions?

Svelte template directives are needed instead of standard actions when you require specialized reactive handling for DOM manipulation, HTML embedding, and snippet rendering that integrates tightly with the component's reactivity system.

How do I debug value changes in Svelte template directives?

You can debug value changes in Svelte template directives by using the {@debug} directive, which pauses execution when specified variables change, aiding in the inspection of reactive state updates.