svelte-template-directives
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "svelte-template-directives" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-624243c9812a8e128caf1f9a5eaeb8043fe606bb237db227101da47e91762e66. Verify the upstream source and version against https://github.com/spences10/svelte-skills-kit before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
A collection of Svelte template directives including {@attach}, {@html}, {@render}, {@const}, and {@debug}. Used for DOM operations, third‑party library integration, tooltips, canvas scenarios, and dynamic HTML insertion. Notes that {@attach} can be used as an alternative to the use: action.
Introduction source: third_party · spences10 · 0.0.1 Reference
SkillPi interpretation
- Tasks
- Svelte template directives ({@attach}, {@html}, {@render}, {@const}, {@debug}). Use for DOM manipulation, third-party libs, tooltips, canvas, dynamic HTML. @attach replaces use: actions.
- Testing
- Not tested
Browse files
Frontmatter
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
| 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 |
@attach vs use: Actions
| 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() |
Reference Files
- attach-patterns.md - Real-world @attach examples
- other-directives.md - @html, @render, @const, @debug
Notes
@attachrequires Svelte 5.29+- Use
fromActionfromsvelte/attachmentsto 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 -->
Current listing version
0.0.1
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 针对 Svelte 5.29+ 新特性 {@attach} 提供实用指南
- 涵盖 DOM 操作、第三方库集成等真实开发场景
Highlights
- 触发词完整覆盖五大模板指令及典型用途
- 边界清晰,不易误触
Areas to improve
-
缺少显式 When to Use 章节 Reported severity: Minor
文档未设置独立 When to Use 段落,使用场景仅隐含在描述中
Recommendation: 建议在正文开头添加显式 When to Use 章节以提升可读性
Highlights
- 结构清晰,含对比表格与代码示例
- frontmatter 完整,长度适中
Highlights
- 基于官方 Svelte 语法,参数与用法准确
- 明确标注版本要求与迁移路径
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
These common operations were not identified in the main document. This does not mean no permissions or risks exist.
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.