Skip to content
Back to skills

Tool Return Fees

ASecurity

Use this skill when a user wants late fees worked out for a tool library or lending scheme: reading returns of borrowed tools (tool, member, outDay, dueDays, backDay) from input.json and writing a per-member late-fees.csv of late tools and whole-pound fees. Not for other fee schemes, or for reports other than late-fees.csv.

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

Security analysis

A100/100

Scanned December 6, 2026

npx -y skills add gabrielmoreira/agent-skills-mirror --skill tool-return-fees --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Tool Return Fees?

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

Security grade badge for Tool Return Fees
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/gabrielmoreira-tool-return-fees-9bfa3af4/badge)](https://www.skillsdirectory.com/skills/gabrielmoreira-tool-return-fees-9bfa3af4)

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: tool-return-fees
description: "Use this skill when a user wants late fees worked out for a tool library or lending scheme: reading returns of borrowed tools (tool, member, outDay, dueDays, backDay) from input.json and writing a per-member late-fees.csv of late tools and whole-pound fees. Not for other fee schemes, or for reports other than late-fees.csv."
---

# Tool return late fees

Compute per-member late fees from `input.json` and write `late-fees.csv` in the same folder. Do the arithmetic by hand, carefully; no scripts are needed.

## Input

`input.json` holds `returns`: an array of `{tool, member, outDay, dueDays, backDay}`. All day values are integers (day numbers / day counts). If the file or `returns` is missing, tell the user and write nothing.

## Rules (derived from the worked examples)

For each return:

- `dueDay = outDay + dueDays`
- `daysLate = backDay - dueDay`
- If `daysLate <= 0` the tool is on time: no fee, not counted as late. Returning exactly on the due day is on time.
- If `daysLate >= 1` the tool is late: `toolFee = min(daysLate, 5)` pounds (1 pound per day late, capped at 5 per tool).

Per member (match `member` exactly, case-sensitive):

- `late_tools` = number of that member's late returns
- `fee` = sum of their `toolFee` values (the cap applies per tool, not per member, so a member can owe more than 5)

## Steps

1. Read `input.json`.
2. For each return compute `dueDay`, `daysLate`, `toolFee` as above. Write the numbers down per return before summing.
3. Group late returns by member and compute `late_tools` and `fee`.
4. Drop members with no late tools.
5. Sort rows by `fee` descending; break ties by member name ascending (alphabetical, case-insensitive).
6. Write `late-fees.csv` beside `input.json`.
7. Re-check each member's sum and the sort order before finishing.

## Output format

- Header line exactly: `member,late_tools,fee`
- One row per member with at least one late tool: `name,count,fee` — integers only, no pound sign, no quotes (unless a name contains a comma or quote, then quote it CSV-style).
- Newline-separated lines, trailing newline at end.
- If nobody is late, write only the header line.
- Empty `returns` array: header only.

## Worked example

Returns: drill/Gil out 3 due 7 back 10 → due 10, on time. ladder/Dana out 1 due 7 back 16 → due 8, 8 late → capped 5. sander/Gil out 4 due 3 back 9 → due 7, 2 late → 2. jigsaw/Abel out 2 due 7 back 12 → due 9, 3 late → 3.

```csv
member,late_tools,fee
Dana,1,5
Abel,1,3
Gil,1,2
```

## Ambiguity

- Back day before out day or non-integer values: treat by the formulas (a negative `daysLate` is on time) and mention the oddity to the user.
- Missing field in a return: skip that return and tell the user.

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 tools →

Comments

Loading comments…

Newsletter

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