Turn a gift shop's input.json (items with sku, priceCents, weeks in stock) into clearance.csv with markdown prices. Use whenever the user mentions clearance rail, slow-selling stock, markdowns, or clearance prices, or asks for clearance.csv from input.json, even if they don't name the rules.
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-5a069e60)
---
name: clearance-markdowns
description: Turn a gift shop's input.json (items with sku, priceCents, weeks in stock) into clearance.csv with markdown prices. Use whenever the user mentions clearance rail, slow-selling stock, markdowns, or clearance prices, or asks for clearance.csv from input.json, even if they don't name the rules.
---
# Clearance markdowns
Read `input.json` in the working folder and write `clearance.csv` in the same folder. You cannot run code, so do the arithmetic by hand, carefully, using whole numbers only.
## Rules (derived from the shop's worked examples)
For each item in `items`, look at `weeks`:
| weeks in stock | action |
|---|---|
| 0 to 3 | leave off the rail: omit the item from the CSV |
| 4 to 7 | 25% off |
| 8 or more | 50% off |
Compute the new price in cents with integer math, then round **down** to a multiple of 5 cents (never to nearest; never up):
- 25% off: `units = floor(priceCents * 3 / 20)`; `nowCents = units * 5`
- 50% off: `units = floor(priceCents / 10)`; `nowCents = units * 5`
(These are the "75% or 50% of price, rounded down to a 5-cent step" rules in one step.)
Checks: 1998 at 4 weeks: 1998*3=5994, /20=299.7, floor 299, *5 = 1495 -> 14.95. 6999 at 9 weeks: 6999/10=699.9, floor 699, *5 = 3495 -> 34.95. 1499 at 6 weeks: 4497/20=224.85, floor 224 -> 1120 -> 11.20. 1310 at 7 weeks: 3930/20=196.5, floor 196 -> 980 -> 9.80.
## Output
- First line exactly: `sku,was,now`
- One line per kept item: `sku,was,now`, with `was` = priceCents/100 and `now` = nowCents/100, both always with exactly two decimals (24.00, 8.99, 6.70), no currency symbol, no thousands separator, no quotes.
- Sort rows by sku ascending (plain character order, e.g. BWL-03 before MAT-77 before VSE-18), not by input order.
- Use `\n` line endings and end the file with a final newline.
- If no item qualifies, write just the header line.
- Write only the CSV; don't add extra columns, blank lines or commentary inside it.
## Procedure
1. Read input.json. Go through every item; don't skip any, and don't assume the count is 3.
2. Drop items with weeks < 4. Compute the rest as above.
3. Sort by sku, build the lines, write `clearance.csv` beside input.json.
4. Re-verify each row's arithmetic once before finishing.