Centralized context management for GitHub Copilot across the Canonical ecosystem.
This repository acts as a "Toolkit" to distribute standardized Copilot Custom Instructions, Prompts, Agents and Skills. It allows individual repositories to "subscribe" to specific sets of assets (e.g., Python standards, Juju/Ops Framework patterns) and keep them synchronized automatically.
A Collection is a logical group of markdown files (instructions, prompts, agents, and skills) defined in collections.yaml.
Instead of copying specific instructions into 50 different repositories manually, the consuming repository defines a configuration file listing the collections it needs.
Available Collections (Examples):
- core: Core assets common to all repositories.
- common-python: Standard Python coding style.
- common-documentation: Documentation standards with review skill.
- charm-python: Includes common-python + Juju Ops Framework specifics.
- copilot-toolkit: Meta-tools for generating and managing Copilot assets (agents, skills, prompts, instructions).
- pfe-charms: Platform Engineering specific collection.
To add Copilot collections to your repository, follow these three steps.
Note: These steps assume that if the yq tool is already installed, it was installed via snap not via apt. The install scripts rely on behavior from the snap version of yq. The apt offering of yq doesn't have the behavior the scripts expect, and will fail. If yq is not installed, the script will automatically install it via snap.
Create a file named .copilot-collections.yaml in the .github folder of your repository (recommended) or in the repository root.
copilot:
# The version of the toolkit to use (matches a Release Tag in this repo)
version: "v1.0.0"
# The collections you want to install
collections:
- charm-python
- pfe-charmsLocation Preference: The workflow and sync script will search for the config file in this order:
.github/.copilot-collections.yaml(recommended).copilot-collections.yaml(root, for backwards compatibility)
You can also specify a custom location - see below for details.
You can sync the instructions immediately to your local machine to verify them.
curl -sL https://raw.githubusercontent.com/canonical/copilot-collections/main/scripts/local_sync.sh | bashTo specify a custom config file location:
# Via command-line argument
curl -sL https://raw.githubusercontent.com/canonical/copilot-collections/main/scripts/local_sync.sh | bash -s -- custom/path/.copilot-collections.yaml
# Via environment variable
COPILOT_CONFIG_FILE="custom/path/.copilot-collections.yaml" curl -sL https://raw.githubusercontent.com/canonical/copilot-collections/main/scripts/local_sync.sh | bashNote: This will generate files in .github/instructions/, .github/prompts/, and .github/skills/. Do not edit these files manually; they will be overwritten.
For discoverable core skills in this repository, you can install directly with skills:
# List discoverable skills
npx skills add canonical/copilot-collections --list
# Install one skill globally (use skill name, not path)
npx skills add canonical/copilot-collections --skill generate-agent -gNote: Group-scoped skill discoverability is handled separately.
To ensure your repo stays up to date when the Toolkit releases new versions, add this workflow.
File: .github/workflows/copilot-collections-update.yml
name: Auto-Update Copilot Instructions
on:
schedule:
- cron: '0 9 * * 1' # Run every Monday at 09:00 UTC
workflow_dispatch:
jobs:
check-update:
# Always pin to @main to get the latest logic, but the content version is controlled by your .yaml file
uses: canonical/copilot-collections/.github/workflows/auto_update_collections.yaml@main
secrets: inherit
# Optionally specify a custom config file location:
# with:
# config_file: "custom/path/.copilot-collections.yaml"Some prompts and instruction patterns in this collection were inspired by the Awesome GitHub Copilot repository.
We highly encourage you to explore it for further inspiration, including advanced chat modes, persona definitions, and framework-specific prompts that you might want to adapt for your specific projects.
assets/: Raw markdown files for core instructions, prompts, and agents.instructions/: Custom instruction files.prompts/: Prompt files.agents/: Agent files.
skills/: Core agent skill directories (each containingSKILL.md).collections.yaml: Core definitions.groups/: Team specific collections.<team-name>/: Folder for team assets.collections.yaml: Team specific definitions.
scripts/: Logic for syncing files..github/workflows/: Reusable workflows.
- Add the file: Create
assets/instructions/my-topic/my-new-instructions.md(for core) orgroups/<team>/instructions/...(for teams). - Update Manifest: Edit
collections.yaml(core) orgroups/<team>/collections.yaml.- Add it to an existing collection items list.
- OR create a new collection key if it represents a new logical group.
- Release:
- Open PR.
- Merge changes to main.
- Create a new GitHub Release (e.g., v1.1.0).
- Consumer repos will pick this up automatically on their next scheduled run.
- Create the directory: Create
skills/<skill-name>/(for core) orgroups/<team>/skills/<skill-name>/(for teams). - Add SKILL.md: Create the skill definition file with required YAML frontmatter:
--- name: skill-name description: What the skill does --- # Skill content here
- Update Manifest: Edit
collections.yamland add to a collection's items:Important: Skills are directories, so- src: skills/<skill-name> dest: .github/skills/<skill-name>/
destmust end with/. - Validate: Run
./scripts/validate_collections.sh . - Release: Follow the same release process as instructions.
Teams can manage their own collections in groups/<team-name>/.
Naming Convention: Collection names are global. To avoid collisions, prefix your collection names with your group name.
- ✅
pfe-charms - ❌
charms(Too generic)
Path Resolution:
- Relative Paths:
src: instructions/guide.md-> Resolves togroups/<team>/instructions/guide.md. - Root Paths:
src: /assets/common/logo.png-> Resolves toassets/common/logo.png(Repository Root).
The repository includes a Markdown linter to ensure consistent formatting across all instruction, prompt, agent, and skill files.
Run the linter:
# Lint all files
make lint-md
# Lint specific directory
make lint-md SOURCEDIR=assets/agents
make lint-md SOURCEDIR=assets/instructionsRequirements: The linter uses uv and pymarkdownlnt. The Makefile automatically sets up a virtual environment and installs dependencies on first run.
Configuration: Linting rules are defined in .pymarkdown.json at the repository root.