# svelte-template-directives

A reference for Svelte template directives, from DOM attachments to HTML and snippets. Useful when building or debugging Svelte components.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 474 installs · ★ 94
- Author: spences10
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/spences10/svelte-skills-kit/tree/HEAD/plugins/svelte-skills/skills/svelte-template-directives/SKILL.md
- Updated: 2026-10-12
- HTML: https://affpapa.org/en/nevibecode/skills/svelte-template-directives

## What it does

The skill covers {@attach}, {@html}, {@render}, {@const}, and {@debug}, along with keyed {@each} blocks and global event handling. An attachment can connect a DOM element to an external library and run again when its dependencies change.

It comes with a compact reference and separate files containing examples for attachments and other directives. {@attach} needs Svelte 5.29 or later, so check the project version before relying on it. For converting older actions, the guide points to fromAction from svelte/attachments.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add spences10/svelte-skills-kit --skill svelte-template-directives -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/svelte-template-directives/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/svelte-template-directives/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add spences10/svelte-skills-kit --skill svelte-template-directives -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/svelte-template-directives/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add spences10/svelte-skills-kit --skill svelte-template-directives -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/svelte-template-directives/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install spences10/svelte-skills-kit svelte-template-directives
```

2. **Manually: put the files in place**
- File: `.github/skills/svelte-template-directives/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add spences10/svelte-skills-kit --skill svelte-template-directives -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/spences10/svelte-skills-kit --path plugins/svelte-skills/skills/svelte-template-directives
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/svelte-template-directives/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add spences10/svelte-skills-kit --skill svelte-template-directives -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/spences10/svelte-skills-kit/tree/HEAD/plugins/svelte-skills/skills/svelte-template-directives/SKILL.md

## When to use it
- connect a third-party library to a DOM element
- render an HTML string in a Svelte template
- insert a snippet into component markup
- define a local constant inside a block
- pause debugging when a value changes

## Example prompts
- Show how to connect a library to a Svelte element with {@attach}.
- Explain when to use {@html} instead of {@render} in this component.
- Help me convert this older action using fromAction.

## Similar
- [frontend-design](https://affpapa.org/en/nevibecode/skills/frontend-design.md) — skill · 1025790 installs
- [design-taste-frontend](https://affpapa.org/en/nevibecode/skills/design-taste-frontend.md) — skill · 678700 installs
- [prototype](https://affpapa.org/en/nevibecode/skills/prototype.md) — skill · 986201 installs
- [hyperframes](https://affpapa.org/en/nevibecode/skills/heygen-com-hyperframes.md) — skill · 1200000 installs
- [hyperframes-cli](https://affpapa.org/en/nevibecode/skills/heygen-com-hyperframes-cli.md) — skill · 1300000 installs
- [webapp-testing](https://affpapa.org/en/nevibecode/skills/webapp-testing.md) — skill · 186758 installs

From the same set: [spences10/svelte-skills-kit](https://affpapa.org/en/nevibecode/by/spences10/svelte-skills-kit.md) — 6 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
