Skip to content
Back to skills

Stationery Issue

ASecurity

Use this skill when an office manager needs to share out limited stationery or supplies from a cupboard: working out how much each person gets when requests exceed stock, from an input.json with stock and requests, and writing stationery-issued.csv. Not for ordering new stock or general inventory reports.

  • 24 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added December 6, 2026
datago

Security analysis

A100/100

Scanned December 6, 2026

npx -y skills add gabrielmoreira/agent-skills-mirror --skill stationery-issue --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Stationery Issue?

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

Security grade badge for Stationery Issue
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/gabrielmoreira-stationery-issue-57000cdf/badge)](https://www.skillsdirectory.com/skills/gabrielmoreira-stationery-issue-57000cdf)

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: stationery-issue
description: "Use this skill when an office manager needs to share out limited stationery or supplies from a cupboard: working out how much each person gets when requests exceed stock, from an input.json with stock and requests, and writing stationery-issued.csv. Not for ordering new stock or general inventory reports."
---

# Stationery issue

Allocate cupboard stock to requests and write `stationery-issued.csv` next to `input.json`.

## Input
`input.json` in the working folder:
- `stock`: array of `{item, quantity}`.
- `requests`: array of `{person, item, quantity}` in arrival order.

Items are in stock, quantities are whole numbers, and names match exactly. If `input.json` is missing or unreadable, stop and tell the user. Do not guess data.

## Rules
1. **Combine per person and item.** For each (item, person) pair, `asked` = sum of all that person's request quantities for that item. A pair's position is the arrival index of its **first** request.
2. **Allocate per item, first come first served by pair position.** Start with `remaining` = stock quantity. For each pair of that item in position order:
   `issued = min(asked, remaining)`, then `remaining = remaining - issued`.
   Combining comes first: a person's later request counts at their first position (so it can beat someone who asked in between).
3. A zero `issued` is still a row. If `asked` is 0, `issued` is 0. Never issue negatives; `remaining` never goes below 0.

## Output
Write `stationery-issued.csv` beside `input.json` (overwrite if present):
- Header line exactly: `item,person,asked,issued`
- One row per (item, person) pair.
- Row order: items in `stock` order; within an item, pairs in position order (rule 1).
- Omit items with no requests (no rows).
- Plain values, no spaces after commas, `\n` line endings, newline after last row. Wrap a value in double quotes only if it contains a comma or quote (double any inner quote).

## Steps
1. Read `input.json`.
2. Build the pairs by walking `requests` in order, summing duplicates and noting first positions.
3. For each stock item in order, allocate per rule 2 and emit rows.
4. Write the CSV, then re-read it and check: row count equals number of distinct pairs, and per item `sum(issued) <= stock` and `issued <= asked`.

## Worked example
Stock: pens 10. Requests: amy 4, liv 5, amy 3 (all pens).
- amy: asked 7 (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
```

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

Comments

Loading comments…

Newsletter

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