Use this skill when an office manager needs to hand out weekly stationery from limited cupboard stock and work out how much each person gets against what they asked for, e.g. from an input.json with stock and requests, producing stationery-issued.csv. Not for ordering new supplies or general inventory counts.
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 Stationery Issue?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/gabrielmoreira-stationery-issue-c76fa723)
---
name: stationery-issue
description: "Use this skill when an office manager needs to hand out weekly stationery from limited cupboard stock and work out how much each person gets against what they asked for, e.g. from an input.json with stock and requests, producing stationery-issued.csv. Not for ordering new supplies or general inventory counts."
---
# Stationery issue
Allocate limited stock to requests and write `stationery-issued.csv` next to `input.json`. You only need to read and write files; do the arithmetic by hand, carefully.
## Input
`input.json` in the working folder:
- `stock`: array of `{item, quantity}`.
- `requests`: array of `{person, item, quantity}` in arrival order.
Item names match exactly everywhere; every requested item is in stock; quantities are whole numbers. If `input.json` is missing or unreadable, say so and stop. Do not invent data.
## Rules
1. **Combine requests**: for each (item, person) pair, `asked` = sum of all that person's quantities for that item.
2. **Priority**: within an item, people are ranked by the position of their FIRST request for that item (earliest first). A later request by the same person counts toward their combined total and does not lose them their early place.
3. **Allocate** per item, going down the ranking, with `remaining` starting at the item's stock:
`issued = min(asked, remaining)`, then `remaining = remaining - issued`.
`remaining` never goes below 0; once it is 0, everyone later gets `issued = 0`.
If an item appears more than once in `stock`, add the quantities together first.
4. **Rows**: one row per (item, person) pair that has at least one request, including rows with `issued = 0`. Items nobody requested get no row. A request with quantity 0 still creates a row (asked 0, issued 0).
## Output
Write `stationery-issued.csv` (overwrite if it exists) beside `input.json`:
- Header exactly `item,person,asked,issued`.
- Row order: items in the order they appear in `stock` (NOT request order); within an item, people in the priority order from rule 2.
- Values written as in the input (no padding, no extra spaces); integers for numbers. Quote a field with double quotes only if it contains a comma or quote.
- One row per line, newline after the last row, no blank lines.
## Steps
1. Read `input.json`.
2. Go through `requests` in order, building per item an ordered list of people (first-seen order) with running totals.
3. For each item in `stock` order, allocate per rule 3.
4. Write the CSV, then re-read it and check: each item's total issued <= its stock; each `issued` <= `asked`; if any person on an item got less than asked, that item's issued total equals its stock.
## Example
Stock: glue sticks 3, folders 6. Requests in order: eva folders 3, tom glue 2, dan glue 2, cal folders 4, bea glue 1.
```csv
item,person,asked,issued
glue sticks,tom,2,2
glue sticks,dan,2,1
glue sticks,bea,1,0
folders,eva,3,3
folders,cal,4,3
```
Glue comes first because it is first in `stock`. Another case: stock pens 10; amy 4, liv 5, amy 3 gives amy asked 7 issued 7, then liv asked 5 issued 3 (amy ranks first, with combined 7).