Skip to content
Back to skills

Return Refunds

ASecurity

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.

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

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

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: 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.

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

Comments

Loading comments…

Newsletter

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