Process a department store returns-desk queue from input.json (defaultDays, categoryDays, restockPercent, returns[]) into refunds.csv and refused.json. Use whenever asked to process return queues, compute return refunds, restocking fees, or return-window acceptance from such a file, even if the skill isn't named.
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 Return Refunds?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/gabrielmoreira-return-refunds-agent-skills-mirror)
---
name: return-refunds
description: Process a department store returns-desk queue from input.json (defaultDays, categoryDays, restockPercent, returns[]) into refunds.csv and refused.json. Use whenever asked to process return queues, compute return refunds, restocking fees, or return-window acceptance from such a file, even if the skill isn't named.
---
# Return refunds
You cannot run code, so do the arithmetic by hand, carefully, in integers (cents). Never use floating point or decimal percentages.
## Input
Read `input.json` in the working folder: `defaultDays`, `categoryDays` (category -> days), `restockPercent`, and `returns` (each `{ref, category, priceCents, boughtDay, returnedDay, opened}`).
## Steps
1. **For each return, in input order**, compute:
- `kept = returnedDay - boughtDay`
- `window = categoryDays[category]` if that category key exists in categoryDays (even if smaller than defaultDays, and even if 0); otherwise `defaultDays`. Match category names exactly.
- **Accepted if `kept <= window`** (equal is accepted). Otherwise refused.
2. **Refund for accepted items (integer cents):**
- `opened` is false: `refund = priceCents`.
- `opened` is true: `fee = floor(priceCents * restockPercent / 100)` (compute priceCents × restockPercent as an integer, then integer-divide by 100, dropping the remainder; never round up). `refund = priceCents - fee`.
- Check: 1999 × 15 = 29985; ÷100 → 299 (drop 85); refund 1999 − 299 = 1700.
3. **Format dollars from cents**: `refund / 100` with exactly two decimals: whole part = cents ÷ 100 (integer), fractional = cents mod 100 padded to 2 digits. E.g. 1700 → `17.00`, 5 → `0.05`, 4250 → `42.50`. No currency sign, no thousands separators.
4. **Write `refunds.csv`** beside input.json: first line `ref,refund`, then one line per accepted return only, sorted by `returnedDay` ascending. Ties keep input.json order (stable sort). Do the sort by listing accepted items in input order, then placing them by day, earliest first, with equal days staying in original relative order. Newline-separated, no quotes unless a ref contains a comma or quote (then CSV-quote it). If none are accepted, the file contains just the header line.
5. **Write `refused.json`** beside input.json: a JSON array of refused refs as strings, in input.json order, e.g. `["A1","C7"]`; `[]` if none.
## Checks before finishing
- Every ref appears in exactly one of refunds.csv or refused.json; accepted count + refused count = number of returns.
- Recheck each opened item's fee by multiplication and truncation, and each boundary case (kept equal to window → accepted).
- Don't alter input.json. Refs are copied exactly as given.