Compute late fees for a neighbourhood tool library from input.json (returns with tool, member, outDay, dueDays, backDay) and write late-fees.csv beside it. Use whenever asked to work out tool-library late returns, member late fees, or to produce late-fees.csv, even if the rules are not restated.
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 Tool Return Fees?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/gabrielmoreira-tool-return-fees-0304b644)
---
name: tool-return-fees
description: Compute late fees for a neighbourhood tool library from input.json (returns with tool, member, outDay, dueDays, backDay) and write late-fees.csv beside it. Use whenever asked to work out tool-library late returns, member late fees, or to produce late-fees.csv, even if the rules are not restated.
---
# Tool return late fees
Work by hand: read the file, do the arithmetic carefully, write the CSV. No code can be run.
## Rules (derived from the worked examples)
For each entry in `returns`:
1. `due = outDay + dueDays` (the due day itself is still on time).
2. `daysLate = backDay - due`. If `daysLate <= 0`, the return is on time: ignore it entirely.
3. Otherwise the tool is late and its fee is `min(daysLate, 5)` pounds (£1 per day late, capped at £5 per tool).
Per member (match names exactly as written):
- `late_tools` = number of that member's late returns.
- `fee` = sum of the per-tool fees (the cap applies per tool, not per member, so a member can owe more than 5).
- Members with no late returns do not appear at all.
## Output
Write `late-fees.csv` in the same folder as `input.json`, overwriting any existing file:
```
member,late_tools,fee
```
followed by one line per member, sorted by:
1. `fee` descending,
2. then `member` name ascending (alphabetical) for ties.
Plain integers, no pound signs, no quotes, no spaces, newline-separated. If no member is late, write just the header line.
## Procedure
1. Read input.json.
2. List every return as: member, due, daysLate, tool fee. Write this working out in your reply so you can check it.
3. Group by member, total the counts and fees.
4. Sort, then write the file.
5. Re-check: each late return counted once, caps applied, ties alphabetical.
## Check against examples
- Gil: drill out 3, due 10, back 10 → on time. Sander out 4 + 3 = 7, back 9 → 2 late, £2. Gil,1,2.
- Dana: ladder due 8, back 16 → 8 late, capped to 5. Dana,1,5.
- Kemal: 3 late + 4 late = 7 (neither is capped). Kemal,2,7.
- Brigid and Farah both owe 5; Brigid sorts first alphabetically.