Skip to content

Commit 7bebd4a

Browse files
authored
Merge pull request #745 from codeHysteria28/add-copilot-usage-metrics-skill
Add copilot-usage-metrics skill
2 parents 8ac0e41 + 4dfcb55 commit 7bebd4a

8 files changed

Lines changed: 147 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,6 @@ jobs:
4949
git config user.name "github-actions[bot]"
5050
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
5151
git add -A
52+
git add -f plugins/*/agents/ plugins/*/commands/ plugins/*/skills/
5253
git commit -m "chore: publish from staged [skip ci]" --allow-empty
5354
git push origin HEAD:main --force

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ reports/
1010
# Generated files
1111
/llms.txt
1212

13+
# Materialized plugin files (generated by CI via eng/materialize-plugins.mjs)
14+
plugins/*/agents/
15+
plugins/*/commands/
16+
plugins/*/skills/
17+
1318
# Website build artifacts
1419
website/dist/
1520
website/.astro/

docs/README.skills.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Skills differ from other primitives by supporting bundled assets (scripts, code
3434
| [chrome-devtools](../skills/chrome-devtools/SKILL.md) | Expert-level browser automation, debugging, and performance analysis using Chrome DevTools MCP. Use for interacting with web pages, capturing screenshots, analyzing network traffic, and profiling performance. | None |
3535
| [copilot-cli-quickstart](../skills/copilot-cli-quickstart/SKILL.md) | Use this skill when someone wants to learn GitHub Copilot CLI from scratch. Offers interactive step-by-step tutorials with separate Developer and Non-Developer tracks, plus on-demand Q&A. Just say "start tutorial" or ask a question! Note: This skill targets GitHub Copilot CLI specifically and uses CLI-specific tools (ask_user, sql, fetch_copilot_cli_documentation). | None |
3636
| [copilot-sdk](../skills/copilot-sdk/SKILL.md) | Build agentic applications with GitHub Copilot SDK. Use when embedding AI agents in apps, creating custom tools, implementing streaming responses, managing sessions, connecting to MCP servers, or creating custom agents. Triggers on Copilot SDK, GitHub SDK, agentic app, embed Copilot, programmable agent, MCP server, custom agent. | None |
37+
| [copilot-usage-metrics](../skills/copilot-usage-metrics/SKILL.md) | Retrieve and display GitHub Copilot usage metrics for organizations and enterprises using the GitHub CLI and REST API. | `get-enterprise-metrics.sh`<br />`get-enterprise-user-metrics.sh`<br />`get-org-metrics.sh`<br />`get-org-user-metrics.sh` |
3738
| [create-web-form](../skills/create-web-form/SKILL.md) | Create robust, accessible web forms with best practices for HTML structure, CSS styling, JavaScript interactivity, form validation, and server-side processing. Use when asked to "create a form", "build a web form", "add a contact form", "make a signup form", or when building any HTML form with data handling. Covers PHP and Python backends, MySQL database integration, REST APIs, XML data exchange, accessibility (ARIA), and progressive web apps. | `references/accessibility.md`<br />`references/aria-form-role.md`<br />`references/css-styling.md`<br />`references/form-basics.md`<br />`references/form-controls.md`<br />`references/form-data-handling.md`<br />`references/html-form-elements.md`<br />`references/html-form-example.md`<br />`references/hypertext-transfer-protocol.md`<br />`references/javascript.md`<br />`references/php-cookies.md`<br />`references/php-forms.md`<br />`references/php-json.md`<br />`references/php-mysql-database.md`<br />`references/progressive-web-app.md`<br />`references/python-as-web-framework.md`<br />`references/python-contact-form.md`<br />`references/python-flask-app.md`<br />`references/python-flask.md`<br />`references/security.md`<br />`references/styling-web-forms.md`<br />`references/web-api.md`<br />`references/web-performance.md`<br />`references/xml.md` |
3839
| [excalidraw-diagram-generator](../skills/excalidraw-diagram-generator/SKILL.md) | Generate Excalidraw diagrams from natural language descriptions. Use when asked to "create a diagram", "make a flowchart", "visualize a process", "draw a system architecture", "create a mind map", or "generate an Excalidraw file". Supports flowcharts, relationship diagrams, mind maps, and system architecture diagrams. Outputs .excalidraw JSON files that can be opened directly in Excalidraw. | `references/element-types.md`<br />`references/excalidraw-schema.md`<br />`scripts/.gitignore`<br />`scripts/README.md`<br />`scripts/add-arrow.py`<br />`scripts/add-icon-to-diagram.py`<br />`scripts/split-excalidraw-library.py`<br />`templates/business-flow-swimlane-template.excalidraw`<br />`templates/class-diagram-template.excalidraw`<br />`templates/data-flow-diagram-template.excalidraw`<br />`templates/er-diagram-template.excalidraw`<br />`templates/flowchart-template.excalidraw`<br />`templates/mindmap-template.excalidraw`<br />`templates/relationship-template.excalidraw`<br />`templates/sequence-diagram-template.excalidraw` |
3940
| [fabric-lakehouse](../skills/fabric-lakehouse/SKILL.md) | Use this skill to get context about Fabric Lakehouse and its features for software systems and AI-powered functions. It offers descriptions of Lakehouse data components, organization with schemas and shortcuts, access control, and code examples. This skill supports users in designing, building, and optimizing Lakehouse solutions using best practices. | `references/getdata.md`<br />`references/pyspark.md` |
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
name: copilot-usage-metrics
3+
description: Retrieve and display GitHub Copilot usage metrics for organizations and enterprises using the GitHub CLI and REST API.
4+
---
5+
6+
# Copilot Usage Metrics
7+
8+
You are a skill that retrieves and displays GitHub Copilot usage metrics using the GitHub CLI (`gh`).
9+
10+
## When to use this skill
11+
12+
Use this skill when the user asks about:
13+
- Copilot usage metrics, adoption, or statistics
14+
- How many people are using Copilot in their org or enterprise
15+
- Copilot acceptance rates, suggestions, or chat usage
16+
- Per-user Copilot usage breakdowns
17+
- Copilot usage on a specific date
18+
19+
## How to use this skill
20+
21+
1. Determine whether the user wants **organization** or **enterprise** level metrics.
22+
2. Ask for the org name or enterprise slug if not provided.
23+
3. Determine if they want **aggregated** metrics or **per-user** metrics.
24+
4. Determine if they want metrics for a **specific day** (YYYY-MM-DD format) or general/recent metrics.
25+
5. Run the appropriate script from this skill's directory.
26+
27+
## Available scripts
28+
29+
### Organization metrics
30+
31+
- `get-org-metrics.sh <org> [day]` — Get aggregated Copilot usage metrics for an organization. Optionally pass a specific day in YYYY-MM-DD format.
32+
- `get-org-user-metrics.sh <org> [day]` — Get per-user Copilot usage metrics for an organization. Optionally pass a specific day.
33+
34+
### Enterprise metrics
35+
36+
- `get-enterprise-metrics.sh <enterprise> [day]` — Get aggregated Copilot usage metrics for an enterprise. Optionally pass a specific day.
37+
- `get-enterprise-user-metrics.sh <enterprise> [day]` — Get per-user Copilot usage metrics for an enterprise. Optionally pass a specific day.
38+
39+
## Formatting the output
40+
41+
When presenting results to the user:
42+
- Summarize key metrics: total active users, acceptance rate, total suggestions, total chat interactions
43+
- Use tables for per-user breakdowns
44+
- Highlight trends if comparing multiple days
45+
- Note that metrics data is available starting from October 10, 2025, and historical data is accessible for up to 1 year
46+
47+
## Important notes
48+
49+
- These API endpoints require **GitHub Enterprise Cloud**.
50+
- The user must have appropriate permissions (enterprise owner, billing manager, or a token with `manage_billing:copilot` / `read:enterprise` scope).
51+
- The "Copilot usage metrics" policy must be enabled in enterprise settings.
52+
- If the API returns 403, advise the user to check their token permissions and enterprise policy settings.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
# Fetch aggregated Copilot usage metrics for an enterprise
3+
# Usage: get-enterprise-metrics.sh <enterprise> [day]
4+
# enterprise - GitHub enterprise slug
5+
# day - (optional) specific day in YYYY-MM-DD format
6+
7+
set -euo pipefail
8+
9+
ENTERPRISE="${1:?Usage: get-enterprise-metrics.sh <enterprise> [day]}"
10+
DAY="${2:-}"
11+
12+
if [ -n "$DAY" ]; then
13+
gh api \
14+
-H "Accept: application/vnd.github+json" \
15+
-H "X-GitHub-Api-Version: 2022-11-28" \
16+
"/enterprises/$ENTERPRISE/copilot/usage/day?day=$DAY"
17+
else
18+
gh api \
19+
-H "Accept: application/vnd.github+json" \
20+
-H "X-GitHub-Api-Version: 2022-11-28" \
21+
"/enterprises/$ENTERPRISE/copilot/usage"
22+
fi
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
# Fetch per-user Copilot usage metrics for an enterprise
3+
# Usage: get-enterprise-user-metrics.sh <enterprise> [day]
4+
# enterprise - GitHub enterprise slug
5+
# day - (optional) specific day in YYYY-MM-DD format
6+
7+
set -euo pipefail
8+
9+
ENTERPRISE="${1:?Usage: get-enterprise-user-metrics.sh <enterprise> [day]}"
10+
DAY="${2:-}"
11+
12+
if [ -n "$DAY" ]; then
13+
gh api \
14+
-H "Accept: application/vnd.github+json" \
15+
-H "X-GitHub-Api-Version: 2022-11-28" \
16+
"/enterprises/$ENTERPRISE/copilot/usage/users/day?day=$DAY"
17+
else
18+
gh api \
19+
-H "Accept: application/vnd.github+json" \
20+
-H "X-GitHub-Api-Version: 2022-11-28" \
21+
"/enterprises/$ENTERPRISE/copilot/usage/users"
22+
fi
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
# Fetch aggregated Copilot usage metrics for an organization
3+
# Usage: get-org-metrics.sh <org> [day]
4+
# org - GitHub organization name
5+
# day - (optional) specific day in YYYY-MM-DD format
6+
7+
set -euo pipefail
8+
9+
ORG="${1:?Usage: get-org-metrics.sh <org> [day]}"
10+
DAY="${2:-}"
11+
12+
if [ -n "$DAY" ]; then
13+
gh api \
14+
-H "Accept: application/vnd.github+json" \
15+
-H "X-GitHub-Api-Version: 2022-11-28" \
16+
"/orgs/$ORG/copilot/usage/day?day=$DAY"
17+
else
18+
gh api \
19+
-H "Accept: application/vnd.github+json" \
20+
-H "X-GitHub-Api-Version: 2022-11-28" \
21+
"/orgs/$ORG/copilot/usage"
22+
fi
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
# Fetch per-user Copilot usage metrics for an organization
3+
# Usage: get-org-user-metrics.sh <org> [day]
4+
# org - GitHub organization name
5+
# day - (optional) specific day in YYYY-MM-DD format
6+
7+
set -euo pipefail
8+
9+
ORG="${1:?Usage: get-org-user-metrics.sh <org> [day]}"
10+
DAY="${2:-}"
11+
12+
if [ -n "$DAY" ]; then
13+
gh api \
14+
-H "Accept: application/vnd.github+json" \
15+
-H "X-GitHub-Api-Version: 2022-11-28" \
16+
"/orgs/$ORG/copilot/usage/users/day?day=$DAY"
17+
else
18+
gh api \
19+
-H "Accept: application/vnd.github+json" \
20+
-H "X-GitHub-Api-Version: 2022-11-28" \
21+
"/orgs/$ORG/copilot/usage/users"
22+
fi

0 commit comments

Comments
 (0)