Use this skill when a user wants rail delay-repay compensation worked out: calculating payouts for late or cancelled train journeys from a journeys list (ticket, fare, due and actual times) and writing delay-payouts.csv. Not for refunds of unrelated tickets or other CSV tasks.
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 Delay Repay Claims?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/gabrielmoreira-delay-repay-claims-51ef4ea1)
---
name: delay-repay-claims
description: "Use this skill when a user wants rail delay-repay compensation worked out: calculating payouts for late or cancelled train journeys from a journeys list (ticket, fare, due and actual times) and writing delay-payouts.csv. Not for refunds of unrelated tickets or other CSV tasks."
---
# Delay-repay claims
Compute passenger compensation for late or cancelled rail services and write `delay-payouts.csv`.
## Inputs
- `input.json` in the working folder: `{"journeys": [{ticket, fare, departDue, departed, arriveDue, arrived}, ...]}`.
- `fare` is dollars (number). Times are 24-hour `HH:MM`, same day. `departed` and `arrived` are `null` for a cancelled service.
- If `input.json` is missing or has no `journeys` array, stop and tell the user. An empty array is valid: write only the header.
## Rules
Process journeys in input order.
1. Cancelled: `departed` is null OR `arrived` is null. Row is `ticket,cancelled,<fare>` (100% of fare).
2. Otherwise, minutes = `H*60+M` of each time. `delay = arrived - arriveDue` (ARRIVAL delay only; ignore departure times).
3. Payout fraction by delay (integer minutes):
- delay < 15 (including 0 and negative, i.e. early): no payout, **omit the row**.
- 15 <= delay <= 29: 25% of fare
- 30 <= delay <= 59: 50% of fare
- delay >= 60: 100% of fare
4. `payout = fare * fraction`, rounded half up to 2 decimals, always printed with exactly 2 decimals (`5.00`, not `5`). No currency symbol.
5. A delay row prints delay as a plain integer of minutes (`59`, not `59 min`).
Boundaries: 14 -> none, 15 -> 25%, 29 -> 25%, 30 -> 50%, 59 -> 50%, 60 -> 100%.
## Steps
1. Read `input.json`.
2. For each journey apply the rules above; work the minutes arithmetic out explicitly (e.g. 10:35 - 10:05 = 635 - 605 = 30).
3. Write `delay-payouts.csv` next to `input.json`: first line exactly `ticket,delay,payout`, then one row per qualifying journey, comma-separated, no quotes, no spaces, newline-terminated lines.
4. Re-read the file and check: row count, order, 2-decimal payouts, no row for on-time or early journeys.
## Ambiguity
- Arrival earlier than due time by crossing midnight is not expected; if `arrived < arriveDue` treat as early (no payout).
- Do not ask questions; if a field is malformed for one journey, skip it and mention it in the reply.
## Example
Journeys: RT-2207 fare 36, due 10:05 arrived 10:35 -> delay 30 -> 50% -> `RT-2207,30,18.00`. RT-4718 fare 20, due 11:50 arrived 12:05 -> 15 -> `RT-4718,15,5.00`. RT-5310 arrived 14 min late -> omitted. RT-1096 fare 13 cancelled -> `RT-1096,cancelled,13.00`.
```csv
ticket,delay,payout
RT-2207,30,18.00
RT-4718,15,5.00
RT-1096,cancelled,13.00
```