Skip to content
Back to skills

Delay Repay Claims

ASecurity

Use this skill when a user wants rail delay-repay compensation worked out: reading journeys (ticket, fare, timetabled vs actual times, cancelled services) from input.json and producing a delay-payouts.csv of refunds owed to late or cancelled passengers. Not for fare calculation, ticket sales or timetable planning.

  • 24 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added December 6, 2026
business

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-7a55e176/badge)](https://www.skillsdirectory.com/skills/gabrielmoreira-delay-repay-claims-7a55e176)

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: "Use this skill when a user wants rail delay-repay compensation worked out: reading journeys (ticket, fare, timetabled vs actual times, cancelled services) from input.json and producing a delay-payouts.csv of refunds owed to late or cancelled passengers. Not for fare calculation, ticket sales or timetable planning."
---

# Delay-repay claims

Compute passenger compensation for late or cancelled rail services and write `delay-payouts.csv`. Do the arithmetic by hand, carefully; no program is needed.

## Inputs

`input.json` in the working folder:
`{"journeys": [{ticket, fare, departDue, departed, arriveDue, arrived}, ...]}`
- `fare`: dollars (may have decimals).
- Times: 24-hour `HH:MM`, all on the same day.
- `departed` and `arrived` are `null` for a cancelled service.

If the file is missing or has no `journeys` array, tell the user and write nothing. An empty array gives a header-only CSV.

## Rules

For each journey, in input order:

1. **Cancelled** if `departed` is null OR `arrived` is null. Delay column = `cancelled`, payout = 100% of fare.
2. Otherwise convert to minutes: `m(HH:MM) = HH*60 + MM`.
   `delay = m(arrived) - m(arriveDue)`. Only the **arrival** delay counts; departure lateness is ignored (a train leaving 15 min late but arriving 7 late pays nothing).
3. Payout rate from `delay` (whole minutes):
   - `delay < 15` (including zero and negative, i.e. early): **no payout, omit the row entirely**.
   - `15 <= delay <= 29`: 25% of fare
   - `30 <= delay <= 59`: 50% of fare
   - `delay >= 60`: 100% of fare
   Boundaries are exact: 14 pays nothing, 15 pays 25%, 29 is 25%, 30 is 50%, 59 is 50%, 60 is 100%.
4. `payout = fare * rate`, rounded half up to 2 decimals, always printed with exactly 2 decimals (`5.00`, `4.00`, `13.50`). No currency symbol.

## Output

Write `delay-payouts.csv` beside `input.json` (same folder, overwrite if present):
- First line exactly `ticket,delay,payout`.
- One line per qualifying or cancelled journey, in input order: `ticket,delay,payout`.
- `delay` is an integer number of minutes, or the word `cancelled`.
- Unix newline-terminated lines, no quotes, no blank lines, no extra columns.

## Steps

1. Read `input.json`.
2. For each journey apply the rules above; jot down delay and rate for each.
3. Re-check every boundary case and every multiplication.
4. Write the CSV, then re-read it to confirm the header, row order and 2-decimal payouts.

## Ambiguities

- Fare missing or non-numeric on a qualifying journey: skip nothing silently; compute what you can and tell the user which ticket was affected.
- Ticket with a cancelled flag but also times: treat as cancelled only when either time is null.
- Don't invent extra rules (caps, minimums, departure delay).

## Example

Input journey `{"ticket":"RT-2207","fare":36,"arriveDue":"10:05","arrived":"10:35",...}`: delay = 635 - 605 = 30, rate 50%, payout 18.00 → `RT-2207,30,18.00`.
A journey with delay 14 yields no row; `{"ticket":"RT-1096","fare":13,"departed":null,...}` → `RT-1096,cancelled,13.00`.

Full output for a mix:
```csv
ticket,delay,payout
RT-2207,30,18.00
RT-4718,15,5.00
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 business →

Comments

Loading comments…

Newsletter

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