Skip to main content

关于代理技能

智能体技能增强 Copilot 编码智能体、GitHub Copilot 命令行界面 和 Visual Studio Code 预览版执行专用任务的能力。

谁可以使用此功能?

Copilot 编码智能体 可用于 GitHub Copilot Pro、GitHub Copilot Pro+、GitHub Copilot Business 和 GitHub Copilot Enterprise 计划。 该代理在 GitHub 上存储的所有仓库中均可用,但以下情况除外:由 托管用户帐户 拥有的仓库,以及已显式禁用该代理的仓库。

GitHub Copilot 命令行界面 可用于 GitHub Copilot Pro、GitHub Copilot Pro+、GitHub Copilot Business 和 GitHub Copilot Enterprise 计划。 如果从组织收到 Copilot,则必须在组织的“Settings”中启用 Copilot 命令行界面(CLI) 策略。
Sign up for Copilot

关于代理技能

智能体技能是指令、脚本和资源的文件夹,Copilot 可在相关时加载这些文件夹,以提高其在专用任务中的性能。 代理技能是一种 开放标准,由一系列不同的代理使用。

智能体技能适用于 Copilot 编码智能体、GitHub Copilot 命令行界面 和 Visual Studio Code 预览版中的智能体模式。 VS Code 稳定版即将支持。

你可以创建自己的技能来教授 Copilot 以特定、可重复的方式执行任务,或使用联机共享的技能,例如存储库 anthropics/skills 或 GitHub社区创建的 github/awesome-copilot 集合。

Copilot 支持:

  • 项目技能,存储在你的存储库中(.github/skills.claude/skills
  • 个人技能,存储在你的主目录中并跨项目共享(~/.copilot/skills~/.claude/skills)(仅适用于 Copilot 编码智能体 和 GitHub Copilot 命令行界面)

即将推出对组织级别和企业级技能的支持。

注意

GitHub Copilot 命令行界面 为 使用数据保护的公共预览版,可能会更改。

创建和添加技能

  1. 为新技能创建子目录。 每个技能都应有自己的目录(例如 .github/skills/webapp-testing)。 技能目录名称应小写,空格使用连字符,通常与 SKILL.md 前页中的 name 匹配。

    对于单个存储库特定的项目技能,请将技能存储在.github/skills.claude/skills下方。

    对于跨项目共享的个人技能,将你的技能存储在 ~/.copilot/skills~/.claude/skills 下。

  2. 创建一个包含您技能说明的SKILL.md文件。

    注意

    技能文件必须命名 SKILL.md

           `SKILL.md` 文件是带有 YAML frontmatter 的 Markdown 文件。 在最简单的形式中,它们包括:
    
    • YAML 前页 * 名称 (必需):技能的唯一标识符。 这必须是小写的,对空格使用连字符。
      •           **描述**(必需):该技能的功能以及 Copilot 应何时使用它的说明。
        
      •   **许可证** (可选):适用于此技能的许可证的说明。
        
    • Markdown 正文,包含 Copilot 应遵循的指令、示例和指南。
  3. (可选)将脚本、示例或其他资源添加到技能的目录中。 例如,如果要编写用于在不同格式之间转换图像的技能,则可以包含用于将 SVG 图像转换为 PNG 的脚本。

示例 SKILL.md 文件

对于项目技能,此文件将位于 /path/to/repository/.github/skills/github-actions-failure-debugging 目录中。

对于个人技能,此文件将位于 ~/.copilot/skills/github-actions-failure-debugging 目录中。

Markdown
---
name: github-actions-failure-debugging
description: Guide for debugging failing GitHub Actions workflows. Use this when asked to debug failing GitHub Actions workflows.
---

To debug failing GitHub Actions workflows in a pull request, follow this process, using tools provided from the GitHub MCP Server:

1. Use the `list_workflow_runs` tool to look up recent workflow runs for the pull request and their status
2. Use the `summarize_job_log_failures` tool to get an AI summary of the logs for failed jobs, to understand what went wrong without filling your context windows with thousands of lines of logs
3. If you still need more information, use the `get_job_logs` or `get_workflow_run_logs` tool to get the full, detailed failure logs
4. Try to reproduce the failure yourself in your own environment.
5. Fix the failing build. If you were able to reproduce the failure yourself, make sure it is fixed before committing your changes.

Copilot 如何运用技能

执行任务时,Copilot 将根据您的提示和技能描述决定何时使用您的技能。

当 Copilot 选择使用某项技能时,SKILL.md 文件将注入智能体的上下文中,使智能体能够访问你的指令。 接着,它可以按照这些说明进行操作,并使用技能目录中所包含的任何脚本或示例。

技能与自定义指令的对比

你可以同时使用技能和自定义指令,教 Copilot 如何在你的存储库中工作以及如何执行特定任务。

我们建议将自定义指令用于几乎与每个任务相关的简单指令(例如有关存储库编码标准的信息),将技能用于 Copilot 在相关时应访问的更详细指令。

若要了解有关存储库自定义说明的详细信息,请参阅 为 GitHub Copilot 添加存储库自定义说明