Skip to content
Back to skills

Clearance Markdowns

ASecurity

Use this skill when a gift shop or retailer wants slow-selling stock moved to a clearance rail with markdown prices worked out from ticket price and weeks in stock, e.g. reading input.json items (sku, priceCents, weeks) and writing clearance.csv with was/now prices. Not for general discounts, sales tax, or promotions unrelated to stock age.

  • 24 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added December 6, 2026
toolsgogit

Security analysis

A100/100

Scanned December 6, 2026

npx -y skills add gabrielmoreira/agent-skills-mirror --skill clearance-markdowns --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Clearance Markdowns?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Clearance Markdowns
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/gabrielmoreira-clearance-markdowns-f41682bc/badge)](https://www.skillsdirectory.com/skills/gabrielmoreira-clearance-markdowns-f41682bc)

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: clearance-markdowns
description: "Use this skill when a gift shop or retailer wants slow-selling stock moved to a clearance rail with markdown prices worked out from ticket price and weeks in stock, e.g. reading input.json items (sku, priceCents, weeks) and writing clearance.csv with was/now prices. Not for general discounts, sales tax, or promotions unrelated to stock age."
---

# Clearance markdowns

Turn `input.json` (stock with ticket price and age) into `clearance.csv` (the items that go on the clearance rail, with their new prices).

## Input
`input.json` in the working folder: `{"items": [{"sku": string, "priceCents": integer, "weeks": integer}, ...]}`. `priceCents` is the ticket price in cents; `weeks` is whole weeks in stock.

## Rules (all integer arithmetic, no floating point)
For each item, with `p = priceCents` and `w = weeks`:

| weeks | on clearance? | nowCents |
|---|---|---|
| `w < 4` (including 0 and negatives) | No: omit the item | n/a |
| `4 <= w <= 7` | Yes, 25% off | `5 * floor(p * 15 / 100)` |
| `w >= 8` | Yes, 50% off | `5 * floor(p / 10)` |

These are 75% / 50% of the price, rounded **down** to a multiple of 5 cents (never rounded up or to nearest). Compute `p * 15` exactly, divide by 100, drop the remainder, multiply by 5.

## Steps
1. Read `input.json`.
2. Drop every item with `weeks < 4`.
3. For each remaining item compute `nowCents` from the table.
4. Sort the remaining rows by `sku`, ascending, plain character-by-character comparison (digits before uppercase letters before lowercase). Do not keep input order.
5. Write `clearance.csv` beside `input.json`.

## Output format
- First line exactly `sku,was,now`.
- One row per clearance item: `sku,was,now`, where `was` = `priceCents` and `now` = `nowCents`, each formatted as dollars with exactly two decimals: `cents / 100`, `.`, `cents mod 100` padded to 2 digits. No currency symbol, no thousands separator (`7005` -> `70.05`, `5` -> `0.05`, `0` -> `0.00`).
- No quoting or spaces; LF line endings; a newline after the last line.
- Every item keeps its own row, even with a duplicate sku.

## Edge cases
- No items qualify, or `items` is empty: write just the header line.
- Missing `sku`, non-integer or negative `priceCents`, or missing `weeks`: skip nothing silently; keep going with valid items and tell the user which entries were invalid and skipped. If `weeks` is a non-integer number, floor it.
- Very cheap items: `p < 7` at 25% gives `now = 0.00`; that is the correct result, keep it.
- If `input.json` is missing, tell the user; do not invent data.

## Worked example
Input items: TEE-31 (1998, 4 wks), MUG-07 (1200, 3 wks), SCF-12 (2400, 8 wks).
- MUG-07: 3 < 4, omitted.
- TEE-31: `1998*15 = 29970`, /100 -> 299, *5 = 1495 -> `14.95`.
- SCF-12: `2400/10 = 240`, *5 = 1200 -> `12.00`.

```csv
sku,was,now
SCF-12,24.00,12.00
TEE-31,19.98,14.95
```

More checks: 899 @ 5 wks -> 13485/100=134 -> 670 (`6.70`); 6999 @ 9 wks -> 699 -> 3495 (`34.95`).

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

Comments

Loading comments…

Newsletter

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