Use this skill when you need to assign monitoring alerts to on-call engineers from a rota and produce a paging list and per-engineer page counts, e.g. 'who gets paged for each alert', 'build pages.csv and page-load.json from input.json'. Not for general scheduling, shift calendars or alert deduplication.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Pager Rota?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/gabrielmoreira-pager-rota-9ec1f1e5)
---
name: pager-rota
description: "Use this skill when you need to assign monitoring alerts to on-call engineers from a rota and produce a paging list and per-engineer page counts, e.g. 'who gets paged for each alert', 'build pages.csv and page-load.json from input.json'. Not for general scheduling, shift calendars or alert deduplication."
---
# Pager rota
Assign each alert to an engineer from `rota`, keeping a service's burst of alerts with one engineer and otherwise rotating round-robin.
## Inputs
`input.json` in the working folder: `rota` (array of engineer names, in order) and `alerts` (array of `{id, service, minute}`; minutes are unique integers). If the file or either field is missing, stop and report it; do not invent data.
## Outputs (beside input.json)
- `pages.csv`: header `alert,engineer`, then one line per alert, `id,engineer`, in ascending `minute` order (normally the input order). LF line endings, no quotes, no blank lines or spaces.
- `page-load.json`: one JSON object, keys are every rota name in rota order, values are integer page counts (0 if none). Indent 2 spaces.
## Algorithm
Process alerts sorted by `minute` ascending. Keep:
- `next` = 0 (index into rota),
- per service: `lastMinute` and `lastEngineer` (initially none).
For each alert `a`:
1. If the service has a previous alert and `a.minute - lastMinute <= 10`, it is a **continuation**: engineer = `lastEngineer`. It adds nothing to the load and does not move `next`.
2. Otherwise it is a **new page**: engineer = `rota[next]`; `next = (next + 1) mod len(rota)`; load[engineer] += 1.
3. In both cases set the service's `lastMinute = a.minute` (the window slides from the most recent alert of that service, not the first) and `lastEngineer = engineer`.
Gap of exactly 10 continues; 11 or more is a new page. Services are tracked independently, and a continuation never depends on other services' alerts.
Load counts new pages only, not every alert.
## Edge cases
- No alerts: `pages.csv` is only the header; `page-load.json` lists all rota names with 0.
- Empty rota with alerts: stop and report; no valid assignment exists. Empty rota and no alerts: header only and `{}`.
- Duplicate rota names: keep the first occurrence only for the load keys; rotation still uses the rota as listed.
- Input not sorted by minute: sort first (minutes are unique so no ties).
## Steps
1. Read `input.json`.
2. Sort alerts by minute and apply the algorithm, writing a trace as you go (alert, service, gap, continuation/new, engineer).
3. Write both files, then re-read them and check: row count equals alert count; sum of loads equals number of new pages.
## Worked example
rota `[maya, tom, li]`; alerts db@0, web@4, db@10, db@21, web@30.
- db@0 new -> maya (next=1); web@4 new -> tom (next=2); db@10 gap 10 continuation -> maya; db@21 gap 11 new -> li (next=0); web@30 gap 26 new -> maya.
- pages.csv: `AL-201,maya` / `AL-202,tom` / `AL-203,maya` / `AL-204,li` / `AL-205,maya`.
- page-load.json: `{"maya": 2, "tom": 1, "li": 1}` (written indented).