Anybox plugin development

From fanfan-de/anybox · View interactive version

Anybox plugin development is an AI agent skill from the GitHub repository fanfan-de/anybox. 创建、审查或验证 Anybox 第三方插件包。Use when the user asks to make a plugin, convert an API/SaaS/local tool into an installable plugin, write plugin.json, add plugin MCP servers, add bundled plugin skills, define plugin-owned connectors with API key or OAuth credentials, package plugin metadata, or debug plugin

How to use this skill

Skill file

Anybox 插件开发

使用这个 skill 来为当前仓库的插件运行时创建插件包。遇到文档和代码不一致时,以运行代码为准。

参考来源:

工作流

  1. 明确插件能力:MCP 工具、随包 skill、插件自带 connector,或平台 connector requirement。
  2. 选择插件包结构。默认使用 Codex-like 展开目录。
  3. 编写 .anybox-plugin/plugin.json,必须是严格 JSON,只使用运行时支持的顶层字段。
  4. 在插件根目录添加运行文件,例如 skills/、connectors/、scripts/、docs/ 和 assets/。
  5. 使用 Plugin.listCatalog() 验证 catalog 能发现插件。
  6. 更新内置仓库时运行 pnpm plugins:index,不要手改或把它当成正式生产目录。
  7. 如果修改了插件系统或分发代码,运行 pnpm plugins:catalog:test 和 bun test Test/plugin.test.ts。

插件包结构

新插件默认使用这个结构:

<install-root>/
  <plugin-id>/
    .anybox-plugin/
      plugin.json
    skills/
      <skill-name>/
        SKILL.md
    connectors/
    scripts/
    docs/
    assets/

注意:

Manifest 规则

最小 manifest:

{
  "name": "my-plugin",
  "version": "0.1.0",
  "description": "My first Anybox plugin."
}

支持的顶层字段包括:

未知顶层字段会被拒绝。

使用 interface 配置 catalog 展示信息:

{
  "interface": {
    "displayName": "Hello Anybox",
    "shortDescription": "A minimal plugin for learning plugin development.",
    "longDescription": "This plugin demonstrates a local stdio MCP server and a bundled Agent skill.",
    "developerName": "Your Name",
    "category": "Automation",
    "capabilities": ["demo", "mcp"],
    "logo": "HA",
    "brandColor": "#2563EB"
  }
}

优先使用已知 catalog 分类:Code、Browser、Git、Database、Docs、Automation 和 Design。

能力模式

不需要独立连接状态或凭据生命周期的工具,使用 mcpServers:

{
  "mcpServers": [
    {
      "id": "hello",
      "name": "Hello Anybox",
      "risk": "low",
      "permissions": ["Starts a local Node.js MCP server bundled with this plugin."],
      "tools": [
        {
          "name": "hello_echo",
          "title": "Echo Text",
          "description": "Echo text back to the user.",
          "readOnly": true
        }
      ],
      "runtime": {
        "transport": "stdio",
        "command": "node",
        "args": ["${PLUGIN_ROOT}/scripts/server.js"],
        "cwd": "${PLUGIN_ROOT}",
        "timeoutMs": 10000
      }
    }
  ]
}

插件需要给 Agent 提供说明时,使用 skills:

{
  "skills": "skills"
}

声明的 skill root 下,每个直接子目录都必须包含 SKILL.md。例如 skills/review/SKILL.md 会生成 plugin:<plugin-id>:review。

插件需要自带 API key 或 OAuth 状态时,使用 connectors:

{
  "connectors": [
    {
      "id": "weather",
      "name": "Weather",
      "risk": "medium",
      "permissions": ["Sends requests to api.weather.example."],
      "credential": {
        "kind": "api_key",
        "key": "WEATHER_API_KEY",
        "label": "Weather API key",
        "type": "password",
        "required": true,
        "secret": true
      },
      "runtime": {
        "transport": "stdio",
        "command": "node",
        "args": ["${PLUGIN_ROOT}/connectors/weather/server.js"],
        "cwd": "${PLUGIN_ROOT}",
        "env": {
          "WEATHER_API_KEY": "${WEATHER_API_KEY}"
        }
      },
      "tools": [
        {
          "name": "weather_current",
          "title": "Current Weather",
          "description": "Read current weather for a city.",
          "readOnly": true
        }
      ]
    }
  ]
}

插件要复用平台已有能力时,使用 connectorRequirements,例如 browser、GitHub 或 workspace files。

Runtime 规则

验证

对候选插件来源根目录运行:

cd C:\Projects\anybox\packages\anyboxagent
$env:ANYBOX_PLUGIN_LOCAL_DIR = "C:\path\to\plugin-source-root"
$env:ANYBOX_PLUGIN_REGISTRY_INDEX_URL = "off"
bun -e "import * as Plugin from './src/plugin/plugin.ts'; console.log(JSON.stringify(await Plugin.listCatalog(), null, 2))"

确认输出里包含插件 ID、生成的 MCP server ID、connector-backed MCP server ID 和随包 skill ID。

修改插件系统运行时代码后运行:

cd C:\Projects\anybox
pnpm plugins:index:check
pnpm plugins:catalog:test

cd C:\Projects\anybox\packages\anyboxagent
bun test Test/plugin.test.ts

准备正式仓库目录时,先提交插件源码,再在仓库根目录运行 pnpm plugins:catalog:prepare 和 pnpm plugins:catalog:verify。随后只需把 .catalog/ 作为普通 Git 变更提交并推送;不要调用 GitHub Actions、Release 或 API。

若插件有独立的生产打包门禁,可在自身 package.json 同时声明 anyboxCatalog.releaseArchive(支持 {version})与 anyboxCatalog.releaseAttestation,先产出经过验证的 ZIP。目录工具只读取并验证该 ZIP,不会执行插件自带构建脚本;内嵌 manifest 必须与源码一致,且 production attestation 必须覆盖每个声明的原生 helper。validation/unsigned 包会被拒绝。

常见失败

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.