Token导航 LogoToken导航TokenDH.com
开发操作浏览器github未标认证来源可访问许可证需确认审计通过

hotwire-patterns热线模式

Agent Skill

hotwire-patterns 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

194

周安装

8

GitHub Stars

4

下载量

63
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:hotwire-patterns(热线模式)
来源仓库:https://github.com/ag0os/rails-dev-plugin
仓库路径:skills/hotwire-patterns
安装命令:
npx skills add https://github.com/ag0os/rails-dev-plugin --skill hotwire-patterns
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/ag0os/rails-dev-plugin --skill hotwire-patterns

简介

hotwire-patterns 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息, 适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。

  • 可结合来源仓库、安装命令和原始 README 继续核验具体用法。
  • 安装前建议确认权限范围、维护状态, 以及是否会触发联网、命令执行或文件读写。

SKILL.md

Hotwire Patterns for Rails

Analyze and recommend Stimulus + Turbo patterns for modern, interactive Rails applications.

Quick Reference

ComponentUse When
StimulusAdding JS behaviors to server-rendered HTML
Turbo DriveDefault for all links/forms (no config needed)
Turbo FramesUpdate a section without full reload
Turbo StreamsUpdate multiple DOM elements from one response
ActionCable + StreamsPush real-time updates to connected clients

Supporting Documentation

  • stimulus.md - Stimulus integration patterns and production gotchas
  • turbo.md - Turbo Frames, Streams, and version-aware patterns

Core Philosophy

HTML over the wire: Send HTML from the server, not JSON. JavaScript enhances server-rendered HTML.

  1. Progressive enhancement: Works without JS, better with it
  2. Server-first: Business logic stays on the server
  3. Minimal JavaScript: Just enough JS to make HTML interactive
  4. No client-side state: Server is the source of truth

Decision Guide: Frames vs Streams

ScenarioUseWhy
Edit-in-placeFrameScoped navigation, replaces itself
Form creates item + updates counterStreamMultiple targets from one response
Lazy sidebarFrame with loading::lazyDeferred load, single target
Real-time chatActionCable + StreamPush from server to all clients
Tabs/paginationFrameScoped replacement
Flash + content updateStreamTwo targets: flash div + content

ActionCable + Stimulus Integration

This pattern is non-obvious -- it wires a Stimulus controller to an ActionCable subscription, giving you lifecycle-managed real-time behavior:

// app/javascript/controllers/chat_controller.js
import { Controller } from "@hotwired/stimulus"
import consumer from "../channels/consumer"

export default class extends Controller {
  static targets = ["messages", "input"]
  static values = { roomId: Number }

  connect() {
    this.subscription = consumer.subscriptions.create(
      { channel: "ChatChannel", room_id: this.roomIdValue },
      { received: (data) => this.messagesTarget.insertAdjacentHTML("beforeend", data.html) }
    )
  }
  disconnect() { this.subscription?.unsubscribe() }
  send(e) {
    e.preventDefault()
    if (this.inputTarget.value.trim()) {
      this.subscription.send({ message: this.inputTarget.value })
      this.inputTarget.value = ""
    }
  }
}

Key: disconnect() must unsubscribe to prevent leaked subscriptions during Turbo navigation.

Critical Gotchas

Missing 422 Status Code

Turbo will NOT render form error responses unless the server returns status::unprocessable_entity (422). This is the #1 Hotwire debugging issue:

# WRONG: Turbo ignores this response
format.html { render :new }

# RIGHT: Turbo processes the response
format.html { render :new, status: :unprocessable_entity }

Frame ID Mismatch (Silent Failure)

If the response HTML does not contain a <turbo-frame> with a matching id, nothing happens -- no error, no update. Debug with:

  • Browser console: look for "Response has no matching " warning
  • Verify dom_id(@record) produces the same ID on both pages
  • Check that the edit/show view wraps content in the same frame tag

Broadcasting Without Scoping

# WRONG: every connected user sees every message
after_create_commit { broadcast_prepend_to "messages" }

# RIGHT: scope to the relevant stream
after_create_commit -> { broadcast_prepend_to(room, :messages) }
after_create_commit -> { broadcast_prepend_to(user, :notifications) }  # per-user

Anti-Patterns

Anti-PatternProblemFix
Client-side state managementFights Hotwire's server-first modelKeep state on server, re-render HTML
Fat Stimulus controllers (100+ lines)Hard to maintainExtract into multiple focused controllers
Broadcasting without scopingAll users see all updatesScope broadcasts to relevant streams
No loading::lazy on hidden framesUnnecessary requests on page loadUse lazy loading for below-fold content
Streams when a Frame sufficesOvercomplicatedUse Frames for single-target scoped nav

Progressive Enhancement Checklist

Before shipping any Hotwire feature, verify:

  • Core functionality works with Turbo Drive disabled (data-turbo="false")
  • Forms submit successfully without JS (standard HTML submission)
  • Links navigate to full pages without Turbo Frames
  • Stimulus controllers degrade gracefully (content visible without JS)
  • data-turbo-permanent preserves media players, ActionCable connections across navigation
  • data-turbo="false" on file downloads and external links

Output Format

When analyzing or creating Hotwire components, provide:

  1. Stimulus controller (JS) with targets, values, classes
  2. View partial (ERB) with proper data attributes
  3. Controller action with turbo_stream response format
  4. Model broadcasts if real-time updates needed
  5. Cable subscription if ActionCable integration required

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.31%
按下载量换算22

Claude

32.23%
按下载量换算20

Cursor

19.95%
按下载量换算13

Gemini CLI

9.65%
按下载量换算6

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills