generative-ui
ما الذي تفعله
تشرح هذه المهارة كيف يستطيع الوكيل عرض واجهة تفاعلية مضمّنة داخل المحادثة، مبنية من Alpine.js وTailwind في بيئة معزولة. تغطي عناصر التحكم لمرة واحدة والتطبيقات المصغرة المحفوظة. وهي مخصصة للأشخاص الذين يريدون مساعدات تفاعلية سريعة داخل الحوار.
متى تستخدمها
- ✓عندما تريد عنصر تحكم سريعاً مثل شريط منزلق أو منتقٍ أو آلة حاسبة داخل المحادثة.
- ✓عندما تفيد المحادثة معاينة أو رسماً بيانياً مؤقتاً.
- ✓عندما يجب حفظ أداة مفيدة حتى تستطيع فتحها لاحقاً.
رابط المهارة
https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/generative-ui/SKILL.mdانسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.
طريقة الاستخدام
أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.
رسالة جاهزة للصق
لـ Claude Code أو Codex أو Cursor: شغّله داخل مجلد مشروعك وستُثبَّت المهارة.
نزّل ملف SKILL.md وضعه في مجلد مهارات وكيلك.
مثال على ما تطلبه من الذكاء الاصطناعي
“هل يمكنك أن تعطيني شريطاً منزلقاً في هذه المحادثة أستطيع به تغيير السعر، فيتحدث الإجمالي تلقائياً؟”
5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.
كيف تعمل
يعرض الوكيل عنصر تحكم صغيراً معزولاً في 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-extensionfor one-off UI that belongs only in the current chat: knobs, controls, pickers, calculators, temporary charts, and previews. - Use
create-extensionwhen the UI should be saved, reusable, or visible in the Extensions view. It also renders inline after creation. - Use
show-extension-inlineto reopen a saved extension inside chat. - Use
update-extensionto 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/dbExeconly for known existing SQL tables when no action fits. - Use
extensionFetchfor 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-borderbg-card,text-card-foregroundbg-primary,text-primary-foregroundtext-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
- آخر تحديث
- 2/11/2026
التعليقات
- …
المزيد من المهارات من هذا المستودع
design-exploration
7.6kيساعد وكيلك على استكشاف عدة اتجاهات تصميم لواجهة المستخدم جنباً إلى جنب، ثم تختار أنت واحداً، ويحسّن الوكيل التصميم المختار.
visual-edit
7.6kيساعد وكيلك على فتح تطبيق محلي يعمل في محرر مرئي، لتراجع شاشاته الحقيقية وتحررها معاً.
turn-into-app
7.6kيحوّل سير عمل أو جدول بيانات أو مشروعاً إلى تطبيق مرئي مصقول، فيه شاشات مملوءة بالبيانات ووكيل يعمل خلف أدوات التحكم.
visual-plan
7.6kيحوّل خطة نصية عادية إلى خطة مرئية تفاعلية فيها مخططات وخرائط ملفات ومقتطفات كود وأسئلة مفتوحة.
مهارات مشابهة
canvas
394kيتيح لوكيلك عرض أداة مرئية مستضافة على لوحة Mac متصلة، ثم إخفاء اللوحة أو نقلها إلى صفحة أخرى.
control-ui
394kيساعد وكيلك على تنظيم واجهة OpenClaw Control UI واستكشاف أخطائها، بما في ذلك الجلسات ولوحات المعلومات وبوابات Gateway المتصلة.
diagram-maker
394kيساعد وكيلك على إنشاء مخططات واضحة بصيغة SVG أو HTML أو Excalidraw قابلة للتعديل، للعمليات وبنية الأنظمة والرسومات على السبورة.