老胡
发布于 2026-10-13 / 2 阅读
0
0

在 CodeBuddy 中安装 dotnet/skills 插件教程

一、概述

dotnet/skills(https://github.com/dotnet/skills)是 .NET 团队维护的一套面向 AI 编码助手的可移植技能(Skills)与自定义代理(Agents)集合。其内容遵循 agentskills.io 开放标准,并随仓库内置了 Claude Code 风格的插件清单,因此可在 CodeBuddy 中以插件模式直接安装。

仓库以**插件包(Plugin)**为单位组织,每个插件包位于 plugins/<名称>/ 目录下,结构如下:

plugins/<插件包>/
├── plugin.json          # 插件清单(name / version / description / skills 路径)
├── version.json
├── README.md
└── skills/              # 技能目录,每个子文件夹即一个技能
    └── <技能名>/
        └── SKILL.md     # 技能定义(CodeBuddy 据此自动发现并加载)

目前仓库包含 17 个插件包:dotnet、dotnet-ai、dotnet-aspnetcore、dotnet-blazor、dotnet-data、dotnet-diag、dotnet-experimental、dotnet-maui、dotnet-msbuild、dotnet-nuget、dotnet-template-engine、dotnet-test、dotnet-test-migration、dotnet-upgrade、dotnet-winforms、dotnet-advanced、dotnet11。

说明:CodeBuddy 默认继承 Claude Code 的插件模式,可直接识别仓库中的 plugin.json 清单。安装时只需将仓库打包为 zip,在 CodeBuddy 中选择该 zip 即可自动解析并逐一安装其中的插件。当前唯一已知问题是:各插件 plugin.json 中声明的 skills 路径会导致技能无法正常加载,需在安装前将其删除,改由 CodeBuddy 按 SKILL.md 自动发现(详见下文步骤二)。

二、前置条件

  1. 已安装 CodeBuddy(建议使用较新版本,以支持完整的插件加载)。
  2. 可访问 GitHub 以下载 dotnet/skills 仓库的 zip 包(或已通过 git clone 获取源码)。
  3. (可选)Python 3:用于在步骤二中批量清理 plugin.json 的 skills 字段。
  4. (可选).NET SDK:部分技能/代理在执行时会调用本地 dotnet 命令。

三、安装方式(插件模式)

步骤一:获取插件包(zip)

  • 方式 A(推荐):在 GitHub 仓库页面点击 Code ▸ Download ZIP,直接下载整个仓库压缩包。

  • 方式 B:若已本地克隆,可仅将 plugins/ 目录打包为 zip:

    git clone https://github.com/dotnet/skills.git
    cd dotnet/skills
    zip -r dotnet-skills-plugins.zip plugins/
    

步骤二:移除 plugin.json 中的 skills 路径(关键)

各插件的 plugins/<名称>/.claude-plugin/plugin.json 默认包含如下字段:

{
  "name": "dotnet-advanced",
  "version": "0.2.2",
  "description": "Advanced .NET and C# skills for niche scenarios that are not part of the core dotnet plugin.",
  "skills": ["./skills/"]
}

其中 "skills": ["./skills/"] 会令 CodeBuddy 无法正确加载技能。请删除该 skills 字段,使 CodeBuddy 自动按 SKILL.md 发现技能:

{
  "name": "dotnet-advanced",
  "version": "0.2.2",
  "description": "Advanced .NET and C# skills for niche scenarios that are not part of the core dotnet plugin."
}

可手动编辑,也可使用以下脚本对 plugins/ 下所有插件批量处理(需 Python 3):

cd dotnet/skills/plugins
python3 - <<'PY'
import json, glob, os
for f in glob.glob("*/plugin.json"):
    with open(f, encoding="utf-8") as fh:
        data = json.load(fh)
    data.pop("skills", None)          # 移除 skills 路径设置
    with open(f, "w", encoding="utf-8") as fh:
        json.dump(data, fh, indent=2, ensure_ascii=False)
        fh.write("\n")
print("已移除各插件 plugin.json 中的 skills 路径设置")
PY

处理完成后,重新将 plugins/ 打包为 zip(若使用方式 A,则解压原 zip、修改后重新压缩)。

步骤三:在 CodeBuddy 中以插件模式安装

  1. 打开 CodeBuddy,进入插件/扩展安装入口。
  2. 选择从本地安装 / 选择 zip 包之类的选项,选中上述 zip 文件。
  3. CodeBuddy 会自动解析 zip 中的插件(即 plugins/ 下的各个插件包),并逐一安装。
  4. 由于 CodeBuddy 默认继承 Claude Code 的插件模式,安装过程会直接读取各 plugin.json 清单,无需额外配置。

步骤四:验证安装

  1. 安装完成后,重新加载 CodeBuddy 窗口。
  2. 打开技能列表(如侧边栏的“技能”面板,或通过命令面板检索已加载技能),确认 .NET 相关技能已出现。
  3. 发起一个相关任务进行实测,例如:“分析这个 MSBuild 二进制日志(binlog)并定位构建失败原因”。当任务与已安装技能匹配时,CodeBuddy 会自动调用对应技能。

四、更新与维护

技能随上游仓库持续演进,更新步骤如下:

  1. 重新下载或拉取最新仓库,按步骤二再次清理 plugin.json 中的 skills 字段。
  2. 重新打包为 zip,并在 CodeBuddy 中选择该 zip 重新安装 / 覆盖。

如需回退或清理,在 CodeBuddy 插件管理中卸载对应插件,或直接删除相关插件目录即可,不影响其他配置。

五、注意事项

  • 插件模式兼容:CodeBuddy 复用 Claude Code 的插件规范,因此可直接消费 dotnet/skills 的 plugin.json 清单。
  • 必须清理 skills 字段:保留该字段会导致技能无法加载,这是当前插件模式下的唯一已知问题,请务必在打包前删除。
  • 作用域差异:插件安装通常对所有工作区生效,适合个人长期使用;如需团队共享,建议将修正后的 plugins/ 目录纳入团队内部制品并分发。
  • 代理文件说明:仓库中 agents/*.agent.md 等为 GitHub Copilot 自定义代理格式。CodeBuddy 当前主要按技能机制加载 SKILL.md;如需启用代理/工作流能力,请参考对应插件 README。
  • 许可:请遵循仓库 LICENSE 文件中的许可与贡献条款。

评论