Compute clearance-rail prices for a gift shop from input.json (items with sku, priceCents, weeks) and write clearance.csv beside it. Use whenever asked to mark down slow-selling stock, build the clearance list, or produce clearance.csv from stock-age data, 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-agent-skills-mirror)
---
name: clearance-markdowns
description: Compute clearance-rail prices for a gift shop from input.json (items with sku, priceCents, weeks) and write clearance.csv beside it. Use whenever asked to mark down slow-selling stock, build the clearance list, or produce clearance.csv from stock-age data, even if the rules are not spelled out.
---
# 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, with whole numbers (cents).
## Rules (derived from the shop's worked examples)
For each entry in `items` (`sku`, `priceCents`, `weeks`):
1. **weeks 0-3**: not slow-selling. Leave the item out of the CSV entirely.
2. **weeks 4-7**: markdown to 75% of the ticket price.
3. **weeks 8 or more**: markdown to 50% of the ticket price.
4. **Round down to a 5-cent step.** Take the discounted amount in cents, drop any fraction, then reduce it to the nearest multiple of 5 at or below it. Always round down, never to nearest. The shop never rounds a price up.
Integer recipe for `nowCents`:
- weeks 4-7: `t = floor(priceCents * 3 / 4)`; weeks 8+: `t = floor(priceCents / 2)`
- `nowCents = t - (t mod 5)`
Checks: 1998 at 4 weeks: 1498.5 -> 1498 -> **1495**. 899 at 5 weeks: 674.25 -> 674 -> **670**. 6999 at 9 weeks: 3499.5 -> 3499 -> **3495**. 1310 at 7 weeks: 982.5 -> 982 -> **980**. 2400 at 8 weeks: **1200**. 1200 at 3 weeks: excluded.
## Output
- First line exactly `sku,was,now`.
- One line per included item: `sku,was,now`, where `was` is `priceCents` and `now` is `nowCents`, each formatted in dollars with exactly two decimals (1998 -> `19.98`, 2400 -> `24.00`, 670 -> `6.70`, 5 -> `0.05`). No currency symbol, no thousands separator, no quotes, no spaces.
- Sort rows by `sku` ascending in plain character order (alphabetical, so `BWL-03` before `MAT-77`), not by input order.
- Use newline line endings, with a newline after the last row.
- If no item qualifies, write only the header line.
## Steps
1. Read `input.json`.
2. List each item with its tier (exclude, 75%, or 50%) and compute `nowCents`.
3. Sort the included items by sku.
4. Write `clearance.csv` beside `input.json`.
5. Re-check each row's arithmetic and that excluded items are absent.