hotwire
БесплатноБез исполняемых скриптовНе проверенBuild server-rendered web apps that feel like SPAs with Hotwire, the HTML-over-the-wire toolkit made of Turbo (Drive, Frames, Streams, page-refresh morphing)…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
Hotwire — HTML Over the Wire
Overview
Hotwire sends HTML from the server instead of JSON and lets the browser patch it in. It has two parts: Turbo (Drive for navigation, Frames for independent page regions, Streams for targeted DOM changes, and morphing page refreshes) and Stimulus (small controllers attached with data-* attributes). Current packages: @hotwired/turbo 8.0.x and @hotwired/stimulus 3.2.x. Rails apps get both through turbo-rails and stimulus-rails; other backends only need to return HTML and set the right status codes and content types.
Instructions
Step 1: Install
npm install @hotwired/turbo @hotwired/stimulus
# Rails 7+ with importmap
bin/importmap pin @hotwired/turbo-rails @hotwired/stimulus
// app.js
import "@hotwired/turbo"; // starts Turbo Drive; no setup call needed
import { Application } from "@hotwired/stimulus";
import DropdownController from "./controllers/dropdown_controller.js";
window.Stimulus = Application.start();
Stimulus.register("dropdown", DropdownController);
Step 2: Turbo Drive
Drive is on as soon as the script loads: link clicks and form submissions become fetch requests and only the <body> is swapped, with <head> assets kept.
<a href="/invoices/export.csv" data-turbo="false">Download CSV</a> <!-- opt out -->
<a href="/articles/7/edit" data-turbo-action="replace">Edit</a> <!-- replace history entry -->
<a href="/about" data-turbo-prefetch="false">About</a> <!-- no hover prefetch -->
<meta name="turbo-cache-control" content="no-cache"> <!-- never cache this page -->
Since Turbo 8, links are prefetched 100 ms after hover by default; disable it for the page with <meta name="turbo-prefetch" content="false">. data-turbo-permanent on an element with an id keeps it across navigations. A form POST must be answered with a 303 redirect on success and 422 (validation errors) or 500 with the re-rendered form on failure; a 200 after a POST is ignored by Drive and the page appears to do nothing.
Step 3: Turbo Frames
A turbo-frame element scopes navigation: links and forms inside it update only that frame, and the response must contain a frame with the same id.
<turbo-frame id="comments">
<h2>Comments</h2>
<a href="/posts/7/comments?page=2">More</a> <!-- response must contain a turbo-frame with id="comments" -->
</turbo-frame>
<turbo-frame id="activity" src="/posts/7/activity" loading="lazy">
<p>Loading activity…</p>
</turbo-frame>
<a href="/posts/7" data-turbo-frame="_top">Open full page</a> <!-- break out of the frame -->
<a href="/users/42" data-turbo-frame="profile-panel">View profile</a> <!-- drive another frame -->
Step 4: Turbo Streams
A stream is a turbo-stream element with an action and a target (an element id) or targets (a CSS selector). Actions: append, prepend, replace, update, remove, before, after, refresh.
<turbo-stream action="append" target="comments">
<template><div id="comment_58" class="comment"><strong>Maria:</strong> Shipped it.</div></template>
</turbo-stream>
<turbo-stream action="remove" target="comment_57"></turbo-stream>
<turbo-stream action="update" target="unread-count"><template>5</template></turbo-stream>
Delivery:
- In response to a non-GET form submission: Turbo adds
text/vnd.turbo-stream.htmlto theAcceptheader; reply with that content type and the stream elements. Links and GET forms needdata-turbo-streamto ask for it. - Over WebSocket or SSE: put a
turbo-stream-sourceelement (srcis awss://or SSE URL) in the page and send stream elements down it. Rails does this withturbo_stream_fromandbroadcast_*helpers over Action Cable.
Step 5: Page refreshes with morphing
Turbo 8 can re-render the same page by morphing instead of replacing the body, which keeps scroll, focus and open popovers:
<head>
<meta name="turbo-refresh-method" content="morph">
<meta name="turbo-refresh-scroll" content="preserve">
</head>
Mark elements Turbo must not touch with data-turbo-permanent. Send a stream with action="refresh" to make every viewer reload the current page, and a frame with refresh="morph" reloads just itself on refresh.
Step 6: Stimulus controllers
// controllers/dropdown_controller.js
import { Controller } from "@hotwired/stimulus";
export default class extends Controller {
static targets = ["menu"];
static values = { open: Boolean };
static classes = ["active"];
toggle() { this.openValue = !this.openValue; }
openValueChanged() {
this.menuTarget.classList.toggle(this.activeClass, this.openValue);
this.menuTarget.hidden = !this.openValue;
}
closeOutside(event) {
if (!this.element.contains(event.target)) this.openValue = false;
}
}
<div data-controller="dropdown" data-dropdown-active-class="shadow-lg"
dat
Установить hotwire в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл hotwire?
Build server-rendered web apps that feel like SPAs with Hotwire, the HTML-over-the-wire toolkit made of Turbo (Drive, Frames, Streams, page-refresh morphing) and Stimulus controllers. Use when a user asks to "add Turbo", "use Hotwire", "update part of a page without a full reload", "live-update with Turbo Streams", "write a Stimulus controller", or wants SPA-like navigation from Rails, Django, Laravel, Express or Go without a JavaScript framework.
Как установить скилл hotwire?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл hotwire запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic