Skip to content

Latest commit

 

History

History
239 lines (183 loc) · 4.79 KB

NEW_PLUGIN_TEMPLATE.md

File metadata and controls

239 lines (183 loc) · 4.79 KB

Creating a New Copilot Plugin - Template & Guide

This guide shows how to create a new plugin for the copilot-plugins repository following the established patterns.

Plugin Anatomy

A complete plugin consists of:

plugins/[plugin-name]/
├── plugin.json                 # Plugin metadata
├── README.md                   # User documentation
├── skills/
│   └── [skill-name]/
│       ├── SKILL.md           # Skill documentation
│       └── references/         # Optional: reference docs
├── hooks/
│   └── hooks.json             # Lifecycle hooks
├── scripts/                    # Optional: setup/helper scripts
│   ├── install-*.ps1
│   └── ...
└── references/                # Optional: general references
    ├── *.md
    └── ...

Step-by-Step Template

1. Create the plugin directory structure

mkdir plugins/[your-plugin-name]
cd plugins/[your-plugin-name]
mkdir skills hooks scripts references

2. Create plugin.json

{
  "name": "[plugin-name]",
  "description": "[Brief description of what your plugin does]",
  "version": "1.0.0",
  "author": {
    "name": "Your Name",
    "email": "your.email@example.com"
  },
  "homepage": "https://github.com/github/copilot-plugins/tree/main/plugins/[plugin-name]",
  "repository": "https://github.com/github/copilot-plugins",
  "license": "MIT",
  "keywords": [
    "keyword1",
    "keyword2",
    "keyword3"
  ],
  "skills": [
    "skills/"
  ],
  "hooks": "hooks/hooks.json"
}

3. Create README.md

Follow this template:

# [Plugin Display Name]

[One-line description of what the plugin does]

## Features

- Feature 1
- Feature 2
- Feature 3

## Requirements

- Requirement 1
- Requirement 2

## Install

\`\`\`
copilot plugin install [plugin-name]@copilot-plugins
\`\`\`

## Use

Start Copilot CLI and ask:

\`\`\`
[Example user prompt]
\`\`\`

## Hooks

- `sessionStart`: [What happens]
- `userPromptSubmitted`: [What happens]

4. Create a skill in skills/[skill-name]/SKILL.md

---
name: [skill-name]
description: '[Description of what this skill does. Specify when to use it and what it can accomplish.]'
---

# [Skill Display Name]

[Detailed explanation of the skill's functionality]

## Usage

[Examples of how to use this skill]

## References

[Links to relevant documentation]

5. Create hooks/hooks.json

{
  "hooks": [
    {
      "event": "sessionStart",
      "description": "Run during session initialization",
      "handler": "[relative/path/to/handler.ps1]"
    }
  ]
}

Or leave empty if no hooks needed:

{
  "hooks": []
}

Variable Naming Conventions

  • Plugin folder: lowercase with hyphens (e.g., my-cool-plugin)
  • Skills: follow plugin naming pattern
  • JSON fields: camelCase
  • File names: lowercase with hyphens

Content Guidelines

plugin.json

  • Keep description under 150 characters
  • Keywords should be relevant and searchable
  • Ensure homepage and repository URLs are accurate

README.md

  • Clear, concise explanation of functionality
  • Installation instructions
  • At least one usage example
  • List of requirements upfront

SKILL.md

  • Start with frontmatter (name, description)
  • Begin description with verb (e.g., "Analyze", "Debug", "Generate")
  • Specify when to use in the description
  • Include practical examples
  • Link to relevant documentation

Example: Minimal Plugin

For a quick start, here's a minimal plugin structure:

plugins/example-plugin/plugin.json

{
  "name": "example-plugin",
  "description": "An example plugin demonstrating the plugin structure",
  "version": "1.0.0",
  "author": {
    "name": "Developer Name",
    "email": "dev@example.com"
  },
  "homepage": "https://github.com/github/copilot-plugins/tree/main/plugins/example-plugin",
  "repository": "https://github.com/github/copilot-plugins",
  "license": "MIT",
  "keywords": ["example"],
  "skills": ["skills/"],
  "hooks": "hooks/hooks.json"
}

plugins/example-plugin/README.md

# Example Plugin

A simple example plugin for Copilot.

## Features
- Basic functionality

## Install
\`\`\`
copilot plugin install example-plugin@copilot-plugins
\`\`\`

## Use
Start Copilot CLI and interact normally.

plugins/example-plugin/skills/example-skill/SKILL.md

---
name: example-skill
description: 'Demonstrates basic skill structure'
---

# Example Skill

This is an example skill.

plugins/example-plugin/hooks/hooks.json

{
  "hooks": []
}

Next Steps

  1. Replace [plugin-name], [skill-name], etc. with your actual values
  2. Implement hook handlers if your plugin needs them
  3. Add references documentation as needed
  4. Test your plugin with copilot plugin install ./path/to/plugin
  5. Create a pull request to add it to the marketplace