svelte-template-directives
安装方式
先用 Prompt 核对来源与依赖。也可下载安装包。
用 AI 助手安装
复制提示词,让助手先核对固定版本和依赖。
查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "svelte-template-directives":https://skillpi.com/zh/skills/deepskill-624243c9812a8e128caf1f9a5eaeb8043fe606bb237db227101da47e91762e66。安装前核对上游来源和版本:https://github.com/spences10/svelte-skills-kit。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。
来源与配置
github.com
配置方式待核实
请查看原始来源中的适用工具、依赖和权限要求。
安装实测待补充
Svelte 模板指令集合,包含 {@attach}、{@html}、{@render}、{@const}、{@debug}。用于 DOM 操作、与第三方库集成、工具提示、画布场景和动态插入 HTML。说明 {@attach} 可作为替代 use: 动作的方案。
介绍来源: third_party · spences10 · 0.0.1 参考来源
SkillPi 解读
- 能完成的任务
- 翻译待完成,请参阅来源文档。
- 实测状态
- 未测试
文件浏览
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 -->
当前收录版本
0.0.1
质量评测
满分100 · 来自 SkillPi LAB 实验室的评测报告。
亮点
- 针对 Svelte 5.29+ 新特性 {@attach} 提供实用指南
- 涵盖 DOM 操作、第三方库集成等真实开发场景
亮点
- 触发词完整覆盖五大模板指令及典型用途
- 边界清晰,不易误触
待提升项
-
缺少显式 When to Use 章节 原报告严重程度:轻微
文档未设置独立 When to Use 段落,使用场景仅隐含在描述中
改进建议:建议在正文开头添加显式 When to Use 章节以提升可读性
亮点
- 结构清晰,含对比表格与代码示例
- frontmatter 完整,长度适中
亮点
- 基于官方 Svelte 语法,参数与用法准确
- 明确标注版本要求与迁移路径
取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。
正文静态检测
100 / 100 · skillpi-20261123-no-r3-v1
正文未命中当前规则。
分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。
权限与使用前检查
根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。
未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。
安全评级与访问范围
safe · 静态证据核验,不代表运行安全保证。
使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。
用户讨论
还没有已核实的点评。