/ci-metrics
Query PyTorch CI, GitHub Actions, HUD, Grafana, and infrastructure metrics. Use when users ask about CI duration, job failures, queue times, workflow trends, runner health, dashboard data, or PyTorch infrastructure metrics.
$ npx -y skills add pytorch/pytorch --skill ci-metrics --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/ci-metrics
Context preview
The summary Claude sees to decide when to auto-load this skill.
Query PyTorch CI, GitHub Actions, HUD, Grafana, and infrastructure metrics. Use when users ask about CI duration, job failures, queue times, workflow trends, runner health, dashboard data, or PyTorch infrastructure metrics.
SKILL.md
ci-metrics.SKILL.mdname: ci-metrics
description: Query PyTorch CI, GitHub Actions, HUD, Grafana, and infrastructure metrics. Use when users ask about CI duration, job failures, queue times, workflow trends, runner health, dashboard data, or PyTorch infrastructure metrics.
PyTorch CI Metrics
PyTorch CI and infrastructure metrics are exposed through Grafana. Use [.claude/skills/ci-metrics/gcx-wrapper.sh](gcx-wrapper.sh) for all Grafana access; it configures the PyTorch Grafana server, context, and authentication. Only users with write permission to the repo have access to Grafana. The authentication only provides read only access.
Requirements
The wrapper needs these tools on PATH:
- `gh` - fetches the Grafana token and must be authenticated; if not, run `gh auth login --hostname github.com --git-protocol ssh --web`.
- `curl` - downloads `gcx` and fetches the token from HUD.
On first use the wrapper downloads a pinned, checksum-verified `gcx` binary into a private cache (`~/.cache/pytorch-ci-metrics/`) and authenticates automatically. Nothing is installed on your PATH. If a tool is missing or `gh` is not authenticated, it exits with an error describing what to fix.
Datasources
Get the list of datasources available:
.claude/skills/ci-metrics/gcx-wrapper.sh datasources list
The data contains metrics for many repos owned by the PyTorch repo. When possible, restrict queries to just the `pytorch/pytorch` repository.
CI and Test Run Data
CI and test run data are stored in `grafana-clickhouse-datasource`. List all the available tables:
.claude/skills/ci-metrics/gcx-wrapper.sh datasources clickhouse list-tables
Important dataset:
- GitHub webhook data
- Database: default
- Note: the default database also contains other non-webhook related tables.
- Learn more about the event and payload: https://docs.github.com/en/webhooks/webhook-events-and-payloads
- Tests
- Database: tests
- tests.all_test_runs - contains every test run. This is an extremely large table, so be considerate with filtering and timing.
- Do not use tests.test_run_s3 as it contains partial data only.
To get additional guidance on common queries, clone https://github.com/pytorch/test-infra into a temporary directory and read the `torchci` folder.
Example Queries
Within the pytorch/pytorch repo on main, list the top most failing workflow jobs in the last 2 weeks:
.claude/skills/ci-metrics/gcx-wrapper.sh datasources clickhouse query "
SELECT name, count(DISTINCT id) AS failures
FROM default.workflow_job
WHERE conclusion = 'failure'
AND completed_at >= now() - INTERVAL 2 WEEK
AND repository_full_name = 'pytorch/pytorch'
AND head_branch = 'main'
GROUP BY name ORDER BY failures DESC LIMIT 10"For a test file, how many times was it run in the last week? How many times did it pass or fail?
.claude/skills/ci-metrics/gcx-wrapper.sh datasources clickhouse query "
SELECT
file,
classname,
name,
count() AS runs,
countIf(failure_count = 0 AND error_count = 0 AND skipped_count = 0) AS successful,
countIf(failure_count > 0 OR error_count > 0) AS fails,
countIf(skipped_count > 0) AS skipped
FROM tests.all_test_runs
WHERE time_inserted >= now() - INTERVAL 7 DAY
AND file = 'lazy/test_ts_opinfo.py'
GROUP BY file, classname, name
ORDER BY runs DESC"CI Infrastructure
CI infrastructure metrics are stored in `grafanacloud-pytorchci-prom`. To get a better understanding of the data, clone these repositories in a temporary directory:
- https://github.com/pytorch/ci-infra - In `/osdc` contains the code for OSDC, the infra running PyTorch's CI. Read it to understand how metrics are exported and what metrics are available. Read the docs in /osdc/docs to understand the scope and project setup.
- https://github.com/jeanschmidt/actions-runner-controller - To understand how actions-runner-controller exposes data.
Example Queries
Which runner types have the deepest queue right now (jobs assigned but not yet running)?
.claude/skills/ci-metrics/gcx-wrapper.sh datasources prometheus query -d grafanacloud-prom 'topk(10, clamp_min(sum by (name) (gha_assigned_jobs) - sum by (name) (gha_running_jobs), 0))'
How many jobs were running per cluster over the last 6 hours, sampled every 30 minutes? Use `--since`/`--step` (or `--from`/`--to`) for a range query:
.claude/skills/ci-metrics/gcx-wrapper.sh datasources prometheus query -d grafanacloud-prom 'sum by (cluster) (gha_running_jobs)' --since 6h --step 30m
Read more
name: ci-metrics description: Query PyTorch CI, GitHub Actions, HUD, Grafana, and infrastructure metrics. Use when users ask about CI duration, job failures, queue times, workflow trends, runner health, dashboard data, or PyTorch infrastructure metrics.
PyTorch CI Metrics
PyTorch CI and infrastructure metrics are exposed through Grafana. Use [.claude/skills/ci-metrics/gcx-wrapper.sh](gcx-wrapper.sh) for all Grafana access; it configures the PyTorch Grafana server, context, and authentication. Only users with write permission to the repo have access to Grafana. The authentication only provides read only access.
Requirements
The wrapper needs these tools on PATH:
- `gh` - fetches the Grafana token and must be authenticated; if not, run `gh auth login --hostname github.com --git-protocol ssh --web`.
- `curl` - downloads `gcx` and fetches the token from HUD.
On first use the wrapper downloads a pinned, checksum-verified `gcx` binary into a private cache (`~/.cache/pytorch-ci-metrics/`) and authenticates automatically. Nothing is installed on your PATH. If a tool is missing or `gh` is not authenticated, it exits with an error describing what to fix.
Datasources
Get the list of datasources available:
.claude/skills/ci-metrics/gcx-wrapper.sh datasources list
The data contains metrics for many repos owned by the PyTorch repo. When possible, restrict queries to just the `pytorch/pytorch` repository.
CI and Test Run Data
CI and test run data are stored in `grafana-clickhouse-datasource`. List all the available tables:
.claude/skills/ci-metrics/gcx-wrapper.sh datasources clickhouse list-tables
Important dataset:
- GitHub webhook data
- Database: default
- Note: the default database also contains other non-webhook related tables.
- Learn more about the event and payload: https://docs.github.com/en/webhooks/webhook-events-and-payloads
- Tests
- Database: tests
- tests.all_test_runs - contains every test run. This is an extremely large table, so be considerate with filtering and timing.
- Do not use tests.test_run_s3 as it contains partial data only.
To get additional guidance on common queries, clone https://github.com/pytorch/test-infra into a temporary directory and read the `torchci` folder.
Example Queries
Within the pytorch/pytorch repo on main, list the top most failing workflow jobs in the last 2 weeks:
.claude/skills/ci-metrics/gcx-wrapper.sh datasources clickhouse query "
SELECT name, count(DISTINCT id) AS failures
FROM default.workflow_job
WHERE conclusion = 'failure'
AND completed_at >= now() - INTERVAL 2 WEEK
AND repository_full_name = 'pytorch/pytorch'
AND head_branch = 'main'
GROUP BY name ORDER BY failures DESC LIMIT 10"For a test file, how many times was it run in the last week? How many times did it pass or fail?
.claude/skills/ci-metrics/gcx-wrapper.sh datasources clickhouse query "
SELECT
file,
classname,
name,
count() AS runs,
countIf(failure_count = 0 AND error_count = 0 AND skipped_count = 0) AS successful,
countIf(failure_count > 0 OR error_count > 0) AS fails,
countIf(skipped_count > 0) AS skipped
FROM tests.all_test_runs
WHERE time_inserted >= now() - INTERVAL 7 DAY
AND file = 'lazy/test_ts_opinfo.py'
GROUP BY file, classname, name
ORDER BY runs DESC"CI Infrastructure
CI infrastructure metrics are stored in `grafanacloud-pytorchci-prom`. To get a better understanding of the data, clone these repositories in a temporary directory:
- https://github.com/pytorch/ci-infra - In `/osdc` contains the code for OSDC, the infra running PyTorch's CI. Read it to understand how metrics are exported and what metrics are available. Read the docs in /osdc/docs to understand the scope and project setup.
- https://github.com/jeanschmidt/actions-runner-controller - To understand how actions-runner-controller exposes data.
Example Queries
Which runner types have the deepest queue right now (jobs assigned but not yet running)?
.claude/skills/ci-metrics/gcx-wrapper.sh datasources prometheus query -d grafanacloud-prom 'topk(10, clamp_min(sum by (name) (gha_assigned_jobs) - sum by (name) (gha_running_jobs), 0))'
How many jobs were running per cluster over the last 6 hours, sampled every 30 minutes? Use `--since`/`--step` (or `--from`/`--to`) for a range query:
.claude/skills/ci-metrics/gcx-wrapper.sh datasources prometheus query -d grafanacloud-prom 'sum by (cluster) (gha_running_jobs)' --since 6h --step 30m
Tensors and Dynamic neural networks in Python with strong GPU acceleration
Other skills on pytorch.
- /add-uint-support
Add unsigned integer (uint) type support to PyTorch operators by updating AT_DISPATCH macros. Use when adding support for uint16, uint32, uint64 types to operators, kernels, or when user mentions enabling unsigned types, barebones unsigned types, or uint support.
Open skill - /aoti-debug
Debug AOTInductor (AOTI) errors and crashes. Use when encountering AOTI segfaults, device mismatch errors, constant loading failures, or runtime errors from aot_compile, aot_load, aoti_compile_and_package, or aoti_load_package.
Open skill - /at-dispatch-v2
Convert PyTorch AT_DISPATCH macros to AT_DISPATCH_V2 format in ATen C++ code. Use when porting AT_DISPATCH_ALL_TYPES_AND*, AT_DISPATCH_FLOATING_TYPES*, or other dispatch macros to the new v2 API. For ATen kernel files, CUDA kernels, and native operator implementations.
Open skill - /cuda-index-width
Choose 32-bit vs 64-bit index math in PyTorch CUDA kernels. Use when fixing large-tensor indexing overflows, deciding whether to use int64_t, canUse32BitIndexMath, CUDA_KERNEL_LOOP_TYPE, or AT_DISPATCH_INDEX_TYPES, and when considering binary-size or performance impact of
Open skill - /distributed-triage
Sub-triages issues in the oncall:distributed queue by assigning distributed module labels, routing to sub-oncalls, and marking triaged. Use when an issue has been routed to oncall:distributed and needs second-level triage.
Open skill - /docstring
Write docstrings for PyTorch functions and methods following PyTorch conventions. Use when writing or updating docstrings in PyTorch code.
Open skill

