Skip to content
Back to skills

Return Refunds

ASecurity

Use this skill when you need to work through a department store returns desk queue: decide which returned items are accepted or refused under return-window rules (default and per-category days), apply restocking fees on opened items, and produce a refunds CSV plus a list of refused refs. Not for exchanges, store credit, or other refund policies.

  • 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-1d599125/badge)](https://www.skillsdirectory.com/skills/gabrielmoreira-return-refunds-1d599125)

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 you need to work through a department store returns desk queue: decide which returned items are accepted or refused under return-window rules (default and per-category days), apply restocking fees on opened items, and produce a refunds CSV plus a list of refused refs. Not for exchanges, store credit, or other refund policies."
---

# Return refunds

Process `input.json` (in the working folder) into `refunds.csv` and `refused.json` beside it. Do all arithmetic by hand, carefully, with integers only.

## Input

`input.json` fields:
- `defaultDays` (int), `restockPercent` (int)
- `categoryDays`: object mapping some categories to their own window
- `returns`: array of `{ref, category, priceCents, boughtDay, returnedDay, opened}`; refs are unique.

If the file or a required field is missing, say so and stop rather than guessing. An empty `returns` array is valid (see Outputs).

## Steps

For each return, in input order:

1. `kept = returnedDay - boughtDay`.
2. `window = categoryDays[category]` if the category is a key in `categoryDays`, else `defaultDays`. A category entry always wins, even if shorter than `defaultDays`. A window of 0 is valid (only same-day returns pass).
3. Accepted if `kept <= window`; otherwise refused. Last day of the window is accepted. If `kept` is negative (returned before bought), it is `<= window` so it is accepted by the rule; do not treat it specially, but mention it in your reply.
4. If accepted:
   - `opened` false: `refundCents = priceCents`.
   - `opened` true: `feeCents = floor(priceCents * restockPercent / 100)` (drop any fraction, never round up; use integer division), `refundCents = priceCents - feeCents`.
5. Format refund as dollars: `refundCents / 100` with exactly two decimals, no currency sign. Compute as integer part `floor(refundCents/100)`, then `.`, then `refundCents mod 100` padded to two digits. E.g. 1700 -> `17.00`, 5 -> `0.05`, 4250 -> `42.50`. Never use floating point.

## Outputs

**`refunds.csv`**: first line `ref,refund`, then one row per accepted return, `ref,amount`. Sort accepted rows by `returnedDay` ascending; ties keep their relative order from `input.json` (stable sort). Refused returns are omitted. If none accepted, the file contains only the header. Use plain `\n` line endings, ending with a newline. Do not quote values unless a ref contains a comma or quote (then use CSV quoting).

**`refused.json`**: JSON array of refused refs (strings, as in input), in `input.json` order. No accepted refs. Empty queue/none refused: `[]`.

## Check before finishing

- Row count in CSV + length of refused array = number of returns.
- Each refund re-computed once; fees rounded down.
- Dates sorted by `returnedDay`, stable on ties.
- Re-open both written files and confirm format.

## Example

`defaultDays` 30, `categoryDays` `{"electronics": 14}`, `restockPercent` 15.

| ref | category | price | bought | returned | opened | result |
|---|---|---|---|---|---|---|
| A | clothing | 1999 | 100 | 130 | true | kept 30 <= 30; fee floor(1999*15/100)=299; refund 1700 -> 17.00 |
| B | electronics | 5000 | 100 | 115 | false | kept 15 > 14; refused |
| C | clothing | 1000 | 120 | 125 | false | kept 5; refund 10.00 |

`refunds.csv`:
```
ref,refund
C,10.00
A,17.00
```
(C returned on day 125, before A on day 130.)

`refused.json`: `["B"]`

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.