{"skills":[{"name":"Plan stock reorders","description":"Replenish low stock to its target level while accounting for incoming deliveries, commitments and order multiples.","content":"# Plan stock reorders\n\nReplenish low stock to its target level while accounting for incoming deliveries, commitments and order multiples.\n\n## When to use this skill\n\n- Someone has a stock list with minimum and maximum levels and wants to know what to order this week.\n- Deliveries are due and the buyer needs to avoid ordering stock that is already coming.\n- An open purchase order may arrive too late to cover the demand before it.\n\n## When not to use it\n\n- Setting the minimum and maximum levels or safety stock from demand data.\n- Placing or sending purchase orders. The method produces quantities for a buyer to approve.\n- Working out how many kits can be built from components. Use the kit availability skill.\n\n## What you need\n\n- Stock snapshot by SKU, opening quantity basis and dated receipts and commitments\n- Reorder horizon, minimum, maximum, supplier order multiple, minimum order quantity and lead time\n\n## Ask before you start\n\nIf any of these are missing or unclear, ask before doing the work.\n\n- Is the stock figure physical on hand, or already net of reserved customer orders?\n- What are the minimum, maximum, pack multiple and minimum order quantity for each SKU, and the supplier lead time?\n- Which incoming deliveries are confirmed, and on what dates?\n- What is the planning horizon, and do you want a day-by-day check as well?\n\n## Method\n\n1. Work in one base unit per SKU. Check whether opening stock is physical or already net of reservations, and subtract committed quantities once only.\n2. Project stock at the horizon from confirmed receipts and committed departures due by then. Exclude a purchase order arriving after the horizon and incoming stock described as unconfirmed.\n3. Trigger an order only when projected stock is strictly below the minimum. Systems differ on whether reaching the minimum triggers, so state the rule used.\n4. Size the order as the maximum less projected stock, raise it to the supplier's minimum order quantity if needed, then round up to the order multiple. Stock above the maximum after rounding can be legitimate.\n5. If the rule triggers but the maximum is missing, the quantity is unknown. If it does not trigger, report zero even when the maximum is missing.\n6. Where dated demand and receipts are supplied, roll the balance day by day. Report the first date below the minimum and the first date demand exceeds supply. An order placed now arrives after the lead time, and a later delivery cannot fill an earlier need, so treat an earlier shortfall as a separate timing decision.\n\n## Checks before you deliver\n\n- Placing another order for stock already due in time ties up working capital.\n- A forecast exactly equal to a strict minimum threshold does not trigger the rule.\n- Deducting reservations from stock that is already net of them triggers an unnecessary order.\n- Rounding to the pack multiple before applying the minimum order quantity, or rounding down, leaves the order short.\n- A healthy balance at the horizon can hide a stockout earlier in the period.\n\n## How to present the result\n\nLead with what to order now: SKU and quantity in units and packs. Then give a table per SKU: opening stock, receipts and demand to the horizon, projected stock, minimum, maximum and order. Where a dated check was requested, add the first date below minimum and the first stockout, and say whether an open order arrives too late. List SKUs that could not be planned and the missing setting.\n\n## Worked example\n\n**Request:** Plan replenishment for Friday's closing stock.\n\n**Supplied material:**\n\n```text\nPhysical WASHER 18, due out 13 by Friday; 10 more confirmed for Monday. Min 8, max 26, buy in sixes. Physical CAP 4, due in 7 Friday, due out 2 Friday; min 8 max 20, buy in fours.\n```\n\n**Answer:** Order 24 washers, four packs of six. Friday\u2019s forecast is five and the target is 26; the pack size takes stock to 29 when the order arrives. Caps reach nine on Friday, above the minimum of eight, so no cap order is needed.\n\n## Structured output for tests\n\nFor an ordinary job, answer in the format above and point back to the supplied evidence. Use this structure only for the test cases published with this skill, or when someone asks for structured JSON.\n\nReturn forecast and order as objects keyed by SKU, in base units. Include every supplied SKU. If a SKU's unit conversion or rule is missing, use null for the dependent calculation. When a timing review is requested, also return first_below_minimum and first_stockout as date-or-null maps by SKU. Define stockout here as the first date with demand exceeding supply.\n\n## Sources\n\n- [Odoo \u00b7 Reordering rules](https:\/\/www.odoo.com\/documentation\/19.0\/applications\/inventory_and_mrp\/inventory\/warehouses_storage\/replenishment\/reordering_rules.html): Odoo's min\/max rule creates a replenishment order when forecasted stock falls below the minimum and replenishes to the maximum, rounding the quantity up to the order multiple so stock can end slightly above the maximum.\n- [Microsoft \u00b7 Design details: handling reordering policies](https:\/\/learn.microsoft.com\/en-us\/dynamics365\/business-central\/design-details-handling-reordering-policies): Business Central's Maximum Qty. policy orders the gap between projected inventory and the maximum, applies order modifiers in sequence (maximum order quantity, minimum order quantity, then order multiple), allows for supply already due within the lead time, and treats projected negative inventory as an emergency to cover separately.\n\nTest cases and an answer checker for this skill: https:\/\/skills.raq.com\/skills\/plan-stock-reorders\n","scope":"contextual","trigger_keywords":["Plan stock reorders","plan-stock-reorders","plan stock reorders","What do we need to reorder this week to stay above our minimum stock levels?","What do we need to reorder this week to stay above our minimum stock levels","which items to reorder","stock reorder plan","reorder from this stock list"],"is_private":true,"is_active":true,"scripts":[{"name":"plan-stock-reorders-check","description":"Compare a saved JSON answer with a published test. Pass tests\/case-1\/expected.json (or another case) and the path to your answer.","language":"python","filename":"plan-stock-reorders-check.py","content":"from pathlib import Path\nimport runpy\n\nrunpy.run_path(str(Path(__file__).parent \/ 'tests' \/ 'check.py'), run_name='__main__')\n","supporting_files":[{"path":"SKILL.md","content":"---\nname: plan-stock-reorders\ndescription: \"Plan stock reorders by projecting each SKU to a horizon from confirmed receipts and commitments, ordering up to the maximum in supplier pack multiples when stock falls below the minimum, with a dated stockout check. Use when deciding which items to reorder and how many.\"\nlicense: CC-BY-4.0\nmetadata:\n  author: Raq.com\n  version: \"2026-11-22\"\n  homepage: https:\/\/skills.raq.com\/skills\/plan-stock-reorders\n---\n\n# Plan stock reorders\n\nReplenish low stock to its target level while accounting for incoming deliveries, commitments and order multiples.\n\n## When to use this skill\n\n- Someone has a stock list with minimum and maximum levels and wants to know what to order this week.\n- Deliveries are due and the buyer needs to avoid ordering stock that is already coming.\n- An open purchase order may arrive too late to cover the demand before it.\n\n## When not to use it\n\n- Setting the minimum and maximum levels or safety stock from demand data.\n- Placing or sending purchase orders. The method produces quantities for a buyer to approve.\n- Working out how many kits can be built from components. Use the kit availability skill.\n\n## What you need\n\n- Stock snapshot by SKU, opening quantity basis and dated receipts and commitments\n- Reorder horizon, minimum, maximum, supplier order multiple, minimum order quantity and lead time\n\n## Ask before you start\n\nIf any of these are missing or unclear, ask before doing the work.\n\n- Is the stock figure physical on hand, or already net of reserved customer orders?\n- What are the minimum, maximum, pack multiple and minimum order quantity for each SKU, and the supplier lead time?\n- Which incoming deliveries are confirmed, and on what dates?\n- What is the planning horizon, and do you want a day-by-day check as well?\n\n## Method\n\n1. Work in one base unit per SKU. Check whether opening stock is physical or already net of reservations, and subtract committed quantities once only.\n2. Project stock at the horizon from confirmed receipts and committed departures due by then. Exclude a purchase order arriving after the horizon and incoming stock described as unconfirmed.\n3. Trigger an order only when projected stock is strictly below the minimum. Systems differ on whether reaching the minimum triggers, so state the rule used.\n4. Size the order as the maximum less projected stock, raise it to the supplier's minimum order quantity if needed, then round up to the order multiple. Stock above the maximum after rounding can be legitimate.\n5. If the rule triggers but the maximum is missing, the quantity is unknown. If it does not trigger, report zero even when the maximum is missing.\n6. Where dated demand and receipts are supplied, roll the balance day by day. Report the first date below the minimum and the first date demand exceeds supply. An order placed now arrives after the lead time, and a later delivery cannot fill an earlier need, so treat an earlier shortfall as a separate timing decision.\n\n## Checks before you deliver\n\n- Placing another order for stock already due in time ties up working capital.\n- A forecast exactly equal to a strict minimum threshold does not trigger the rule.\n- Deducting reservations from stock that is already net of them triggers an unnecessary order.\n- Rounding to the pack multiple before applying the minimum order quantity, or rounding down, leaves the order short.\n- A healthy balance at the horizon can hide a stockout earlier in the period.\n\n## How to present the result\n\nLead with what to order now: SKU and quantity in units and packs. Then give a table per SKU: opening stock, receipts and demand to the horizon, projected stock, minimum, maximum and order. Where a dated check was requested, add the first date below minimum and the first stockout, and say whether an open order arrives too late. List SKUs that could not be planned and the missing setting.\n\n## Worked example\n\n**Request:** Plan replenishment for Friday's closing stock.\n\n**Supplied material:**\n\n```text\nPhysical WASHER 18, due out 13 by Friday; 10 more confirmed for Monday. Min 8, max 26, buy in sixes. Physical CAP 4, due in 7 Friday, due out 2 Friday; min 8 max 20, buy in fours.\n```\n\n**Answer:** Order 24 washers, four packs of six. Friday\u2019s forecast is five and the target is 26; the pack size takes stock to 29 when the order arrives. Caps reach nine on Friday, above the minimum of eight, so no cap order is needed.\n\n## Structured output for tests\n\nFor an ordinary job, answer in the format above and point back to the supplied evidence. Use this structure only for the test cases published with this skill, or when someone asks for structured JSON.\n\nReturn forecast and order as objects keyed by SKU, in base units. Include every supplied SKU. If a SKU's unit conversion or rule is missing, use null for the dependent calculation. When a timing review is requested, also return first_below_minimum and first_stockout as date-or-null maps by SKU. Define stockout here as the first date with demand exceeding supply.\n\n## Sources\n\n- [Odoo \u00b7 Reordering rules](https:\/\/www.odoo.com\/documentation\/19.0\/applications\/inventory_and_mrp\/inventory\/warehouses_storage\/replenishment\/reordering_rules.html): Odoo's min\/max rule creates a replenishment order when forecasted stock falls below the minimum and replenishes to the maximum, rounding the quantity up to the order multiple so stock can end slightly above the maximum.\n- [Microsoft \u00b7 Design details: handling reordering policies](https:\/\/learn.microsoft.com\/en-us\/dynamics365\/business-central\/design-details-handling-reordering-policies): Business Central's Maximum Qty. policy orders the gap between projected inventory and the maximum, applies order modifiers in sequence (maximum order quantity, minimum order quantity, then order multiple), allows for supply already due within the lead time, and treats projected negative inventory as an emergency to cover separately.\n\nTest cases and an answer checker for this skill: https:\/\/skills.raq.com\/skills\/plan-stock-reorders\n"},{"path":"LICENSE.txt","content":"Original Raq.com instructions and synthetic examples: CC BY 4.0.\nhttps:\/\/creativecommons.org\/licenses\/by\/4.0\/\nAttribution: Raq.com, https:\/\/skills.raq.com\/skills\/plan-stock-reorders\nReferenced third-party materials retain their own terms.\n"},{"path":"examples\/worked-example.md","content":"# One delivery misses the horizon\n\nPlan replenishment for Friday's closing stock.\n\n## Supplied material\n\nPhysical WASHER 18, due out 13 by Friday; 10 more confirmed for Monday. Min 8, max 26, buy in sixes. Physical CAP 4, due in 7 Friday, due out 2 Friday; min 8 max 20, buy in fours.\n\n## Worked answer\n\nOrder 24 washers, four packs of six. Friday\u2019s forecast is five and the target is 26; the pack size takes stock to 29 when the order arrives. Caps reach nine on Friday, above the minimum of eight, so no cap order is needed.\n\n## Reasoning\n\nWashers fall below eight. The 21-unit gap rounds up to 24.\n"},{"path":"tests\/check.py","content":"\"\"\"Check a saved agent answer locally with Python 3 (standard library only).\"\"\"\nimport json\nimport math\nimport sys\nfrom pathlib import Path\n\n\ndef compare(expected, actual, path=\"$\", accepted=None):\n    if isinstance(expected, bool) or isinstance(actual, bool):\n        if expected is not actual:\n            yield path\n    elif isinstance(expected, (int, float)) and isinstance(actual, (int, float)):\n        if not math.isclose(expected, actual, rel_tol=0, abs_tol=1e-8):\n            yield path\n    elif isinstance(expected, dict) and isinstance(actual, dict):\n        for key in sorted(set(expected) | set(actual)):\n            if key not in expected or key not in actual:\n                yield f\"{path}.{key}\"\n            elif not any(\n                not list(compare(option, actual[key]))\n                for option in (accepted or {}).get(key, [])\n            ):\n                yield from compare(expected[key], actual[key], f\"{path}.{key}\")\n    elif isinstance(expected, list) and isinstance(actual, list):\n        if len(expected) != len(actual):\n            yield f\"{path} (length)\"\n        for i, (left, right) in enumerate(zip(expected, actual)):\n            yield from compare(left, right, f\"{path}[{i}]\")\n    elif type(expected) != type(actual) or expected != actual:\n        yield path\n\n\ndef main():\n    if len(sys.argv) != 3:\n        raise SystemExit(\"Usage: python3 check.py expected.json answer.json\")\n    try:\n        expected, actual = [json.loads(Path(p).read_text(encoding=\"utf-8\")) for p in sys.argv[1:]]\n        alternatives = Path(sys.argv[1]).with_name(\"accepted.json\")\n        accepted = json.loads(alternatives.read_text(encoding=\"utf-8\")) if alternatives.is_file() else {}\n    except (ValueError, OSError) as error:\n        raise SystemExit(str(error))\n    differences = list(compare(expected, actual, accepted=accepted))\n    if differences:\n        raise SystemExit(\"Different fields: \" + \", \".join(differences))\n    print(\"Pass\")\n\n\nif __name__ == \"__main__\":\n    main()\n"},{"path":"tests\/README.md","content":"Give your agent SKILL.md and one request.txt in a fresh session. Keep the expected answer aside. Save the reply as answer.json, then run this from the tests folder:\n\n    python3 check.py case-1\/expected.json answer.json\n\nEach case also has an explanation. Where accepted.json exists, the checker accepts the alternatives listed there.\n"},{"path":"tests\/case-1\/request.txt","content":"Plan replenishment for Friday's closing stock.\nReturn only the JSON specified in SKILL.md for this test.\n\nPhysical WASHER 18, due out 13 by Friday; 10 more confirmed for Monday. Min 8, max 26, buy in sixes. Physical CAP 4, due in 7 Friday, due out 2 Friday; min 8 max 20, buy in fours.\n"},{"path":"tests\/case-1\/expected.json","content":"{\n    \"forecast\": {\n        \"WASHER\": 5,\n        \"CAP\": 9\n    },\n    \"order\": {\n        \"WASHER\": 24,\n        \"CAP\": 0\n    }\n}\n"},{"path":"tests\/case-1\/explanation.txt","content":"Washers fall below eight. The 21-unit gap rounds up to 24.\n"},{"path":"tests\/case-2\/request.txt","content":"Does this location need an order?\nReturn only the JSON specified in SKILL.md for this test.\n\nOpening available PEN 12 after its 4 committed units have been deducted. No further demands. Confirmed receipt 3 arrives by horizon. Min 15, max 30, order multiple 10.\n"},{"path":"tests\/case-2\/expected.json","content":"{\n    \"forecast\": {\n        \"PEN\": 15\n    },\n    \"order\": {\n        \"PEN\": 0\n    }\n}\n"},{"path":"tests\/case-2\/explanation.txt","content":"Deducting the four reserved units again would trigger an unnecessary order.\n"},{"path":"tests\/case-3\/request.txt","content":"Check both the Saturday close and whether we can wait for the open order.\nReturn only the JSON specified in SKILL.md for this test.\n\nSK1 opens Mon 2026-11-02 at 15. Four units required each day Mon through Fri. Confirmed receipt 20 on Sat 2026-11-07, no other receipts or Saturday demand. Min 5, max unspecified. Monday order takes three days, MOQ 10 in packs of five. Report before new orders.\n"},{"path":"tests\/case-3\/expected.json","content":"{\n    \"forecast\": {\n        \"SK1\": 15\n    },\n    \"order\": {\n        \"SK1\": 0\n    },\n    \"first_below_minimum\": {\n        \"SK1\": \"2026-11-04\"\n    },\n    \"first_stockout\": {\n        \"SK1\": \"2026-11-05\"\n    }\n}\n"},{"path":"tests\/case-3\/explanation.txt","content":"No Saturday horizon order triggers, but stock reaches three on Wednesday and demand exceeds supply on Thursday. An earlier delivery or revised demand is needed. The missing maximum prevents sizing a separate target-based intervention.\n"}],"is_active":true,"is_approved":false}]}]}