Build clearance.csv from a gift shop's input.json (items with sku, priceCents, weeks in stock). Use whenever asked to compute clearance rail prices, markdowns, or slow-stock discounts from input.json, even if the rules are not spelled out.
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-d3cc9023)
---
name: clearance-markdowns
description: Build clearance.csv from a gift shop's input.json (items with sku, priceCents, weeks in stock). Use whenever asked to compute clearance rail prices, markdowns, or slow-stock discounts from input.json, even if the rules are not spelled out.
---
# Clearance markdowns
Read `input.json` in the working folder and write `clearance.csv` beside it. You cannot run code, so do the arithmetic by hand, carefully, in whole cents (integers).
## Rules
For each item in `items`:
1. **Weeks 0-3: skip the item** (not slow-selling yet; it does not appear in the output).
2. **Weeks 4-7: 25% off**, i.e. the new price is 75% of the ticket price.
3. **Weeks 8 or more: 50% off**, i.e. 50% of the ticket price.
4. **Round down, never up, to a multiple of 5 cents.** Compute the discounted cents exactly (75% = priceCents*3/4, 50% = priceCents/2), drop any fraction of a cent, then drop to the nearest multiple of 5 at or below it. (This is why 6999 at 50% = 3499.5 gives 34.95, and 1998 at 75% = 1498.5 gives 14.95.)
## Output
- First line exactly: `sku,was,now`
- One row per qualifying item: `sku,was,now` where `was` is priceCents / 100 and `now` is the clearance cents / 100, both with exactly 2 decimals, no currency symbol, no thousands separators (e.g. `24.00`, `9.80`).
- Sort rows by sku ascending (plain alphabetical/ASCII order), not input order.
- Plain commas, newline line endings, a newline after the last row. If no item qualifies, the file contains only the header line.
## Procedure
1. Read input.json.
2. For each item, decide the tier from `weeks`; list the qualifying ones with their cents values.
3. Calculate: tier cents, then floor to a multiple of 5. Double-check each by multiplying back (e.g. 899*3 = 2697, /4 = 674.25 → 674 → 670 → `6.70`).
4. Sort by sku, format with 2 decimals, write clearance.csv.
## Worked checks
- 1998c, 4 wks: 1998*3/4 = 1498.5 → 1495 → `19.98,14.95`
- 1499c, 6 wks: 1124.25 → 1120 → `14.99,11.20`
- 1310c, 7 wks: 982.5 → 980 → `13.10,9.80`
- 2650c, 12 wks: 1325 → `26.50,13.25`
- 1200c, 3 wks: skipped