Skip to main content

Building Copilot skillsets

Learn the steps to build Github Copilot skillsets and integrate custom tools and functions into your Copilot environment.

Note

GitHub Copilot Extensions 为 公共预览版,可能随时更改。

Introduction

Github Copilot skillsets are a streamlined way to extend GitHub Copilot's functionality by defining API endpoints that Copilot can call. When you create a skillset, Copilot handles all the AI interactions while your endpoints provide the data or functionality. This guide walks you through configuring and deploying a skillset within your GitHub App.

Prerequisites

Before you begin, make sure you have the following:

  1. A configured GitHub App: You’ll need a GitHub App to act as the container for your skillset. If you haven’t already set one up, refer to "为 Copilot 扩展创建 GitHub 应用" and "Configuring your GitHub App for your Copilot extension".
  2. API endpoints: You need one endpoint per skill. Each endpoint must:
    • Accept POST requests with the application/json MIME type
    • Be able to verify the signature of requests from GitHub to authenticate their origin and prevent unauthorized access
    • Be publicly accessible via HTTPS

For more information about signature verification, see "Verifying that payloads are coming from Github".

Configuration requirements

Each skillset is defined within a GitHub App. A singleGitHub App can contain up to five skills. Each individual skill needs:

  • Name: A clear and descriptive name (for example, "Get Issues").
  • Inference description: A detailed explanation of what the skill does and when to use it (for example, "Searches for external issues matching specific criteria like status and labels").
  • API endpoint: A POST endpoint that accepts JSON requests.
  • JSON schema: The structure of data your endpoint expects.

Example JSON schema

This example demonstrates a skill that requires two parameters: a status string and a label string. If no parameters are provided, an empty object with the type 'object' must be passed in as the request body.

{
 "type": "object",
 "properties": {
   "status": {
     "type": "string",
     "description": "filter issues by status (open, closed)",
     "enum": ["open", "closed"]
   },
   "label": {
     "type": "string",
     "description": "filter issues by label"
   }
 }
}

This format lets users make natural-language requests like find open security issues and Copilot will structure the appropriate API call.

Using your skillset

To use your skillset:

  1. Type @ followed by your extension's name.

  2. Type your prompt in natural language.

    For example:

    • @skillset-example generate a lorem ipsum
    • @skillset-example give me sample data with 100 words

Copilot interprets your request and calls the appropriate skill with the right parameters. There's no need to specify which skill to use—Copilot determines this from your natural-language request and the inference descriptions provided.

Setting up a skillset

  1. 在 GitHub 上任意页的右上角,单击你的个人资料照片。
  2. 导航到你的帐户设置。
    • 对于由个人帐户拥有的应用,请单击“设置”****。
    • 对于组织拥有的应用:
      1. 单击“你的组织”。
      2. 在组织右侧,单击“设置”。
  3. 在左侧边栏中,单击“ 开发人员设置”。
  4. 在左侧边栏中,单击“GitHub Apps”。
  5. In the list of GitHub Apps, click the GitHub App you want to configure for your skillset.
  6. In the navigation menu on the left, select Copilot.
  7. Under App Type, select Skillset from the dropdown menu.
  8. Optionally, in the Pre-authorization URL field, enter the URL where users will be redirected to start the authentication process. This step is necessary if your API requires users to connect their GitHub account to access certain features or data.
  9. For each skill you want to add (maximum 5):
    1. Click Add new skill.
    2. Enter a clear Name for the skill (e.g., "Generate Lorem Ipsum Data").
    3. Write a detailed Inference description to help Copilot understand when to use this skill.
    4. Add your API endpoint URL that will receive the POST requests.
    5. In the Parameter field, add the JSON schema defining the expected request format.
    6. Click Add Definition to save your skill.
  10. Click Save to save your skillset.