Use this skill when the user wants a class attendance register summarised: per-pupil present/absent counts, longest absence streak, and a list of pupils to flag for repeated absence, from marks of P, L, A and E per school day in input.json. Not for timetables, grades or other spreadsheets.
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-88ef92d8)
---
name: class-register
description: "Use this skill when the user wants a class attendance register summarised: per-pupil present/absent counts, longest absence streak, and a list of pupils to flag for repeated absence, from marks of P, L, A and E per school day in input.json. Not for timetables, grades or other spreadsheets."
---
# Class register summary
Turn `input.json` (a register of per-day attendance marks) into `register-summary.csv` and `absence-alerts.json`, both written beside `input.json`. Do the work by reading and writing files; no commands are needed.
## Input
`input.json`: `{"register": [{"pupil": "Maya", "marks": "AAAPPP"}, ...]}`. `marks` has one letter per school day, in day order: `P` present, `L` late, `A` absent, `E` authorised absence. Pupil names are unique.
## Rules per pupil
Scan `marks` left to right.
- `present` = number of `P` plus number of `L` (late counts as present).
- `absent` = number of `A` only. `E` is not counted as absent or present.
- `longest_absence` = longest run of `A` marks, where `E` is transparent: it neither adds to the run nor breaks it. `P` and `L` break the run (reset to 0). Example: `AEAAP` -> run 3. Track `run`: on `A` run = run+1 and update max; on `E` leave run unchanged; on `P`/`L` run = 0.
- Empty `marks` gives 0, 0, 0.
- Check: present + absent + count(E) = length of marks.
## Alerts
A pupil is alerted when `longest_absence >= 3`. Order the alerted names by `longest_absence` descending; break ties alphabetically by name (ascending, case-sensitive plain comparison). If nobody qualifies, the output is `[]`.
## Output
1. `register-summary.csv`: header `pupil,present,absent,longest_absence`, then one row per pupil in the input order, comma separated, no spaces, newline after each row, no quoting unless a name contains a comma or quote (then use standard CSV quoting).
2. `absence-alerts.json`: a JSON array of name strings, 2-space indented, one name per line, e.g.
```json
[
"Zara",
"Ivan"
]
```
## Steps
1. Read `input.json`.
2. For each pupil compute the three numbers by hand, character by character; do not estimate. Re-verify with the check above.
3. Determine alerted pupils and sort them.
4. Write both files, overwriting existing ones.
5. Re-read the written files to confirm content.
## Edge cases
- Lowercase marks: treat as uppercase. Any other character: ignore it for counts, leave runs unchanged, and mention it in the reply.
- Empty `register`: CSV has the header only; alerts is `[]`.
- Missing or malformed `input.json`: do not invent data; tell the user what is wrong.
## Worked example
Input marks: Tom `AAAPAA`, Nell `PAAAEP`, Gia `AEAPAA`, Omar `EALAAP`.
```csv
pupil,present,absent,longest_absence
Tom,1,5,3
Nell,2,3,3
Gia,1,4,2
Omar,2,3,2
```
Alerts: Tom and Nell both have 3, so alphabetical: `["Nell", "Tom"]`.