Skip to content
Back to skills

Delay Repay Claims

ASecurity

Compute rail delay-repay compensation from input.json (journeys with ticket, fare, departDue, departed, arriveDue, arrived) and write delay-payouts.csv beside it. Use whenever asked to calculate passenger compensation, delay payouts, or refunds for late or cancelled train services, even if not named "delay repay".

  • 24 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 6, 2026
development

Security analysis

A100/100

Scanned December 6, 2026

npx -y skills add gabrielmoreira/agent-skills-mirror --skill delay-repay-claims --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Delay Repay Claims?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Delay Repay Claims
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/gabrielmoreira-delay-repay-claims-412bdbd5/badge)](https://www.skillsdirectory.com/skills/gabrielmoreira-delay-repay-claims-412bdbd5)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: delay-repay-claims
description: Compute rail delay-repay compensation from input.json (journeys with ticket, fare, departDue, departed, arriveDue, arrived) and write delay-payouts.csv beside it. Use whenever asked to calculate passenger compensation, delay payouts, or refunds for late or cancelled train services, even if not named "delay repay".
---

# Delay-repay claims

Read `input.json` (in the working folder), work out each journey's payout by hand using the rules below, and write `delay-payouts.csv` in the same folder. You cannot run code, so do the arithmetic carefully and write out your working for each journey before writing the file.

## Rules (derived from the worked examples)

Process each journey in `journeys`, in input order.

1. **Cancelled**: if `departed` is null or `arrived` is null, the service was cancelled. Row: `ticket,cancelled,<fare>` where payout is 100% of the fare.
2. **Otherwise** the delay is measured at **arrival only**, ignoring departure lateness:
   `delay = minutes(arrived) - minutes(arriveDue)`, where minutes(HH:MM) = HH*60 + MM. All times are on the same day.
   Example: due 07:45, arrived 08:44 gives (8*60+44) - (7*60+45) = 524 - 465 = 59.
3. **Payout tier by delay (whole minutes):**
   - delay < 15 (including zero or negative, i.e. early): **no row at all** (no claim).
   - 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: 14 pays nothing, 15 pays 25%, 29 is 25%, 30 is 50%, 59 is 50%, 60 is 100%.
4. A late departure alone earns nothing; an arrival that is 14 minutes late or less earns nothing even if departure was very late.

## Output format

- First line exactly: `ticket,delay,payout`
- One line per paying journey, in input order: `ticket,delay,payout`
  - `delay` is the integer number of minutes, or the word `cancelled`.
  - `payout` has exactly two decimals, no currency symbol (e.g. `18.00`, `4.50`, `13.00`). Compute fare x percentage; if the result has more than two decimals, round half up to cents.
- No quotes, no spaces, no blank lines between rows; end with a newline.
- If nobody is owed anything, the file contains only the header line.

## Procedure

1. Read input.json.
2. For each journey, write a short working line: cancelled? else arriveDue and arrived in minutes, delay, tier, payout.
3. Double-check each delay subtraction and each tier boundary (the 14/15, 29/30, 59/60 edges are where mistakes happen).
4. Write delay-payouts.csv beside input.json with only the paying rows.

## Check against an example

Journeys: fare 24 arrives 14 late -> skipped; fare 36 arrives 30 late -> `RT-2207,30,18.00`; fare 20 arrives 15 late -> `RT-4718,15,5.00`; cancelled fare 13 -> `RT-1096,cancelled,13.00`.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.