Developing With Turbo Framesのロゴ

Developing With Turbo Frames

組織
hotwired-laravel
developing-with-turbo-frames

Turbo Framesを使ったスコープ付きナビゲーションと遅延読み込みを実装します。x-turbo::frame Bladeコンポーネントまたはturbo-frame HTML要素を使用する場合、data-turbo-frameによるターゲット指定、src属性を使ったフレームの遅延読み込み、data-turbo-actionによるURLの更新、wasFromTurboFrame()によるフレームリクエストの検出、refresh="morph"を使ったフレームのモーフィングを行う場合や、Turbo Frame、turbo frame、スコープ付きナビゲーション、インライン編集、フレームの遅延読み込み、_topを使ったフレームからの脱出についてユーザーが言及した場合に有効です。

Add to TypingMind

概要

公開者hotwired-laravel
リポジトリturbo-laravel
スキル名developing-with-turbo-frames
スター
838
フォーク
54
同梱ファイル
指示のみ
ライセンスMIT
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 指示だけで完結

    モデルに必要なものはすべて指示に含まれているため、別途同期するファイルはありません。

  • オープンソース

    hotwired-laravelがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Developing With Turbo Frames」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/hotwired-laravel/turbo-laravel/tree/2.x/resources/boost/skills/developing-with-turbo-frames
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/hotwired-laravel/turbo-laravel.git /tmp/turbo-laravel
mkdir -p .claude/skills
cp -r /tmp/turbo-laravel/resources/boost/skills/developing-with-turbo-frames .claude/skills/developing-with-turbo-frames
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでDeveloping With Turbo Framesを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にDeveloping With Turbo Framesを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Developing With Turbo Framesは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

Turbo Frames

Turbo Frames decompose pages into independent segments that scope navigation. Clicking links or submitting forms inside a <turbo-frame> only updates that frame, keeping the rest of the page intact.

The Frame Component

Use the <x-turbo::frame> Blade component to render a <turbo-frame> element:

@verbatim

@endverbatim

The :id Prop

The :id prop accepts multiple formats and auto-generates DOM IDs:

@verbatim

{{-- Model instance: generates dom_id($post) e.g. "post_1" --}} <x-turbo::frame :id="$post">...</x-turbo::frame>

{{-- Array [model, prefix]: generates dom_id($post, 'edit') e.g. "edit_post_1" --}} <x-turbo::frame :id="[$post, 'edit']">...</x-turbo::frame>

@endverbatim

Scoped Navigation

By default, links and forms inside a frame target that same frame. When the server responds, Turbo extracts the matching <turbo-frame> from the response and swaps its content:

@verbatim

{{-- Submitting this form updates only this frame with the response --}}
<form action="{{ route('posts.update', $post) }}" method="POST">
    @csrf
    @method('PUT')
    <input name="title" value="{{ $post->title }}">
    <button type="submit">Save</button>
</form>

</x-turbo::frame>

@endverbatim

Targeting Other Frames

Override the default frame target using data-turbo-frame:

@verbatim

{{-- Break out of the frame and navigate the entire page --}} View full page

@endverbatim

You can also set a default target on the frame itself:

@verbatim

@endverbatim

Lazy Loading

Frames can defer loading their content using the :src attribute. The frame fetches its content automatically:

@verbatim

{{-- Viewport lazy load: fetches when the frame enters the viewport --}} <x-turbo::frame :id="$post" :src="route('posts.comments.index', $post)" loading="lazy"> Loading comments... </x-turbo::frame>

@endverbatim

Promoting Frame Navigations to Page Visits

Use data-turbo-action to make a frame navigation also update the browser URL and history:

html
<a href="/posts/1" data-turbo-frame="post_detail" data-turbo-action="advance">View</a>

This updates the frame content AND pushes the URL to the browser history, allowing Back button navigation.

Detecting Frame Requests on the Server

Use request macros to detect if a request came from a Turbo Frame:

@verbatim

// Check if it came from a specific frame if ($request->wasFromTurboFrame(dom_id($post, 'create_comment'))) { // Return response for that specific frame }

@endverbatim

Morphing Within Frames

Add refresh="morph" to morph frame content instead of replacing it, preserving DOM state:

html
<turbo-frame id="post_1" refresh="morph">
    <!-- Content will be morphed on refresh -->
</turbo-frame>

Frame Rendering Customization

Customize how frame content is rendered using the turbo:before-frame-render event in JavaScript:

javascript
document.addEventListener("turbo:before-frame-render", (event) => {
    // Access event.detail.newFrame to modify before rendering
});

Benefits of Frames

  1. Efficient caching: Each frame is cached independently, giving longer-lived caches.
  2. Parallelized execution: Lazy-loaded frames are fetched concurrently, reducing total page load time.
  3. Mobile-ready: Frames with independent URLs can be rendered as native sheets/screens in Hotwire Native apps.

よくある質問

AIスキル「Developing With Turbo Frames」では何ができますか?

Turbo Framesを使ったスコープ付きナビゲーションと遅延読み込みを実装します。x-turbo::frame Bladeコンポーネントまたはturbo-frame HTML要素を使用する場合、data-turbo-frameによるターゲット指定、src属性を使ったフレームの遅延読み込み、data-turbo-actionによるURLの更新、wasFromTurboFrame()によるフレームリクエストの検出、refresh="morph"を使ったフレームのモーフィングを行う場合や、Turbo Frame、turbo frame、スコープ付きナビゲーション、インライン編集、フレームの遅延読み込み、_topを使ったフレームからの脱出についてユーザーが言及した場合に有効です。

TypingMindでDeveloping With Turbo Framesを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Developing With Turbo Framesはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにDeveloping With Turbo Framesをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/hotwired-laravel/turbo-laravel/tree/2.x/resources/boost/skills/developing-with-turbo-framesを貼り付けてください。TypingMindがSKILL.mdを読み込み、チャットごとに有効にできるスキルとしてインストールします。

Developing With Turbo Framesを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Developing With Turbo Framesで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもDeveloping With Turbo Framesを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Developing With Turbo Frames」は無料ですか?

はい。hotwired-laravelがMITライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇