Use this skill when a user wants slow-selling gift shop stock marked down for a clearance rail: reading input.json (items with sku, priceCents, weeks in stock) and writing clearance.csv with was/now clearance prices.
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 Clearance Markdowns?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/gabrielmoreira-clearance-markdowns-cb42ccd3)
---
name: clearance-markdowns
description: "Use this skill when a user wants slow-selling gift shop stock marked down for a clearance rail: reading input.json (items with sku, priceCents, weeks in stock) and writing clearance.csv with was/now clearance prices."
---
# Clearance markdowns
Turn `input.json` into `clearance.csv` by applying age-based markdowns. Work by reading and writing files only; do the arithmetic by hand carefully.
## When to use
- Input is `input.json` with `items`: array of `{sku, priceCents, weeks}` (integer cents, whole weeks).
- Do not use for other discount schemes, or for formats other than this CSV.
## Rules
For each item, set the discount percent `d` from `weeks`:
- `weeks >= 8` → `d = 50`
- `4 <= weeks <= 7` → `d = 25`
- `weeks < 4` (including 0 or negative) → item is NOT on clearance; omit it.
New price in cents:
1. `n = floor(priceCents * (100 - d) / 100)` (integer division, drops fractions)
2. `now = n - (n mod 5)` (round DOWN to a multiple of 5 cents, never up)
Never round to nearest; always floor. Do the multiplication exactly, no floating point.
## Steps
1. Read `input.json` from the working folder.
2. Drop items with `weeks < 4`.
3. Compute `now` for the rest.
4. Sort the remaining rows by `sku` ascending (plain string/ASCII order).
5. Write `clearance.csv` beside `input.json`.
## Output format
- First line exactly `sku,was,now`.
- One line per clearance item: `sku,was,now` where `was` = `priceCents/100` and `now` = cents/100, both with exactly 2 decimals, a dot separator, no currency symbol, no quotes.
- Unix newlines, a trailing newline after the last line.
- If no items qualify, write only the header line.
## Edge cases
- Missing/empty `items`: write header only.
- Duplicate skus: keep every row, in input order within the same sku.
- Do not ask questions; if a value is malformed (missing weeks or price), skip that item and mention it in your reply.
- Price 0 gives `0.00,0.00`.
## Worked example
Input: TEE-31 1998c 4w; MUG-07 1200c 3w; SCF-12 2400c 8w.
- TEE-31: d=25 → n=floor(1998*75/100)=1498 → now=1495 → `TEE-31,19.98,14.95`
- MUG-07: 3 weeks → omitted
- SCF-12: d=50 → n=1200 → now=1200 → `SCF-12,24.00,12.00`
```csv
sku,was,now
SCF-12,24.00,12.00
TEE-31,19.98,14.95
```