Compute rail delay-repay compensation from an input.json of journeys (ticket, fare, departDue, departed, arriveDue, arrived) and write delay-payouts.csv beside it. Use whenever asked to calculate passenger payouts, delay refunds or compensation for late or cancelled train services from journey timetable data.
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-af1a4c3c)
---
name: delay-repay-claims
description: Compute rail delay-repay compensation from an input.json of journeys (ticket, fare, departDue, departed, arriveDue, arrived) and write delay-payouts.csv beside it. Use whenever asked to calculate passenger payouts, delay refunds or compensation for late or cancelled train services from journey timetable data.
---
# Delay-repay payouts
Read `input.json` in the working folder and write `delay-payouts.csv` in the same folder. You can't run code, so work each journey out by hand, carefully.
## Rules (derived from the worked examples)
For each journey, in input order:
1. **Cancelled**: if `arrived` is null (or `departed` is null), the service was cancelled. Delay column is the word `cancelled`; payout is 100% of fare.
2. **Otherwise** delay = minutes from `arriveDue` to `arrived`. Only arrival counts; ignore departure lateness. Convert each HH:MM to minutes (hours*60 + minutes) and subtract. Early arrival gives a negative delay, which is treated as no delay.
3. Payout tier by arrival delay in whole minutes:
- under 15: no payout, **omit the journey from the CSV entirely**
- 15 to 29: 25% of fare
- 30 to 59: 50% of fare
- 60 or more: 100% of fare
Boundaries are inclusive at the lower end (15 pays, 14 doesn't; 30 is 50%, 29 is 25%; 60 is 100%, 59 is 50%).
4. Payout is in dollars with exactly two decimals (e.g. `18.00`, `5.00`, `13.00`). Fares are whole dollars, so 25% or 50% gives at most .25/.50/.75; if a fare is fractional, round to the nearest cent.
## Output
`delay-payouts.csv`, with this header then one line per paid journey, in input order, comma-separated, no quotes or spaces, newline-terminated:
```
ticket,delay,payout
RT-2207,30,18.00
RT-1096,cancelled,13.00
```
The delay column holds the integer minutes (no unit) or `cancelled`. If no journey qualifies, write only the header line.
## Check before finishing
- Recompute each delay from the arrival times (not departure) and double-check subtractions across the hour (e.g. 10:05 to 10:35 = 30; 11:50 to 12:05 = 15; 07:45 to 08:44 = 59).
- Confirm excluded journeys really were under 15 minutes (or early), and none were dropped by mistake.
- Confirm the file is written next to input.json.
## Worked check
Fare 26, due 11:40, arrived 12:25: delay 45, tier 50%, payout `13.00`.
Fare 16, due 13:00, arrived 13:29: delay 29, tier 25%, payout `4.00`.