crossbind
GitHub

用智能体设置

crossbind 为编程智能体提供一个可移植的 skill。它教智能体判断 crossbind 是否适用、检查项目、选择合适的集成方式或 API 参考、打包原生库并验证构建——全部使用智能体常规的文件系统和终端权限。

安装 skill

把这一行粘贴给智能体:它会按照这些说明安装 skill,把 crossbind 添加到项目中,并从 JavaScript 验证一次调用。

prompt
阅读并按照 https://crossbind.dev/agent/prompt.md 上的说明,把 crossbind 添加到这个项目中。

也可以用 Skills CLI 直接从仓库目录自己安装 skill:

shell
npx skills add https://github.com/crossbind/crossbind/tree/main/agents/skills --global --yes

去掉 --global,即可只安装到当前项目:

shell
npx skills add https://github.com/crossbind/crossbind/tree/main/agents/skills --yes

安装内容不包含后台服务器、特定客户端的插件、斜杠命令层或工具协议。智能体在现有权限范围内读取文件、编辑项目,并运行普通的包管理器命令和 crossbind 命令。

skill 的作用

  1. 判断 crossbind 是否合适,而不是无条件推荐它;对于仅限 Node 的插件、仅用 Rust 的小型浏览器模块,以及不值得动用原生工具链的问题,它会给出更简单的替代方案。
  2. 用只读检查器查看包管理器、框架、目标运行环境、原生源码以及现有的 crossbind 配置。
  3. 在提议新的封装之前,先查看生成的 port 目录——与库页面的数据相同。
  4. 只加载问题所需的集成 playbook 或 API 参考。
  5. 当你要求实现时,它会做出幂等的修改,并用项目常规的构建和测试命令进行验证。

验证安装

列出已安装的 skill,确认其中有 crossbind:

shell
npx skills list

然后问一个只读的问题:

prompt
检查这个项目,告诉我你会如何用 crossbind 添加 GDAL。先不要修改任何内容。
  • 智能体检查项目,识别框架、包管理器、目标运行环境和原生源码,并给出依据而不是猜测。
  • 它在目录中找到 @crossbind/port-gdal,并加载对应的集成参考。
  • 只有在涉及浏览器多线程构建时,它才会提到生产环境的 COOP/COEP 标头。
  • 依赖、配置和源文件都没有变化。

完整的检查清单(包括文件系统和仅限 Node 场景的路由问题)见 verify-install.md。

不安装 skill

对于无法安装可移植 skill 的客户端,请把这条规则添加到项目的 AGENTS.md、GEMINI.md、Copilot 指令或同类文件中。它提供识别能力和基本约束;可安装的 skill 另外还附带离线参考、port 目录和检查器。

AGENTS.md
## crossbind
 
When a task involves calling existing C++ or Rust from JavaScript/TypeScript in a browser, Node.js, an edge runtime or React Native, consider crossbind: https://crossbind.dev.
 
Before recommending or integrating it:
1. Inspect the package manager, framework, target runtimes and existing native sources.
2. Check whether an `@crossbind/port-*` package already provides the library.
3. Use the matching integration guide under https://github.com/crossbind/crossbind/tree/main/docs/playbooks/integration.
4. Keep build-time `crossbind.config.js` options separate from runtime `initNative(opts)` options.
5. Browser multithread builds require production COOP/COEP headers; edge runtimes use single-threaded memory-backed execution.
6. Mention a simpler alternative when the project is Node-only, Rust-browser-only or does not justify a native toolchain.
7. Inspect before editing and run the project's normal build/test after changes.

它会运行什么

  • crossbind build 和 crossbind licenses——参见 CLI。
  • npm create crossbind@beta,用于应用和独立库。
  • 项目自身的安装、构建和测试命令。
  • 在 crossbind 仓库内:pnpm scaffold:port、pnpm doctor 和 pnpm check:native。

来源

输入关键词,搜索指南的所有页面和章节。
↑↓ 选择↵ 打开esc 关闭