-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Add copilot-usage-metrics skill #745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
aaronpowell
merged 5 commits into
github:staged
from
codeHysteria28:add-copilot-usage-metrics-skill
Feb 20, 2026
+147
−0
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
5de0d98
Add copilot-usage-metrics skill
codeHysteria28 812febf
chore: publish from staged [skip ci]
github-actions[bot] 8fcf651
Merge branch 'main' into add-copilot-usage-metrics-skill
aaronpowell 87fb17b
chore: remove materialized plugin files from tracking
aaronpowell 4dfcb55
Fixing the readme
aaronpowell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| --- | ||
| name: copilot-usage-metrics | ||
| description: Retrieve and display GitHub Copilot usage metrics for organizations and enterprises using the GitHub CLI and REST API. | ||
| --- | ||
|
|
||
| # Copilot Usage Metrics | ||
|
|
||
| You are a skill that retrieves and displays GitHub Copilot usage metrics using the GitHub CLI (`gh`). | ||
|
Comment on lines
+6
to
+8
|
||
|
|
||
| ## When to use this skill | ||
|
|
||
| Use this skill when the user asks about: | ||
| - Copilot usage metrics, adoption, or statistics | ||
| - How many people are using Copilot in their org or enterprise | ||
| - Copilot acceptance rates, suggestions, or chat usage | ||
| - Per-user Copilot usage breakdowns | ||
| - Copilot usage on a specific date | ||
|
|
||
| ## How to use this skill | ||
|
|
||
| 1. Determine whether the user wants **organization** or **enterprise** level metrics. | ||
| 2. Ask for the org name or enterprise slug if not provided. | ||
| 3. Determine if they want **aggregated** metrics or **per-user** metrics. | ||
| 4. Determine if they want metrics for a **specific day** (YYYY-MM-DD format) or general/recent metrics. | ||
| 5. Run the appropriate script from this skill's directory. | ||
|
|
||
| ## Available scripts | ||
|
|
||
| ### Organization metrics | ||
|
|
||
| - `get-org-metrics.sh <org> [day]` — Get aggregated Copilot usage metrics for an organization. Optionally pass a specific day in YYYY-MM-DD format. | ||
| - `get-org-user-metrics.sh <org> [day]` — Get per-user Copilot usage metrics for an organization. Optionally pass a specific day. | ||
|
|
||
| ### Enterprise metrics | ||
|
|
||
| - `get-enterprise-metrics.sh <enterprise> [day]` — Get aggregated Copilot usage metrics for an enterprise. Optionally pass a specific day. | ||
| - `get-enterprise-user-metrics.sh <enterprise> [day]` — Get per-user Copilot usage metrics for an enterprise. Optionally pass a specific day. | ||
|
|
||
| ## Formatting the output | ||
|
|
||
| When presenting results to the user: | ||
| - Summarize key metrics: total active users, acceptance rate, total suggestions, total chat interactions | ||
| - Use tables for per-user breakdowns | ||
| - Highlight trends if comparing multiple days | ||
| - Note that metrics data is available starting from October 10, 2025, and historical data is accessible for up to 1 year | ||
|
|
||
| ## Important notes | ||
|
|
||
| - These API endpoints require **GitHub Enterprise Cloud**. | ||
| - The user must have appropriate permissions (enterprise owner, billing manager, or a token with `manage_billing:copilot` / `read:enterprise` scope). | ||
| - The "Copilot usage metrics" policy must be enabled in enterprise settings. | ||
| - If the API returns 403, advise the user to check their token permissions and enterprise policy settings. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #!/usr/bin/env bash | ||
| # Fetch aggregated Copilot usage metrics for an enterprise | ||
| # Usage: get-enterprise-metrics.sh <enterprise> [day] | ||
| # enterprise - GitHub enterprise slug | ||
| # day - (optional) specific day in YYYY-MM-DD format | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| ENTERPRISE="${1:?Usage: get-enterprise-metrics.sh <enterprise> [day]}" | ||
| DAY="${2:-}" | ||
|
|
||
| if [ -n "$DAY" ]; then | ||
| gh api \ | ||
| -H "Accept: application/vnd.github+json" \ | ||
| -H "X-GitHub-Api-Version: 2022-11-28" \ | ||
| "/enterprises/$ENTERPRISE/copilot/usage/day?day=$DAY" | ||
| else | ||
| gh api \ | ||
| -H "Accept: application/vnd.github+json" \ | ||
| -H "X-GitHub-Api-Version: 2022-11-28" \ | ||
| "/enterprises/$ENTERPRISE/copilot/usage" | ||
| fi |
22 changes: 22 additions & 0 deletions
22
skills/copilot-usage-metrics/get-enterprise-user-metrics.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #!/usr/bin/env bash | ||
| # Fetch per-user Copilot usage metrics for an enterprise | ||
| # Usage: get-enterprise-user-metrics.sh <enterprise> [day] | ||
| # enterprise - GitHub enterprise slug | ||
| # day - (optional) specific day in YYYY-MM-DD format | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| ENTERPRISE="${1:?Usage: get-enterprise-user-metrics.sh <enterprise> [day]}" | ||
| DAY="${2:-}" | ||
|
|
||
| if [ -n "$DAY" ]; then | ||
| gh api \ | ||
| -H "Accept: application/vnd.github+json" \ | ||
| -H "X-GitHub-Api-Version: 2022-11-28" \ | ||
| "/enterprises/$ENTERPRISE/copilot/usage/users/day?day=$DAY" | ||
| else | ||
| gh api \ | ||
| -H "Accept: application/vnd.github+json" \ | ||
| -H "X-GitHub-Api-Version: 2022-11-28" \ | ||
| "/enterprises/$ENTERPRISE/copilot/usage/users" | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #!/usr/bin/env bash | ||
| # Fetch aggregated Copilot usage metrics for an organization | ||
| # Usage: get-org-metrics.sh <org> [day] | ||
| # org - GitHub organization name | ||
| # day - (optional) specific day in YYYY-MM-DD format | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| ORG="${1:?Usage: get-org-metrics.sh <org> [day]}" | ||
| DAY="${2:-}" | ||
|
|
||
| if [ -n "$DAY" ]; then | ||
| gh api \ | ||
| -H "Accept: application/vnd.github+json" \ | ||
| -H "X-GitHub-Api-Version: 2022-11-28" \ | ||
| "/orgs/$ORG/copilot/usage/day?day=$DAY" | ||
| else | ||
| gh api \ | ||
| -H "Accept: application/vnd.github+json" \ | ||
| -H "X-GitHub-Api-Version: 2022-11-28" \ | ||
| "/orgs/$ORG/copilot/usage" | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #!/usr/bin/env bash | ||
| # Fetch per-user Copilot usage metrics for an organization | ||
| # Usage: get-org-user-metrics.sh <org> [day] | ||
| # org - GitHub organization name | ||
| # day - (optional) specific day in YYYY-MM-DD format | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| ORG="${1:?Usage: get-org-user-metrics.sh <org> [day]}" | ||
| DAY="${2:-}" | ||
|
|
||
| if [ -n "$DAY" ]; then | ||
| gh api \ | ||
| -H "Accept: application/vnd.github+json" \ | ||
| -H "X-GitHub-Api-Version: 2022-11-28" \ | ||
| "/orgs/$ORG/copilot/usage/users/day?day=$DAY" | ||
| else | ||
| gh api \ | ||
| -H "Accept: application/vnd.github+json" \ | ||
| -H "X-GitHub-Api-Version: 2022-11-28" \ | ||
| "/orgs/$ORG/copilot/usage/users" | ||
| fi |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The skill frontmatter
descriptionshould follow the skill template format (quoted string) and include stronger discovery keywords (e.g., explicitly include a “Use when …” clause) so it’s consistent with the documented SKILL.md frontmatter guidance (see skills/make-skill-template/SKILL.md around the frontmatter example).