run-metrics
Skill134 starsChanged 3 months agoMITView on GitHub
Run metrics reports for APIView Copilot. Use for: run metrics, metrics report, generate metrics, monthly metrics, metrics for March, metrics for January, adoption metrics, comment quality, quality trends, save metrics, metrics charts.
In this repository42 other files it gives its agents.
- packages/python-packages/apiview-copilot/AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- azsdk-common-apiview-feedback-resolutionSkill
- azsdk-common-generate-sdk-locallySkill
- azsdk-common-generate-sdk-pipelineSkill
- azsdk-common-pipeline-analysisSkill
- azsdk-common-pipeline-fixerSkill
- azsdk-common-prepare-release-planSkill
- azsdk-common-sdk-breaking-changeSkill
- azsdk-common-sdk-releaseSkill
- azure-typespec-assessmentSkill
- azure-typespec-authorSkill
- code-reviewSkill
- eval-authoring-skillSkill
- eval-authoring-toolSkill
- eval-authoring-workflowSkill
- markdown-token-optimizerSkill
- sdk-ai-bot-eval-datasetSkill
- sdk-ai-bot-run-evaluationSkill
- skill-authoringSkill
- add-endpointSkill
- audit-filtersSkill
- dev-setupSkill
- kb-searchSkill
- report-active-reviewsSkill
- report-apiview-metricsSkill
- report-architect-commentsSkill
- report-feedbackSkill
- report-memorySkill
- report-revisionsSkill
- run-evalsSkill
- update-guidelinesSkill
- apiview-feedback-resolutionSkill
- azure-typespec-authorSkill
- generate-sdk-locallySkill
- azsdk-common-live-and-recorded-testsSkill
- markdown-token-optimizerSkill
- pipeline-troubleshootingSkill
- azsdk-common-prepare-release-planSkill
- azsdk-common-sdk-releaseSkill
- skill-authoringSkill
- pr-review-helpSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
18 rules. About 0 are common, 3 are distinctive, and 15 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
15
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 20
Charts: Always include --charts
- Very specific: line 21
Languages: All languages (do not pass --exclude)
- Very specific: line 22
Save: Do NOT pass --save unless the user explicitly asks to save (e.g.
- Distinctive: line 24
Quality trends follow-up: If the user asks for metrics but does not explicitly ask for quality trends, ask a short follow-up after sharing …
- Very specific: line 25
Quality trends auto-run: If the user explicitly asks for quality trends, comment trends, or asks broadly for charts/trends/quality, also …
- Very specific: line 38
When only a month name is given without a year, use the current year.
- Very specific: line 46
Important: Do NOT use 2>&1 — that merges stderr log messages (e.g.
- Very specific: line 53
After the command completes, read the output file with read_file to get the JSON results — do NOT use a separate terminal command.
- Distinctive: line 78
If the user explicitly asks for quality trends, comment trends, or a broader trends/chart view, run it automatically for the same time …
- Distinctive: line 79
If the user only asked for metrics, ask whether they want the quality trends chart too after presenting the metrics result.
- Very specific: line 92
Use the same resolved end date from the metrics request for --end-date.
- Very specific: line 106
After it completes, summarize the terminal output and use view_image to show the saved chart at output/charts/comment_bucket_trends.png.
- Very specific: line 110
If the user asks to save after a metrics run (e.g.
- Very specific: line 125
When --charts is enabled, 4 PNGs are saved to output/charts/:
- Very specific: line 133
Redirect stdout to a file: Always pipe through | Out-File -Encoding UTF8 output/metrics_output.json and read the file afterward.
- Very specific: line 134
Clean up before running: Delete the previous output/metrics_output.json and output/charts/* before running.
- Very specific: line 136
Use foreground with timeout: Run with isBackground=false and timeout: 180000 (3 min).
- Very specific: line 138
Read results with
read_fileandview_image: After the command finishes, use read_file for the JSON and view_image for charts.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Run Metrics
When to Use
- Generating monthly or custom-range metrics reports
- Reviewing adoption rates and comment quality across languages
- Producing charts for metrics visualization
- Reviewing companion quality trends across recent months
- Saving finalized metrics to the database (only when user explicitly requests)
Defaults
Unless the user says otherwise, always apply these defaults:
- Environment:
production - Charts: Always include
--charts - Languages: All languages (do not pass
--exclude) - Save: Do NOT pass
--saveunless the user explicitly asks to save (e.g. "save it", "persist", "write to DB") - Format: JSON output (UTF-8 encoded)
- Quality trends follow-up: If the user asks for metrics but does not explicitly ask for quality trends, ask a short follow-up after sharing the metrics results: "Do you want the quality trends chart for the same period too?"
- Quality trends auto-run: If the user explicitly asks for quality trends, comment trends, or asks broadly for charts/trends/quality, also run the companion
quality-trendsreport for the same period.
Date Resolution
The user will typically specify a calendar month by name (e.g. "March", "January 2025"). Resolve to the full month date range:
| User says | start_date | end_date |
| "March" (current year) | YYYY-03-01 | YYYY-03-31 |
| "January 2025" | 2025-01-01 | 2025-01-31 |
| "March 1 to March 15" | YYYY-03-01 | YYYY-03-15 |
| "2025-06-01 to 2025-06-30" | 2025-06-01 | 2025-06-30 |
When only a month name is given without a year, use the current year. Be careful with month lengths (28/29/30/31 days).
Running Metrics
Step 1: Run the Command
Show the resolved command and run it immediately in a single foreground terminal invocation with a 180-second timeout (timeout: 180000). Before running, clean up stale output so you never accidentally present old results.
Important: Do NOT use 2>&1 — that merges stderr log messages (e.g. "Saved: output\charts\adoption.png") into the JSON output file, producing invalid JSON. Pipe stdout through Out-File -Encoding UTF8 so the output file is always valid UTF-8 JSON.
Full terminal command (cleanup + run):
New-Item -ItemType Directory -Path output -Force | Out-Null; if (Test-Path output/metrics_output.json) { Remove-Item output/metrics_output.json }; if (Test-Path output/charts) { Remove-Item output/charts/* -Force }; python cli.py report metrics -s <start_date> -e <end_date> --charts | Out-File -Encoding UTF8 output/metrics_output.jsonAfter the command completes, read the output file with read_file to get the JSON results — do NOT use a separate terminal command. Then use view_image (not a terminal command) to display the chart PNGs. This means the entire workflow requires only one terminal invocation.
Examples
# March 2025, production, all languages, with charts (typical request)
python cli.py report metrics -s 2025-03-01 -e 2025-03-31 --charts
# Staging environment
python cli.py report metrics -s 2025-03-01 -e 2025-03-31 --charts --environment staging
# Exclude specific languages
python cli.py report metrics -s 2025-03-01 -e 2025-03-31 --charts --exclude Java Golang
# Custom date range
python cli.py report metrics -s 2025-03-10 -e 2025-03-20 --charts
# Save to database (ONLY when user explicitly requests)
python cli.py report metrics -s 2025-03-01 -e 2025-03-31 --charts --saveCompanion Quality Trends
The quality-trends report is the companion chart view for metrics work.
- If the user explicitly asks for quality trends, comment trends, or a broader trends/chart view, run it automatically for the same time window.
- If the user only asked for metrics, ask whether they want the quality trends chart too after presenting the metrics result.
Translating the date window
The quality-trends command uses --months plus an optional --end-date, not a start date.
Convert the requested metrics window into an inclusive calendar-month count:
| Window | Use for --months |
| 2026-03-01 to 2026-03-31 | 1 |
| 2026-03-01 to 2026-03-15 | 1 |
| 2026-01-15 to 2026-03-02 | 3 |
Use the same resolved end date from the metrics request for --end-date.
Quality trends command
if (Test-Path output/charts/comment_bucket_trends.png) { Remove-Item output/charts/comment_bucket_trends.png -Force }; python cli.py report quality-trends --months <month_count> --end-date <end_date>Optional additions:
- --environment staging
- --languages Python CSharp C# Java TypeScript JavaScript Go
- --exclude-human
- --neutral
After it completes, summarize the terminal output and use view_image to show the saved chart at output/charts/comment_bucket_trends.png.
Follow-up: "Save it"
If the user asks to save after a metrics run (e.g. "okay save it", "persist that", "write to DB"), re-run the same command with --save appended. Keep all other flags identical to the previous run.
Available Flags
| Flag | Type | Default | Description |
--start-date / -s | string | required | Start date (YYYY-MM-DD) |
--end-date / -e | string | required | End date (YYYY-MM-DD) |
--environment | string | production | production or staging |
--exclude | list | none | Space-separated language names to exclude |
--charts | flag | off | Generate PNG charts to output/charts/ |
--save | flag | off | Persist metrics to Cosmos DB (never use unless user explicitly requests) |
Chart Outputs
When --charts is enabled, 4 PNGs are saved to output/charts/:
- adoption.png — Copilot vs non-Copilot reviews by language
- comment_quality.png — Comment quality breakdown (upvoted, implicit good/bad, downvoted, deleted)
- human_copilot_split.png — Human vs AI comment split
- human_comments_comparison.png — Human comments with vs without Copilot
Gotchas
- Redirect stdout to a file: Always pipe through
| Out-File -Encoding UTF8 output/metrics_output.jsonand read the file afterward. Do NOT use>which produces UTF-16 in PowerShell 5.1. - Clean up before running: Delete the previous
output/metrics_output.jsonandoutput/charts/*before running. This prevents presenting stale results if the command fails silently. - Do NOT use
2>&1: This merges stderr log lines (e.g. "Saved: ...") into the JSON output file, producing invalid JSON. Only redirect stdout. - Use foreground with timeout: Run with
isBackground=falseandtimeout: 180000(3 min). Do NOT useisBackground=trueand poll — that causes repeated user approval prompts. - Use
New-Item -ItemType Directorynotmkdir:mkdiris aliased differently across shells. UseNew-Item -ItemType Directory -Path output -Force | Out-Nullfor reliable directory creation. - Read results with
read_fileandview_image: After the command finishes, useread_filefor the JSON andview_imagefor charts. Do NOT launch additional terminal commands to read the file. - Use
python cli.pynot.\avc: Theavc.batscript may resolve to system Python. Usepython cli.py report metrics ...to ensure the correct environment. - Quality trends is separate: It uses
report quality-trendswith--monthsand optional--end-date, not--start-date. - Month end dates: February has 28/29 days, April/June/Sept/Nov have 30 days. Get it right.
- Built-in exclusions:
c,c++,typespec,swagger,xmlare always excluded automatically — no need to add them.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

