Summarise a school class register from input.json (array of {pupil, marks} with letters P/L/A/E per day) into register-summary.csv and absence-alerts.json beside it. Use whenever the user mentions a class register, attendance marks, pupil absence summaries, or absence alerts, even if they don't name the files.
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 Class Register?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/gabrielmoreira-class-register-b70a2b08)
---
name: class-register
description: Summarise a school class register from input.json (array of {pupil, marks} with letters P/L/A/E per day) into register-summary.csv and absence-alerts.json beside it. Use whenever the user mentions a class register, attendance marks, pupil absence summaries, or absence alerts, even if they don't name the files.
---
# Class register summary
Input: `input.json` in the working folder: `{"register": [{"pupil": "Maya", "marks": "AAAPPP"}, ...]}`.
`marks` has one letter per school day, in order: P present, L late, A absent, E authorised absence.
Output, written next to `input.json`: `register-summary.csv` and `absence-alerts.json`.
You cannot run code, so compute by hand, carefully. Work one pupil at a time and write out the marks as a numbered list of letters before counting. Counting by eye on long strings is where mistakes happen.
## Rules (derived from the worked examples)
For each pupil:
- **present** = number of `P` plus number of `L`. A late pupil attended, so L counts as present.
- **absent** = number of `A` only. `E` (authorised) is not counted as absent and not as present.
- **longest_absence** = longest run of consecutive `A` marks, where `E` is *neutral*: it neither counts toward the run nor breaks it. Skip over E marks, then find the longest run of A's. A `P` or `L` breaks a run.
- `AEAAP` -> 3 (A, skip E, A, A). `AEAPAA` -> 2 (A,E,A = 2, P breaks, AA = 2). `EALAAP` -> 2. `PELEP` -> 0.
- Easiest method: delete all E letters from the string, then find the longest run of A's in what remains.
Check: present + absent + (number of E) should equal the length of the marks string.
## register-summary.csv
- Header exactly: `pupil,present,absent,longest_absence`
- One row per pupil, in the same order as in `input.json`.
- Plain integers, no quotes, no spaces, newline-separated, trailing newline. (If a name contains a comma or quote, wrap it in double quotes per CSV rules.)
## absence-alerts.json
- A JSON array of pupil name strings for every pupil with `longest_absence >= 3`.
- Order: `longest_absence` descending (largest first). Break ties alphabetically by name, ascending (e.g. Nell before Tom when both are 3). Do not use input order.
- Pupils below 3 are excluded. If nobody qualifies, write `[]`.
- Format with 2-space indentation, one name per line:
```json
[
"Zara",
"Ivan"
]
```
## Worked check
Input order Tom `AAAPAA`, Nell `PAAAEP`, Gia `AEAPAA`, Omar `EALAAP` gives:
```
pupil,present,absent,longest_absence
Tom,1,5,3
Nell,2,3,3
Gia,1,4,2
Omar,2,3,2
```
alerts: `["Nell", "Tom"]` (both 3; alphabetical tie-break).
Other cases: `AAAPPP` -> Maya 3,3,3 (alert); `LLPAAP` -> 4,2,2; `PPPPPL` -> 6,0,0; `AAAAP` -> 1,4,4.
## Procedure
1. Read `input.json`.
2. For each pupil, compute the three numbers using the rules above and run the sum check.
3. Write `register-summary.csv`.
4. Select and sort alert pupils, write `absence-alerts.json`.
5. Re-read both files once to confirm headers, row order, and valid JSON.