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

turbo-fetch涡轮提取

Agent Skill

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

总安装

582

周安装

25

GitHub Stars

5

下载量

204
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/rolemodel/rolemodel-skills --skill turbo-fetch

简介

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

  • 它能自动提取 GitHub 仓库的 Issue、PR 及协作动态,辅助代码审查与项目进度跟踪。
  • 安装命令:npx skills add https://github.com/rolemodel/rolemodel-skills --skill turbo-fetch。
  • 安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Turbo Fetch Skill

This skill documents the turbo fetch pattern for dynamically updating form fields based on user input using Turbo Streams and Stimulus.

When to Use

Use turbo fetch when you need to:

  • Update form options based on another field's selection
  • Show/hide conditional fields dynamically
  • Refresh parts of a form without reloading the entire page
  • Implement cascading dropdowns or dependent fields

Pattern Overview

The turbo fetch pattern consists of four components:

  1. Routes - A routing concern that adds the turbo_fetch endpoint
  2. Controller Action - A backend action that prepares data and renders turbo streams
  3. Stimulus Controller - Frontend controller that triggers PATCH requests
  4. Turbo Stream View - Template that updates specific DOM elements

Implementation Steps

1. Add Routing Concern (if not already present)

In config/routes.rb, ensure the turbo_fetch concern exists:

concern :turbo_fetch do
  patch :turbo_fetch, on: :collection
end

Then apply it to your resource:

resources :materials, concerns: %i[turbo_fetch]

This creates a route: PATCH /materials/turbo_fetch

2. Implement Controller Action

Add a turbo_fetch action to your controller:

class MaterialsController < ApplicationController
  def turbo_fetch
    @material = authorize Material.new(material_params)
    # The view will handle the turbo stream responses
  end

  private

  def material_params
    params.require(:material).permit(:type, :substance, ...)
  end
end

Key points:

  • Creates a new instance with submitted params (doesn't save to database)
  • Runs authorization if needed
  • The instance will be used in the turbo stream view to determine updated options

3. Create Turbo Stream View

Create app/views/[resource]/turbo_fetch.turbo_stream.slim:

= simple_form_for @material do |f|
  = turbo_stream.update 'substance-field' do
    = f.input :substance, collection: @material.substances
  = turbo_stream.replace 'material_details', partial: dimension_fields_partial_path, locals: { f: }

Available turbo stream actions:

  • turbo_stream.update - Replace the content inside an element
  • turbo_stream.replace - Replace the entire element
  • turbo_stream.append - Add content at the end
  • turbo_stream.prepend - Add content at the beginning
  • turbo_stream.remove - Remove an element

4. Setup Form with Stimulus Controller

Add the Stimulus controller to your form:

= simple_form_for resource, data: { controller: 'turbo-fetch', turbo_fetch_url_value: turbo_fetch_materials_url } do |f|
  .form-row
    = f.input :type, input_html: { data: { action: "turbo-fetch#perform" } }

  #substance-field.flexible
    = f.input :substance, collection: f.object.substances

  #material_details
    = render dimension_fields_partial_path, f: f

Key attributes:

  • data-controller="turbo-fetch" - Activates the Stimulus controller
  • data-turbo-fetch-url-value - The URL to PATCH (defaults to form action + /turbo_fetch)
  • data-action="turbo-fetch#perform" - Triggers the fetch on field change

5. Verify Stimulus Controller Exists

The turbo_fetch_controller.js should exist at app/javascript/controllers/turbo_fetch_controller.js:

import { Controller } from '@hotwired/stimulus'
import { patch } from '@rails/request.js'

export default class extends Controller {
  static values = { url: String, count: Number }

  async perform({ params: { url: urlParam, query: queryParams } }) {
    const body = new FormData(this.element)

    if (queryParams) Object.keys(queryParams).forEach(key => body.append(key, queryParams[key]))

    const response = await patch(urlParam || this.urlValue, { body, responseKind: 'turbo-stream' })
    if (response.ok) this.countValue += 1
  }
}

Examples from Codebase

Materials Example

Route:

resources :materials, concerns: %i[duplication turbo_fetch]

Controller:

def turbo_fetch
  @material = authorize Material.new(material_params)
end

View (turbo_fetch.turbo_stream.slim):

= simple_form_for @material do |f|
  = turbo_stream.update 'substance-field' do
    = f.input :substance, collection: @material.substances, as: :tom_select, allow_create: true
  = turbo_stream.replace 'material_details', partial: dimension_fields_partial_path, locals: { f: }

Form:

= simple_form_for resource, data: { controller: 'turbo-fetch', turbo_fetch_url_value: turbo_fetch_materials_url } do |f|
  = f.input :type, input_html: { data: { action: "turbo-fetch#perform" } }

  #substance-field.flexible
    = f.input :substance, collection: f.object.substances

  #material_details
    = render dimension_fields_partial_path, f: f

Common Patterns

Pattern 1: Dependent Dropdown

When selecting a type, update available options in another field:

  • Trigger field has data-action="turbo-fetch#perform"
  • Target field has unique ID (e.g., #substance-field)
  • Turbo stream updates the target with new collection

Pattern 2: Conditional Field Sections

Show/hide entire form sections based on selection:

  • Use turbo_stream.replace to swap out entire sections
  • Render different partials based on the selected value

Pattern 3: Member vs Collection Routes

Most turbo_fetch routes are on :collection, but for nested resources with IDs:

resources :custom_parts, concerns: %i[turbo_fetch] do
  patch :turbo_fetch, on: :member # For child items with IDs
end

Tips

  1. Target IDs: Ensure target elements have unique, stable IDs
  2. Form Context: The turbo stream view wraps form builder in simple_form_for to maintain form context
  3. Authorization: Apply same authorization as create/update actions
  4. Don't Save: The turbo_fetch action creates instances but never saves them
  5. Multiple Updates: You can include multiple turbo_stream updates in one response

Troubleshooting

Updates not appearing:

  • Check that target element ID matches the turbo_stream selector
  • Verify the Stimulus action is firing (check browser console)
  • Ensure turbo_fetch route exists (run rails routes | grep turbo_fetch)

Wrong data in fields:

  • Verify params are being permitted in material_params (or equivalent)
  • Check that the model's computed properties return correct values

Authorization errors:

  • Ensure turbo_fetch action runs same authorization as new/create

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

34.49%
按下载量换算70

Claude

26.88%
按下载量换算55

Cursor

20.49%
按下载量换算42

Gemini CLI

9.85%
按下载量换算20

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

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

安装前确认

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

来源信息

继续浏览同类 Skills