Skip to content
Back to skills

Return Refunds

ASecurity

Use this skill when a user wants to process a department store returns queue: decide which returned items are accepted or refused under return windows, compute refunds with restocking fees for opened items, and produce a refunds CSV and a refused list from input.json.

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

Security analysis

A100/100

Scanned December 6, 2026

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

Installs into .claude/skills of the current project.

Are you the author of Return Refunds?

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

Security grade badge for Return Refunds
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/gabrielmoreira-return-refunds-566c7719/badge)](https://www.skillsdirectory.com/skills/gabrielmoreira-return-refunds-566c7719)

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: return-refunds
description: "Use this skill when a user wants to process a department store returns queue: decide which returned items are accepted or refused under return windows, compute refunds with restocking fees for opened items, and produce a refunds CSV and a refused list from input.json."
---

# Return refunds

Process a returns-desk queue from `input.json` into `refunds.csv` and `refused.json`, by reading and writing files only. No commands are needed; do the arithmetic by hand, carefully.

## When to use
- Use for a queue of returns with return windows, restocking fees and refunds in `input.json`.
- Do not use for exchanges, store credit, tax, shipping, or other refund policies not described here.

## Input
`input.json` in the working folder (beside where outputs go):
- `defaultDays`: integer window.
- `categoryDays`: object mapping some categories to their own window.
- `restockPercent`: integer.
- `returns`: array of `{ref, category, priceCents, boughtDay, returnedDay, opened}`; refs are unique.

If a field is missing or malformed, do the best reasonable thing: treat missing `categoryDays` as `{}`, and a missing `returns` as an empty list. Note any such assumption in your reply. Do not ask questions.

## Steps
1. Read `input.json`. Number the returns 0, 1, 2... in file order.
2. For each return compute:
   - `kept = returnedDay - boughtDay` (may be 0 or negative; use as is).
   - `window = categoryDays[category]` if the category is a key of `categoryDays` (even if smaller than `defaultDays`, and even if 0); otherwise `defaultDays`. Match the category exactly (case-sensitive).
   - Accepted if `kept <= window`; otherwise refused. Last day of the window is accepted. Negative `kept` is accepted (it is ≤ window unless window is negative).
3. For each accepted return compute the refund in integer cents:
   - `opened` false: `refundCents = priceCents`.
   - `opened` true: `fee = floor(priceCents * restockPercent / 100)` (drop any fraction, never round up); `refundCents = priceCents - fee`.
   - Compute with integers: multiply first, then integer-divide by 100. Example: 1999*15 = 29985; 29985 div 100 = 299.
4. Format dollars: `refundCents div 100`, a dot, then `refundCents mod 100` padded to two digits. Examples: 4250 → `42.50`, 5 → `0.05`, 0 → `0.00`. No currency sign, no thousands separators.
5. Sort accepted returns by `returnedDay` ascending; ties keep file order (stable sort — use the file index as tiebreaker). Negative days sort naturally as numbers (not as text).
6. Write `refunds.csv` beside `input.json`: first line `ref,refund`, then one line `ref,amount` per accepted return, newline-terminated lines, no quoting unless a ref contains a comma or quote (then quote per CSV rules). Refused returns are not listed. If none are accepted, the file contains only the header line.
7. Write `refused.json` beside `input.json`: a JSON array of refused refs as strings, in `input.json` order, e.g. `["A2","A7"]`; `[]` if none.
8. Re-read both outputs and check: row count + refused count = number of returns; every ref appears exactly once across the two files; amounts have exactly two decimals; recheck each fee calculation.

## Worked example
`defaultDays` 30, `restockPercent` 15, `categoryDays` `{"electronics": 14}`.
- J1 clothing, 1999, bought 100, returned 130, opened → kept 30 ≤ 30, accepted; fee 299; refund 1700 → `17.00`.
- E1 electronics, 5000, bought 10, returned 25, unopened → kept 15 > 14, refused.
- S1 shoes, 4250, bought 50, returned 60, unopened → accepted, `42.50`.

`refunds.csv`:
```
ref,refund
S1,42.50
J1,17.00
```
`refused.json`: `["E1"]`

## Limits
Nothing is run; all computation is manual. Prefer working through each return explicitly in order rather than estimating.

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.