Use this skill when an office manager needs to hand out limited stationery or supplies from a cupboard against people's requests, and wants a CSV showing how much each person asked for and how much they actually get (stock and requests in input.json, output stationery-issued.csv). Not for ordering new stock or general inventory reports.
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-7bdcb2fa)
---
name: stationery-issue
description: "Use this skill when an office manager needs to hand out limited stationery or supplies from a cupboard against people's requests, and wants a CSV showing how much each person asked for and how much they actually get (stock and requests in input.json, output stationery-issued.csv). Not for ordering new stock or general inventory reports."
---
# Stationery issue
Allocate limited stock to requests, first come first served, and write a CSV.
## 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 (case-sensitive, no trimming needed). If the file is missing or malformed, say so and stop; do not invent data.
## Steps
1. Read `input.json`. Note the stock order of items and each item's stock `S[item]` (if an item is listed twice, add the quantities).
2. Group requests by (item, person). For each group:
- `asked = sum of that person's quantities for that item`
- the group's position = the arrival position of the person's FIRST request for that item.
A person asking for the same item several times is one row, and their combined ask counts at their first position (not each request separately).
3. For each item, take its groups in position order and allocate from a running `remaining`, starting at `S[item]`:
- `issued = min(asked, remaining)`
- `remaining = remaining - issued`
Since `remaining >= 0` always, issued is never negative. A person with `remaining = 0` gets `issued = 0` (still listed). A zero ask gives `asked = 0, issued = 0`.
4. Write `stationery-issued.csv` next to `input.json`.
## Output format
- Header exactly: `item,person,asked,issued`
- One row per (item, person) group, `item,person,asked,issued`.
- Row order: items in the order of the `stock` array; within an item, people by first-request position (step 2).
- Omit items nobody requested. Include people who get 0.
- Integers, no quotes unless a value contains a comma (then quote it, doubling inner quotes). Lines end with `\n`, including a final newline. No extra columns or blank lines.
## Worked example
Stock: pens 10. Requests in order: amy pens 4, liv pens 5, amy pens 3.
- amy: asked 7 (first position 1); liv: asked 5 (position 2).
- amy issued min(7,10)=7, remaining 3; liv issued min(5,3)=3.
```csv
item,person,asked,issued
pens,amy,7,7
pens,liv,5,3
```
## Check before finishing
For every item: sum of issued <= stock; issued <= asked; row count equals the number of distinct (item, person) pairs.