本文へスキップ
Skillpedia
インターフェース(UI/UX)7.6k · #13162

generative-ui

できること

このスキルは、エージェントがチャット内に対話型の画面部品を表示する方法を説明します。部品は、隔離されたAlpine.jsとTailwindで作られます。一時的な操作部品と、保存して後から開けるミニアプリの両方を扱います。会話の中で手軽に使える操作部品が欲しい人向けです。

使う場面

  • ✓スライダー、選択肢、計算機などの簡単な操作部品をチャット内で使いたいとき。
  • ✓会話を助けるために、一時的なグラフやプレビューが役立つとき。
  • ✓役に立つ部品を保存して、後で開き直したいとき。

スキルのリンク

https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/generative-ui/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/generative-ui/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“このチャットでスライダーを表示して、価格を変えると合計が更新されるようにしてもらえますか。”

毎週5つの新しいスキル。1分で読めます。

仕組み

エージェントは、隔離されたHTMLの小さな操作部品をチャット内に表示します。部品の値は次のやり取りでエージェントに渡せます。保存した版は後で開き直せます。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Generative UI

Generative UI is sandboxed Alpine.js HTML rendered inline in chat. It is not a source-code change and does not go through Builder.

Pick the Lifetime

  • Use render-inline-extension for one-off UI that belongs only in the current chat: knobs, controls, pickers, calculators, temporary charts, and previews.
  • Use create-extension when the UI should be saved, reusable, or visible in the Extensions view. It also renders inline after creation.
  • Use show-extension-inline to reopen a saved extension inside chat.
  • Use update-extension to edit an existing saved extension.

Inputs From Chat

Pass initial values through the action context argument. The iframe reads them from window.slotContext and can subscribe to changes with window.onSlotContext(fn).

<script>
  Alpine.data("controls", () => ({
    threshold: 50,
    init() {
      this.threshold = Number(window.slotContext?.threshold ?? 50);
      window.onSlotContext?.((ctx) => {
        if (ctx.threshold !== undefined) {
          this.threshold = Number(ctx.threshold);
        }
      });
    },
  }));
</script>

Outputs To The Agent

Use passive output when a control's current value should be visible to the agent on the next turn without requiring a submit click:

<input
  type="range"
  min="0"
  max="100"
  x-model.number="threshold"
  @input="agentNative.ui.output({ threshold }, { label: 'Threshold' })"
/>

agentNative.ui.output(value, opts?) writes application state at:

inline-ui:<extensionId>:output

The id is scoped automatically; the HTML author must not pass it. When the user says "use that value", "apply the current setting", or "run it with the current selection", read the value with:

const output = await readAppState("inline-ui:<id>:output");

The stored payload includes value, updatedAt, extensionId, and source: "inline-ui", plus optional label, context, or meta.

Use agentNative.chat.send(message, opts?) or sendToAgentChat(message, opts?) for a visible Apply/Submit button that should send a prompt or selected value into the chat. Pass { submit: true } explicitly for that user-triggered action; extension messages are draft-only otherwise. Never call these helpers from polling, refresh, or error handlers.

App Data And State

  • Prefer appAction(name, params) for template data and operations.
  • Use appFetch(path, options) only for allowed framework endpoints under /_agent-native/*, including application-state reads and writes.
  • Do not call template /api/* routes from generated UI.
  • Use dbQuery/dbExec only for known existing SQL tables when no action fits.
  • Use extensionFetch for external APIs through the sandbox proxy and secrets.

Transient extensionData Boundary

For saved extensions, extensionData uses the authenticated database-backed extension data API.

For transient inline UIs, extensionData is host localStorage. The agent cannot read it, it does not sync across devices, it does not migrate when a UI is promoted to a saved Extension, and the server does not garbage-collect it. Use it only for throwaway local UI state.

For anything the agent or app must observe, use agentNative.ui.output, application state through appFetch, an appAction, or agentNative.chat.send.

Styling

Use semantic Tailwind classes so the iframe inherits the parent app theme:

  • bg-background, text-foreground, border-border
  • bg-card, text-card-foreground
  • bg-primary, text-primary-foreground
  • text-muted-foreground, bg-accent

Do not hardcode provider tokens, private data, or internal secrets in generated HTML. Do not call an LLM directly from the iframe; route AI work through the agent chat.

よくある質問

これはアプリのコードの変更ですか?

いいえ。チャット内の表示であり、アプリのソースコードは変更されません。

エージェントは、部品で私が設定した値を見られますか?

はい。送信ボタンを押さなくても、値を受動的な情報としてエージェントに渡せます。

一時的な部品と保存した部品の違いは何ですか?

一時的な部品は現在のチャットにだけ存在します。保存した部品は再利用でき、拡張機能の画面にも表示されます。

詳細

作者による元の説明

Generate transient or saved inline chat UI with Alpine/Tailwind controls, outputs, app state, and extensions. Use for knobs, pickers, calculators, dashboards, widgets, or reusable mini-apps.

repo: BuilderIO/agent-native

人気

GitHubのスター
7.6k
ランキング
#13162
ライセンス
MIT
更新日
2026/11/2

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル