Agent Skills by ALSEL
Anthropic Claudeソフトウェア開発⭐ リポ 0品質スコア 50/100

tool-ui

shadcn レジストリを活用して、React アプリへの Tool UI コンポーネントの検索・インストール・設定・統合を行います。互換性チェックやランタイムの自動配線、assistant-ui とのツールキットセットアップ、トラブルシューティングにも対応します。コンポーネントの追加・選定・互換性確認・ツールキット配線・既存のチャットやランタイムスタックへの統合を行いたい開発者向けに使用してください。

description の原文を見る

Find, install, configure, and integrate Tool UI components in React apps using shadcn registry entries, compatibility checks, scaffolded runtime wiring, toolkit setup with assistant-ui, and troubleshooting workflows. Use when developers ask to add one or more Tool UI components, choose components for a use case, verify compatibility, wire a toolkit in a codebase, or integrate Tool UI payloads into assistant-ui or an existing chat/runtime stack.

SKILL.md 本文

Tool UI

このスキルを使用して、リクエストから動作する Tool UI 統合へ素早く進むことができます。

プロジェクトに既存のチャット UI/ランタイムがない場合は assistant-ui を優先してください。アプリに既に動作するランタイムがある場合は、assistant-ui をオプショナルとして扱ってください。

ステップ 1: 互換性と診断

ユーザーのプロジェクト内の components.json を読み込み、以下を確認します:

  • components.json が存在する。

ステップ 2: コンポーネントのインストール

プロジェクトルートからのインストールコマンド

推奨(AI支援統合):

npx tool-agent "integrate the <component> <component-id>"

カタログからコンポーネント固有のプロンプトを使用してください(例: integrate the plan component for step-by-step task workflows with status tracking)。

代替案(直接レジストリ):

npx shadcn@latest add @tool-ui/<component-id>

複数のコンポーネント:

npx tool-agent "integrate the plan, progress-tracker, and approval-card components for planning flows"

または shadcn 経由:

npx shadcn@latest add @tool-ui/plan @tool-ui/progress-tracker @tool-ui/approval-card

完全なコンポーネントカタログ

tool-agent プロンプトと shadcn インストールコマンド付きの全 25 個の Tool UI コンポーネント:

進捗

コンポーネント説明tool-agent プロンプトshadcn
planステータス追跡付きのステップバイステップタスクintegrate the plan component for step-by-step task workflows with status trackingnpx shadcn@latest add @tool-ui/plan
progress-tracker複数ステップ操作の実時間ステータスフィードバックintegrate the progress tracker component for real-time status feedback on multi-step operationsnpx shadcn@latest add @tool-ui/progress-tracker

入力

コンポーネント説明tool-agent プロンプトshadcn
option-listユーザーが複数の選択肢から選択integrate the option list component to let users select from multiple choicesnpx shadcn@latest add @tool-ui/option-list
parameter-slider数値パラメータ調整コントロールintegrate the parameter slider component for numeric parameter adjustment controlsnpx shadcn@latest add @tool-ui/parameter-slider
preferences-panelユーザー設定用のコンパクト設定パネルintegrate the preferences panel component for compact user settingsnpx shadcn@latest add @tool-ui/preferences-panel
question-flow分岐を含むマルチステップガイド質問integrate the question flow component for multi-step guided questions with branchingnpx shadcn@latest add @tool-ui/question-flow

表示

コンポーネント説明tool-agent プロンプトshadcn
citation引用元参照を表示integrate the citation component to display source references with attributionnpx shadcn@latest add @tool-ui/citation
item-carouselコレクション閲覧用の水平カルーセルintegrate the item carousel component for horizontal browsing of collectionsnpx shadcn@latest add @tool-ui/item-carousel
link-previewOpen Graph データ付きのリッチリンクプレビューintegrate the link preview component for rich link previews with Open Graph datanpx shadcn@latest add @tool-ui/link-preview
stats-displayビジュアルグリッドでの主要メトリクスintegrate the stats display component for key metrics and KPIs in a visual gridnpx shadcn@latest add @tool-ui/stats-display
terminalコマンドラインの出力とログを表示integrate the terminal component to show command-line output and logsnpx shadcn@latest add @tool-ui/terminal
weather-widget予報と気象条件付きの天気表示integrate the weather widget component for weather display with forecasts and conditionsnpx shadcn@latest add @tool-ui/weather-widget

アーティファクト

コンポーネント説明tool-agent プロンプトshadcn
chartインタラクティブチャートでデータ可視化(recharts 必須)integrate the chart component to visualize data with interactive chartsnpx shadcn@latest add @tool-ui/chart
code-blockシンタックスハイライト付きコードスニペット表示integrate the code block component for syntax-highlighted code snippetsnpx shadcn@latest add @tool-ui/code-block
code-diffシンタックスハイライト付きコード差分比較(@pierre/diffs 必須)integrate the code diff component to compare code changes with syntax-highlighted diffsnpx shadcn@latest add @tool-ui/code-diff
data-tableソート可能なテーブルで構造化データを表示integrate the data table component to present structured data in sortable tablesnpx shadcn@latest add @tool-ui/data-table
message-draft送信前にメッセージを確認して承認integrate the message draft component to review and approve messages before sendingnpx shadcn@latest add @tool-ui/message-draft
instagram-postInstagram 投稿プレビューをレンダリングintegrate the instagram post component to render Instagram post previewsnpx shadcn@latest add @tool-ui/instagram-post
linkedin-postLinkedIn 投稿プレビューをレンダリングintegrate the linkedin post component to render LinkedIn post previewsnpx shadcn@latest add @tool-ui/linkedin-post
x-postX 投稿プレビューをレンダリングintegrate the x post component to render X/Twitter post previewsnpx shadcn@latest add @tool-ui/x-post

確認

コンポーネント説明tool-agent プロンプトshadcn
approval-cardエージェントアクションのバイナリ確認integrate the approval card component for binary confirmation of agent actionsnpx shadcn@latest add @tool-ui/approval-card
order-summary購入を明細価格付きで表示integrate the order summary component to display purchases with itemized pricingnpx shadcn@latest add @tool-ui/order-summary

メディア

コンポーネント説明tool-agent プロンプトshadcn
audioアートワークとメタデータ付きの音声再生integrate the audio component for audio playback with artwork and metadatanpx shadcn@latest add @tool-ui/audio
imageメタデータと帰属付きの画像表示integrate the image component to display images with metadata and attributionnpx shadcn@latest add @tool-ui/image
image-galleryフルスクリーンライトボックスビューア付きメーソンリーグリッドintegrate the image gallery component with masonry grid and lightbox viewernpx shadcn@latest add @tool-ui/image-gallery
videoコントロールとポスター付きの動画再生integrate the video component for video playback with controls and posternpx shadcn@latest add @tool-ui/video

表示(ジオマップ)

コンポーネント説明tool-agent プロンプトshadcn
geo-mapジオロケーション付きエンティティとフリート位置表示integrate the geo map component to display geolocated entities and fleet positionsnpx shadcn@latest add @tool-ui/geo-map

ユースケース別のインストール例

tool-agent(推奨):

npx tool-agent "integrate the plan, progress-tracker, and approval-card components for planning flows"
npx tool-agent "integrate citation, link-preview, code-block, and code-diff for research output"
npx tool-agent "integrate data-table, chart, and stats-display for data visualization"
npx tool-agent "integrate image, image-gallery, video, and audio for media display"

shadcn(直接):

npx shadcn@latest add @tool-ui/plan @tool-ui/progress-tracker @tool-ui/approval-card
npx shadcn@latest add @tool-ui/citation @tool-ui/link-preview @tool-ui/code-block @tool-ui/code-diff
npx shadcn@latest add @tool-ui/data-table @tool-ui/chart @tool-ui/stats-display
# npm i recharts  # chart のピア依存
npx shadcn@latest add @tool-ui/image @tool-ui/image-gallery @tool-ui/video @tool-ui/audio

コードベースのツールキット設定

コンポーネントをインストール後、それらを assistant-ui 経由の Toolkit でワイヤリングします。このセクションは完全なセットアップを扱います: プロバイダー、ランタイム、ツールキットファイル、ID ハンドリング。

1. プロバイダーとランタイム

ランタイム、トランスポート、ツールを提供するアシスタントラッパーを作成します:

"use client";

import { lastAssistantMessageIsCompleteWithToolCalls } from "ai";
import { AssistantRuntimeProvider, Tools, useAui } from "@assistant-ui/react";
import {
  AssistantChatTransport,
  useChatRuntime,
} from "@assistant-ui/react-ai-sdk";
import { Thread } from "@/components/assistant-ui/thread";
import { toolkit } from "@/components/toolkit";

export const Assistant = () => {
  const runtime = useChatRuntime({
    transport: new AssistantChatTransport({ api: "/api/chat" }),
    sendAutomaticallyWhen: lastAssistantMessageIsCompleteWithToolCalls,
  });
  const aui = useAui({ tools: Tools({ toolkit }) });

  return (
    <AssistantRuntimeProvider runtime={runtime} aui={aui}>
      <div className="h-dvh">
        <Thread />
      </div>
    </AssistantRuntimeProvider>
  );
};

重要なポイント:

  • useChatRuntime + AssistantChatTransport: チャット API に接続します。
  • Tools({ toolkit }): ツール定義とレンダラーをモデルに転送します。
  • sendAutomaticallyWhen: lastAssistantMessageIsCompleteWithToolCalls: ツール呼び出し後に自動継続します(オプションですがツール集約的フローでは一般的)。

2. ツールキットファイル構造

toolkit.ts(または toolkit.tsx)を単一ファイルとして作成し、Toolkit オブジェクトをエクスポートします。各キーはツール名で、各値は typedescriptionparametersrender を持ちます。

ツール説明 — すべてのツールに description を含めてください。可視コンテンツではなく、いつ ツールを呼び出すか、どの役割を果たすかを説明します。Tool UI コンポーネントは既にペイロード(オプション、プラン、チャートなど)をユーザーに対してレンダリングするため、そのコンテンツを繰り返す説明は冗長です。コンテンツを繰り返す(例: 「ラベルと説明付きのオプションリストを表示」)のではなく、モデル指向のガイダンスを優先してください(例: 「ユーザーが従うべきプランを提示」または「ユーザーが 1 つのオプションを選択させる」)。

フロントエンド vs バックエンドツール

--フロントエンドバックエンド
-実装ブラウザで実行; ユーザーインタラクションが addResult 経由でコミットツール実装はサーバーに配置; モデルが結果を返す
-execute必須 — クライアント側のツール UI フローを実行不要
-parameters必須(モデル引数のスキーマ)使用しない、バックエンド llm が aisdk 経由で完了した場合は inputSchema を使用
-render必須(引数、ステータス、結果、addResult の UI)必須(result の UI)

バックエンドツール(モデルが結果を返す; ユーザー入力なし):

import { type Toolkit } from "@assistant-ui/react";
import { Plan } from "@/components/tool-ui/plan";
import { safeParseSerializablePlan } from "@/components/tool-ui/plan/schema";

export const toolkit: Toolkit = {
  showPlan: {
    type: "backend",
    render: ({ result }) => {
      const parsed = safeParseSerializablePlan(result);
      if (!parsed) return null;
      return <Plan {...parsed} />;
    },
  },
};

フロントエンドツール(モデルが引数を送信; ユーザーインタラクションが addResult 経由でコミット):

import { type Toolkit } from "@assistant-ui/react";
import { OptionList } from "@/components/tool-ui/option-list";
import {
  SerializableOptionListSchema,
  safeParseSerializableOptionList,
} from "@/components/tool-ui/option-list/schema";

const optionListTool: Toolkit[string] = {
  description: "Render selectable options with confirm and clear actions.",
  parameters: SerializableOptionListSchema,
  render: ({ args, toolCallId, result, addResult }) => {
    const parsed = safeParseSerializableOptionList({
      ...args,
      id: args?.id ?? `option-list-${toolCallId}`,
    });
    if (!parsed) return null;

    if (result) {
      return <OptionList {...parsed} choice={result} />;
    }
    return (
      <OptionList
        {...parsed}
        onAction={async (actionId, selection) => {
          if (actionId === "confirm" || actionId === "cancel") {
            await addResult?.(selection);
          }
        }}
      />
    );
  },
};

export const toolkit: Toolkit = {
  option_list: optionListTool,
  approval_card: {
    /* ... */
  },
};

3. API ルート(AI SDK)

チャット API が AI SDK(streamText)を使用する場合、ai から tool() を使用してバックエンドツールを定義します:

  • inputSchema を使用
  • バックエンドツールはサーバー上で execute を使用; 結果がストリーミングされ、ツールキットの render 関数経由でレンダリング
import { streamText, tool, convertToModelMessages } from "ai";
import { openai } from "@ai-sdk/openai";
import { z } from "zod";

// フロントエンドツール の場合: ...frontendTools(clientTools) — clientTools は AssistantChatTransport 経由のリクエストボディから来ます
const result = streamText({
  model: openai("gpt-4o"),
  messages: await convertToModelMessages(messages),
  tools: {
    get_weather: tool({
      description:
        "Get the current weather and forecast for a location. Returns data to display in a weather widget.",
      inputSchema: z.object({
        location: z.string().describe("City name, e.g. 'San Francisco'"),
        units: z
          .enum(["celsius", "fahrenheit"])
          .default("fahrenheit")
          .describe("Temperature unit"),
      }),
      execute: async ({ location, units }) => {
        // 天気データを取得、ウィジェットスキーマと一致する形状を返す
        return { location, units /* ... */ };
      },
    }),
  },
});

4. アクション中心 vs 複合コンポーネント

パターンコンポーネント使用方法
アクション中心OptionListParameterSliderPreferencesPanelApprovalCardonAction または onConfirm/onCancel を直接ワイヤリング; ToolUI ラッパーなし。領収状態の場合は choice={result} を渡します。
複合OrderSummaryDataTable などToolUI + ToolUI.Surface + ToolUI.Actions でラップ; DecisionActions または LocalActions を使用。

アクション中心の例(OptionList):

return (
  <OptionList
    {...parsed}
    onAction={async (actionId, selection) => {
      if (actionId === "confirm" || actionId === "cancel") {
        await addResult?.(selection);
      }
    }}
  />
);

複合の例(DecisionActions 付き OrderSummary):

return (
  <ToolUI id={parsed.id}>
    <ToolUI.Surface>
      <OrderSummary {...parsed} />
    </ToolUI.Surface>
    <ToolUI.Actions>
      <ToolUI.DecisionActions
        actions={[
          { id: "cancel", label: "Cancel", variant: "outline" },
          { id: "confirm", label: "Purchase" },
        ]}
        onAction={(action) =>
          createDecisionResult({ decisionId: parsed.id, action })
        }
        onCommit={(decision) => addResult?.(decision)}
      />
    </ToolUI.Actions>
  </ToolUI>
);

ApprovalCard は組み込みアクションを使用します; onConfirm/onCancel を直接ワイヤリング:

return (
  <ApprovalCard
    {...parsed}
    choice={
      result === "approved" || result === "denied" ? result : parsed.choice
    }
    onConfirm={async () => addResult?.("approved")}
    onCancel={async () => addResult?.("denied")}
  />
);

アクションモデル

Tool UI は、表示コンポーネント外の複合兄弟としてレンダリングされた 2 つのアクションサーフェスを使用します:

  • ToolUI.LocalActions: 非結果的副作用(エクスポート、コピー、リンク開く)。ハンドラーは addResult(...) を呼び出してはいけません。
  • ToolUI.DecisionActions: createDecisionResult(...) 経由で DecisionResult エンベロップを生成する結果的選択。コミットコールバックは addResult(...) を呼び出します。

アクション付き表示コンポーネント用の複合ラッパーパターン:

<ToolUI id={surfaceId}>
  <ToolUI.Surface>
    <DataTable {...props} />
  </ToolUI.Surface>
  <ToolUI.Actions>
    <ToolUI.LocalActions
      actions={[{ id: "export-csv", label: "Export CSV" }]}
      onAction={(actionId) => {
        /* 副作用のみ */
      }}
    />
  </ToolUI.Actions>
</ToolUI>

3 つのコンポーネントはアクション中心の例外です — それらは兄弟サーフェスの代わりに組み込みアクションプロップを保持します。3 つすべてが統一インターフェースを共有:

  • actions: コンポーネントによってレンダリングされるアクションボタン。
  • onAction(actionId, state): アクション後に実行され、アクション後の状態を受け取ります。
  • onBeforeAction(actionId, state): アクション実行前に評価されるガード。
コンポーネントハンドラーに渡される状態型
OptionListOptionListSelection
ParameterSliderSliderValue[]
PreferencesPanelPreferencesValue

複合パターンを使用するコンポーネント: CodeBlockCodeDiffTerminalProgressTracker

コンテキストは createContext + use()(React 19)を経由して共有されます。サブコンポーネントは Root の外で使用された場合はスローします。

領収と選択の慣例

結果を持つコンポーネントは、確認/完了状態をレンダリングするために choice プロップを使用します:

コンポーネントchoice値 / 形状
ApprovalCard"approved" | "denied"文字列リテラル
OptionListstring | string[]選択されたオプション ID
OrderSummaryOrderDecision{ action: "confirm", orderId?, confirmedAt? }
ProgressTrackerToolUIReceipt{ outcome, summary, identifiers?, at }(共有型)

choice が存在する場合、コンポーネントは領収モードでレンダリングされます — 読み取り専用、アクションなし。

運用規則

  • リクエストを解決する最小限のコンポーネントセットをインストールします。
  • すべてのツールに description が必要; モデル向けに書いてください(いつ呼び出すか、どの役割か)— コンポーネントがレンダリングするコンテンツを繰り返さないこと。

注釈:

  • フロントエンドツールは execute 関数が必要

  • バックエンドツールはサーバー側にツール実装があります。

  • バックエンドツールはどちらも必要ありません

  • 生成されたファイルは無視してください

  • セットアップ後:

  • 変更後の実行の最初の経験が魔法的になるよう、必要なパッケージ依存関係がインストールされていることを確認してください

  • 実装されたばかりの機能の成功した実行に必要な env 変数(ほとんどの場合は api チャットエンドポイントに必要な変数)が設定されていない場合は、ユーザーに通知してください。

ライセンス: MIT(寛容ライセンスのため全文を引用しています) · 原本リポジトリ

詳細情報

作者
assistant-ui
リポジトリ
assistant-ui/tool-ui
ライセンス
MIT
最終更新
不明

Source: https://github.com/assistant-ui/tool-ui / ライセンス: MIT

関連スキル

汎用ソフトウェア開発⭐ リポ 39,967

doubt-driven-development

重要な判断はすべて、本番環境への展開前に新しい視点から対抗的レビューを実施します。速度より正確性が重要な場合、不慣れなコードを扱う場合、本番環境・セキュリティに関わるロジック・取り消し不可の操作など影響度が高い場合、または後でバグを修正するよりも今検証する方が効率的な場合に活用してください。

by addyosmani
汎用ソフトウェア開発⭐ リポ 1,175

apprun-skills

TypeScriptを使用したAppRunアプリケーションのMVU設計に関する総合的なガイダンスが得られます。コンポーネントパターン、イベントハンドリング、状態管理(非同期ジェネレータを含む)、パラメータと保護機能を備えたルーティング・ナビゲーション、vistestを使用したテストに対応しています。AppRunコンポーネントの設計・レビュー、ルートの配線、状態フローの管理、AppRunテストの作成時に活用してください。

by yysun
OpenAIソフトウェア開発⭐ リポ 797

desloppify

コードベースのヘルスチェックと技術負債の追跡ツールです。コード品質、技術負債、デッドコード、大規模ファイル、ゴッドクラス、重複関数、コードスメル、命名規則の問題、インポートサイクル、結合度の問題についてユーザーが質問した場合に使用してください。また、ヘルススコアの確認、次の改善項目の提案、クリーンアップ計画の作成をリクエストされた際にも対応します。29言語に対応しています。

by Git-on-my-level
汎用ソフトウェア開発⭐ リポ 39,967

debugging-and-error-recovery

テストが失敗したり、ビルドが壊れたり、動作が期待と異なったり、予期しないエラーが発生したりした場合に、体系的な根本原因デバッグをガイドします。推測ではなく、根本原因を見つけて修正するための体系的なアプローチが必要な場合に使用してください。

by addyosmani
汎用ソフトウェア開発⭐ リポ 39,967

test-driven-development

テスト駆動開発により実装を進めます。ロジックの実装、バグの修正、動作の変更など、あらゆる場面で活用できます。コードが正常に動作することを証明する必要がある場合、バグ報告を受けた場合、既存機能を修正する予定がある場合に使用してください。

by addyosmani
汎用ソフトウェア開発⭐ リポ 39,967

incremental-implementation

変更を段階的に実施します。複数のファイルに影響する機能や変更を実装する場合に使用してください。大量のコードを一度に書こうとしている場合や、タスクが一度では完結できないほど大きい場合に活用します。

by addyosmani
本サイトは GitHub 上で公開されているオープンソースの SKILL.md ファイルをクロール・インデックス化したものです。 各スキルの著作権は原作者に帰属します。掲載に問題がある場合は info@alsel.co.jp または /takedown フォームよりご連絡ください。
原作者: assistant-ui · assistant-ui/tool-ui · ライセンス: MIT