Skip to main content

Creating a plugin for GitHub Copilot-CLI

Create a plugin to share customizations in an easy-to-install package.

Introduction

Plugins are packages that extend the functionality of Copilot-CLI. See About plugins for GitHub Copilot-CLI.

Hinweis

You can find help on using plugins by entering copilot plugin [SUBCOMMAND] --help in the terminal.

Plugin structure

A plugin consists of a directory with a specific structure. At minimum, it must contain a plugin.json manifest file at the root of the directory. It can also contain any combination of agents, skills, hooks, and MCP server configurations.

Example plugin structure

my-plugin/
├── plugin.json           # Required manifest
├── agents/               # Custom agents (optional)
│   └── helper.agent.md
├── skills/               # Skills (optional)
│   └── deploy/
│       └── SKILL.md
├── hooks.json            # Hook configuration (optional)
└── .mcp.json             # MCP server config (optional)

Creating a plugin

  1. Create a directory for your plugin.

  2. Add a plugin.json manifest file to the root of the directory.

    Example plugin.json file

    JSON
    {
      "name": "my-dev-tools",
      "description": "React development utilities",
      "version": "1.2.0",
      "author": {
        "name": "Jane Doe",
        "email": "[email protected]"
      },
      "license": "MIT",
      "keywords": ["react", "frontend"],
      "agents": "agents/",
      "skills": ["skills/", "extra-skills/"],
      "hooks": "hooks.json",
      "mcpServers": ".mcp.json"
    }
    

    For details of the full set of fields you can include in this file, see GitHub Copilot CLI plugin reference.

  3. Add some components to your plugin by creating the appropriate files and directories for agents, skills, hooks, and MCP server configurations.

    For example:

    1. Add an agent by creating a NAME.agent.md file in an agents subdirectory.

      Markdown
      ---
      name: my-agent
      description: Helps with specific tasks
      tools: ["bash", "edit", "view"]
      ---
      
      You are a specialized assistant that...
      
    2. Add a skill by creating a skills/NAME subdirectory of your plugin directory, where NAME is the name of your skill. Then, within this subdirectory, create a SKILL.md file that defines the skill.

      For example, to create a "deploy" skill, create skills/deploy/SKILL.md:

      Markdown
      ---
      name: deploy
      description: Deploy the current project to...
      ---
      
      Instructions for the skill...
      
  4. Install your plugin locally, so that you can test it as you develop it.

    For example, where ./my-plugin is the path to your plugin directory, enter:

    Shell
    copilot plugin install ./my-plugin
    
  5. Verify that the plugin loaded successfully by viewing your list of installed plugins:

    Shell
    copilot plugin list
    

    Or you can start a new interactive session and enter:

    Copilot prompt
    /plugin list
    
  6. Verify that the agents, skills, hooks, and MCP server configurations you defined are loaded correctly.

    For example, in an interactive session, to check that custom agents defined in the plugin were loaded, enter:

    Copilot prompt
    /agent
    

    To check that skills defined in the plugin were loaded, enter:

    Copilot prompt
    /skills list
    
  7. Use the functionality provided by your plugin's components to verify that each component works as expected.

  8. Iterate on your plugin development, as required.

    Wichtig

    When you install a plugin its components are cached and the CLI reads from the cache for subsequent sessions. To pick up changes made to a local plugin install it again:

    Shell
    copilot plugin install ./my-plugin
    
  9. After you have finished testing, you can uninstall the local version of your plugin by entering:

    Shell
    copilot plugin uninstall NAME
    

    Hinweis

    To uninstall a plugin, use the name of the plugin as specified in the name field of the plugin's plugin.json manifest file, not the path to the plugin's directory.

Distributing your plugin

To distribute your plugin, you can add it to a marketplace. See Creating a plugin marketplace for GitHub Copilot-CLI.

Further reading