Aller au contenu
Skillpedia
Interfaces (UI/UX)7.6k · #13162

generative-ui

Ce qu’il fait

Cette compétence explique comment un agent peut afficher une interface interactive intégrée à la discussion, construite avec Alpine.js et Tailwind dans un bac à sable. Elle couvre les commandes ponctuelles et les mini-applications enregistrées. Elle s'adresse aux personnes qui veulent des outils interactifs rapides dans une conversation.

Quand l’utiliser

  • ✓Quand vous voulez une commande rapide comme un curseur, un sélecteur ou une calculatrice dans la discussion.
  • ✓Quand un graphique ou un aperçu temporaire aiderait la conversation.
  • ✓Quand un widget utile doit être enregistré pour pouvoir être rouvert plus tard.

Lien du skill

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

Copiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.

Comment l’utiliser

Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.

Message prêt à coller

Utilise ce skill pour m’aider : https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/generative-ui/SKILL.md Lis le fichier SKILL.md de ce lien et suis ses instructions pour ma tâche.
Envie que votre IA trouve seule des skills comme celui-ci ?Installez le MCP gratuit de Skillpedia : une ligne, et elle cherche parmi 15 000+ skills avant chaque tâche.Installer en 1 minute →

Exemple de demande à votre IA

“Peux-tu me mettre un curseur dans cette discussion qui me permette de modifier le prix et de voir le total se mettre à jour ?”

5 nouveaux skills par semaine. 1 minute de lecture.

Comment ça marche

L'agent affiche une petite commande HTML dans un bac à sable directement dans la discussion. Ses valeurs peuvent être renvoyées à l'agent au tour suivant, et une version enregistrée peut être rouverte plus tard.

Contenu technique (SKILL.md original)

Texte original de l’auteur, en anglais, directement depuis 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.

Questions fréquentes

Est-ce une modification du code de mon application ?

Non. C'est une interface intégrée à la discussion, qui ne change pas le code source de l'application.

L'agent voit-il ce que j'ai réglé dans la commande ?

Oui. Les valeurs peuvent être transmises à l'agent comme sortie passive, sans clic sur un bouton d'envoi.

Quelle différence entre une interface ponctuelle et une interface enregistrée ?

L'interface ponctuelle n'existe que dans la discussion en cours, alors que l'interface enregistrée peut être réutilisée et apparaît dans la vue des extensions.

Détails

Description originale de l’auteur

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

Popularité

Étoiles GitHub
7.6k
Position au classement
#13162
Licence
MIT
Mis à jour
02/11/2026

Ce skill vous est-il utile ?

0

Connectez-vous pour voter.

Commentaires

  • …

Autres skills de ce dépôt

Skills similaires