extensions
它能做什么
这项技能说明如何创建、编辑和管理扩展,即在 iframe 中显示的小型沙盒 Alpine.js 迷你应用。它包含带有辅助函数的参考页面和示例。适合希望在自己控制的应用中加入自定义模块的构建者。
适用场景
- ✓当宿主应用允许扩展,且用户要求一个一次性自定义模块的时候。
- ✓当你想要一个小型迷你应用,例如状态小组件或快速笔记面板的时候。
- ✓当你需要在扩展中可用的确切辅助函数的时候。
技能链接
https://github.com/BuilderIO/agent-native/blob/main/.agents/skills/extensions/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“你能做一个小型扩展,显示我们 API 的状态,并每分钟刷新一次吗?”
每周 5 个新技能,1 分钟读完。
工作原理
智能体编写一个带有 Alpine.js 和 Tailwind 类的小型 HTML 文件。它使用提供的辅助函数获取或保存数据,结果在沙盒框架中运行。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Extensions
Terminology note. This skill is about extensions — the framework's user-authored mini-app primitive (sandboxed Alpine.js HTML rendered in an iframe). It is NOT the same thing as LLM "tools", which are the function-calling primitives the AI agent uses (actions, MCP tools, etc.). Other skills still talk about "the agent calls actions as tools" — that's the LLM concept and stays as-is. When this doc says "tool" without qualification, it means LLM tool. When it says "extension", it means the sandboxed mini-app.
Historical naming: extensions were previously called "tools". The physical SQL table names (
tools,tool_data,tool_shares) and a few legacy in-iframe globals (toolFetch,toolData) are kept for back-compat — see the back-compat table inreferences/api.md.
References
references/api.md— the exhaustive helper/global tables (appAction,appFetch,dbQuery,dbExec,extensionFetch,extensionData), secrets, Tailwind classes, sharing, navigation, routes, and the full back-compat naming table. Read this when you need the precise signature, scope option, or route for any helper.references/examples.md— five worked HTML extensions (API status dashboard, weather widget, todo list withextensionData, quick notes). Read this when you want a complete copy-pasteable starting point.
CRITICAL: What Extensions Are (and Are Not)
An Extension is a self-contained Alpine.js HTML snippet stored in the
SQL tools table (table name kept for back-compat; the Drizzle export is
extensions). It runs inside a sandboxed iframe with its own Tailwind CSS
and Alpine.js runtime.
Extensions are NOT:
- React components
- New source code files
- Database schema changes
- Action files in
actions/ - Routes
When the Request Needs Code Instead
Route by the user's exact outcome, not by whether they called it an
"extension." Extensions render only on their own page or inside an existing
named ExtensionSlot; they cannot inject UI into arbitrary native components,
replace built-in views, or appear at a location where the host app has no slot.
If the requested placement or behavior requires changing native components, host layout/styles/routes/business logic, or adding a new slot:
- Briefly explain the extension boundary.
- Do not stop at "an extension cannot do that," and do not silently move the UI to a less useful slot.
- Continue through the normal source-code customization flow:
- In hosted/app-rendered chat, call
connect-builder. When itsbuilderEnabledresult is true, offer the Builder.io Cloud Agent handoff; when false, say the change can be made with local code editing, Agent Native Desktop, or Builder.io cloud editing. - In a local development or outer code-editing surface, follow the
self-modifying-codeskill and edit the app source directly.
- In hosted/app-rendered chat, call
Full source-code customization is a core Agent-Native capability. Extensions are an optional, sandboxed, no-deploy patch layer—not the limit of what the app can become. Most apps keep extension creation disabled; do not offer or create one unless the host app has explicitly opted in.
Use this decision rule when either path could solve the request:
- Start with native app behavior or app code. Use an extension only when the app opted in, the user explicitly wants a bespoke one-off block, and an existing extension surface fits the requested placement.
- Use app code for a core template feature, native UI/layout/routes/business logic, a new slot, or behavior that should be reused across dashboards or users.
- Treat an extension as an agent-authored patch. Make that provenance clear, preserve it while promoting, and use Promote to app code when the behavior becomes durable. Do not imply that promotion is a lossless mechanical conversion.
As a rule of thumb, default to app code. In Analytics, an explicitly requested one-off custom visualization can be a Custom Block; a new chart type that should be available across dashboards belongs in the template code.
When a user asks to "make an extension", "create an extension", or "build a ... extension" (or the older phrasings "make a tool" / "create a tool"):
- Write the Alpine.js HTML
- Call
create-extensionwith the HTML ascontent - That's it — no files to create, no schema changes, no actions
Extensions have full access to app data via helpers injected into
常见问题
什么是扩展?
它是一个在应用内沙盒框架中运行的小型迷你应用,使用 HTML 和 Alpine.js 编写。
扩展与 AI 工具一样吗?
不一样。技能说明扩展是用户构建的迷你应用,而工具是 AI 使用的函数调用。
我可以看到示例吗?
可以。技能包含五个完整示例,例如状态仪表板和快速笔记应用。
详情
作者的原始描述
Creating, editing, and managing extensions — sandboxed Alpine.js mini-apps that run inside iframes. Use only when the host app explicitly enables extensions and the user asks for a one-off custom block or mini-app. Distinct from LLM "tools" (function calls) — see note below.
repo: BuilderIO/agent-native
热度
- GitHub 星标
- 7.6k
- 排名
- #13157
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …