Agent Skillsfanfan-de/anybox › anybox-plugin-development

anybox-plugin-development

GitHub

指导创建、审查和验证Anybox第三方插件包,包括编写plugin.json、配置MCP服务器与技能、管理连接器及调试安装问题。

.anybox/skills/anybox-plugin-development/SKILL.md fanfan-de/anybox

Trigger Scenarios

用户要求创建新插件或转换工具为插件 需要编写或验证plugin.json配置文件 调试插件目录发现或安装失败问题

Install

npx skills add fanfan-de/anybox --skill anybox-plugin-development -g -y
More Options

Non-standard path

npx skills add https://github.com/fanfan-de/anybox/tree/master/.anybox/skills/anybox-plugin-development -g -y

Use without installing

npx skills use fanfan-de/anybox@anybox-plugin-development

指定 Agent (Claude Code)

npx skills add fanfan-de/anybox --skill anybox-plugin-development -a claude-code -g -y

安装 repo 全部 skill

npx skills add fanfan-de/anybox --all -g -y

预览 repo 内 skill

npx skills add fanfan-de/anybox --list

SKILL.md

Frontmatter
{
    "name": "anybox-plugin-development",
    "description": "创建、审查或验证 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 catalog\/install\/diagnostic failures."
}

Anybox 插件开发

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

参考来源:

  • 完整指南:../../../docs/anybox-third-party-plugin-development.md
  • 运行时事实来源:../../../packages/anyboxagent/src/plugin/plugin.ts
  • 回归测试和示例:../../../packages/anyboxagent/Test/plugin.test.ts

工作流

  1. 明确插件能力:MCP 工具、随包 skill、插件自带 connector,或平台 connector requirement。
  2. 选择插件包结构。默认使用版本化目录。
  3. 编写 .anybox-plugin/plugin.json,必须是严格 JSON,只使用运行时支持的顶层字段。
  4. .anybox-plugin 同级添加运行文件,例如 skills/connectors/scripts/docs/assets/
  5. 使用 Plugin.listCatalog() 验证 catalog 能发现插件。
  6. 如果修改了插件系统运行时代码,运行 bun test Test/plugin.test.ts

插件包结构

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

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

注意:

  • <install-root> 是包含一个或多个插件包目录的父目录;开发新插件时优先把它作为 ANYBOX_PLUGIN_LOCAL_DIR
  • 当前运行时用 ANYBOX_PLUGIN_LOCAL_DIR 发现固定本地插件仓库,未设置时默认是 Agent data 目录下的 plugins/local。这个目录逻辑上等价于 GitHub 插件仓库,只提供可安装候选项,不受卸载流程删除。
  • ANYBOX_PLUGIN_INSTALL_DIR 是受管理安装根目录,用于网络下载或从本地仓库安装时复制出来的插件包。这里的插件逻辑上属于已安装插件,运行时使用这里的副本,卸载时可能删除对应插件包。
  • 运行时只读取 .anybox-plugin/plugin.json;新插件必须写 .anybox-plugin/plugin.json
  • skillsconnectorsscriptsdocsassets 应放在 .anybox-plugin 同级,不要放进 .anybox-plugin 里。
  • 插件 ID 使用稳定的小写名称。目录名和 manifest name 尽量保持一致。

Manifest 规则

最小 manifest:

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

支持的顶层字段包括:

  • nameversiondescription
  • authorhomepagerepositorylicensekeywords
  • interface
  • mcpServers
  • skills
  • connectorRequirements
  • connectors
  • apps,仅用于旧兼容
  • commandsagents,当前是保留字段

未知顶层字段会被拒绝。

使用 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 分类:CodeBrowserGitDatabaseDocsAutomationDesign

能力模式

不需要独立连接状态或凭据生命周期的工具,使用 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 规则

  • 所有 ${PLUGIN_ROOT} 路径都必须留在插件包内部。
  • stdio MCP server 的普通日志写 stderr。stdout 只能输出 JSON-RPC 消息。
  • 本地 MCP server 必须响应 initializetools/listtools/call
  • 只读工具标记 readOnly: true,破坏性操作标记 destructive: true
  • risk 使用 lowmediumhigh;不要使用 critical,除非插件安装应该被阻止。
  • 不要提交 API key、OAuth client secret、access token、refresh token、本地 auth store、数据库或缓存目录。

验证

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

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\packages\anyboxagent
bun test Test/plugin.test.ts

常见失败

  • 插件没有出现在 catalog:检查 ANYBOX_PLUGIN_LOCAL_DIR、目录结构、JSON 合法性、支持的顶层字段,以及必填的 nameversiondescription。只有验证下载/安装根目录时才检查 ANYBOX_PLUGIN_INSTALL_DIR
  • PLUGIN_CONFIG_INVALID:检查必填 configFields 或 OAuth client 设置。
  • 诊断没有发现工具:检查命令是否可执行、runtime 路径、cwd、JSON-RPC 方法处理,以及 stdout 是否混入普通日志。
  • Connector 未连接:API key connector 需要保存 key;OAuth connector 需要完成浏览器授权。
  • 卸载时源码被删:开发时使用 ANYBOX_PLUGIN_LOCAL_DIR。不要直接把 Git 源码根目录当成 ANYBOX_PLUGIN_INSTALL_DIR;如果必须验证受管理安装根,复制或构建到 dev-install 目录。

Version History

  • 08dc189 Current 2026-07-05 18:54

Same Skill Collection

.agents/skills/anybox-frontend-guidelines/SKILL.md
.agents/skills/anybox-mobile-release/SKILL.md
.agents/skills/anybox-plugin/SKILL.md
.agents/skills/deploy-anybox-tencent-docker-windows/SKILL.md
.agents/skills/deploy-anybox-tencent-server/SKILL.md
.agents/skills/fanfande-frontend-style/SKILL.md
.agents/skills/fanfande-plugin-structure/SKILL.md
.agents/skills/frontend-ui-style-kit/SKILL.md
.agents/skills/obsidian-like/SKILL.md
.agents/skills/pdf/SKILL.md
.agents/skills/transcribe/SKILL.md
.agents/skills/zhihu-md-publisher/SKILL.md
.anybox/skills/anybox-start-dev/SKILL.md
packages/chrome-plugin/runtime/skills/chrome/SKILL.md
plugins/Anybox-Plugins/anybox-plugin-development/skills/anybox-plugin-development/SKILL.md
plugins/Anybox-Plugins/atlassian-rovo/skills/capture-tasks-from-meeting-notes/SKILL.md
plugins/Anybox-Plugins/atlassian-rovo/skills/generate-status-report/SKILL.md
plugins/Anybox-Plugins/box/skills/box/SKILL.md
plugins/Anybox-Plugins/browser/skills/browser/SKILL.md
plugins/Anybox-Plugins/build-ios-apps/skills/ios-app-intents/SKILL.md
plugins/Anybox-Plugins/build-ios-apps/skills/ios-debugger-agent/SKILL.md
plugins/Anybox-Plugins/build-ios-apps/skills/ios-ettrace-performance/SKILL.md
plugins/Anybox-Plugins/build-ios-apps/skills/ios-memgraph-leaks/SKILL.md
plugins/Anybox-Plugins/build-ios-apps/skills/ios-simulator-browser/SKILL.md
plugins/Anybox-Plugins/build-ios-apps/skills/swiftui-liquid-glass/SKILL.md
plugins/Anybox-Plugins/build-ios-apps/skills/swiftui-performance-audit/SKILL.md
plugins/Anybox-Plugins/build-ios-apps/skills/swiftui-ui-patterns/SKILL.md
plugins/Anybox-Plugins/build-ios-apps/skills/swiftui-view-refactor/SKILL.md
plugins/Anybox-Plugins/build-macos-apps/skills/appkit-interop/SKILL.md
plugins/Anybox-Plugins/build-macos-apps/skills/build-run-debug/SKILL.md
plugins/Anybox-Plugins/build-macos-apps/skills/liquid-glass/SKILL.md
plugins/Anybox-Plugins/build-macos-apps/skills/packaging-notarization/SKILL.md
plugins/Anybox-Plugins/build-macos-apps/skills/signing-entitlements/SKILL.md
plugins/Anybox-Plugins/build-macos-apps/skills/swiftpm-macos/SKILL.md
plugins/Anybox-Plugins/build-macos-apps/skills/swiftui-patterns/SKILL.md
plugins/Anybox-Plugins/build-macos-apps/skills/telemetry/SKILL.md
plugins/Anybox-Plugins/build-macos-apps/skills/test-triage/SKILL.md
plugins/Anybox-Plugins/build-macos-apps/skills/view-refactor/SKILL.md
plugins/Anybox-Plugins/build-macos-apps/skills/window-management/SKILL.md
plugins/Anybox-Plugins/build-web-apps/skills/frontend-app-builder/SKILL.md
plugins/Anybox-Plugins/build-web-apps/skills/frontend-testing-debugging/SKILL.md
plugins/Anybox-Plugins/build-web-apps/skills/react-best-practices/SKILL.md
plugins/Anybox-Plugins/build-web-apps/skills/shadcn-best-practices/SKILL.md
plugins/Anybox-Plugins/build-web-apps/skills/supabase-best-practices/SKILL.md
plugins/Anybox-Plugins/canva/skills/canva-branded-presentation/SKILL.md
plugins/Anybox-Plugins/canva/skills/canva-resize-for-all-social-media/SKILL.md
plugins/Anybox-Plugins/canva/skills/canva-translate-design/SKILL.md
plugins/Anybox-Plugins/chrome/skills/chrome/SKILL.md
plugins/Anybox-Plugins/cinema/skills/initialize-cinema-project/SKILL.md

Metadata

Files
0
Version
b621dd3
Hash
4970cc07
Indexed
2026-07-05 18:54

Home - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-04 06:20
浙ICP备14020137号-1 $Map of visitor$