{"skills":[{"name":"Calculate kit availability","description":"Work out how many complete kits can be promised from shared component stock after existing reservations.","content":"# Calculate kit availability\n\nWork out how many complete kits can be promised from shared component stock after existing reservations.\n\n## When to use this skill\n\n- Someone asks how many gift sets, bundles or kits can be made from what is on the shelf.\n- Sales wants to promise a quantity and needs to know which component runs out first.\n- Several kits share components and one order has priority.\n\n## When not to use it\n\n- Deciding how much of each component to reorder. Use the stock reorder skill.\n- Explaining differences between a stock count and the books. Use the stocktake cut-off skill.\n- Scheduling assembly labour or machine time. The method checks components only.\n\n## What you need\n\n- Component quantities required per kit, from the current bill of materials\n- On-hand units, reservations and any alternate components explicitly approved\n\n## Ask before you start\n\nIf any of these are missing or unclear, ask before doing the work.\n\n- Which bill of materials and version applies, with the quantity of each component per kit and its unit?\n- Is the stock figure physical on hand, or already net of reserved orders?\n- Are there firm orders or reservations, and which kit has priority if several share parts?\n- Are any substitute components formally approved?\n\n## Method\n\n1. Choose the correct bill of materials and version. Convert required quantities and stock to the same unit before dividing, and combine repeated uses of the same component in one kit.\n2. Work out free stock: physical stock less committed units, deducted once, floored at zero. Leave out supplier stock, future receipts and stock held elsewhere unless the request sets a future date or another location.\n3. For each required component, divide free stock by units per kit and round down. The smallest result limits complete kits. List every component tied at that minimum as a bottleneck, and calculate what remains of each component after building that many kits.\n4. If a required component has no stock record, keep the result unknown. Use a substitute only if it is explicitly approved.\n5. For several kits sharing stock, build in the stated priority or committed order and reduce each component balance after each kit type. With no priority or mix, present the separate maxima as alternatives and ask which mix is wanted before promising a combined quantity.\n6. Before a firm promise, check that the bottleneck stock figure is reliable, for example with a quick count, and state how many more bottleneck units each extra kit would need.\n\n## Checks before you deliver\n\n- Adding capacities across components returns imaginary kits.\n- Two uses of the same bag or fastener in one bill consume twice the stock.\n- Deducting reservations from a figure that is already net of them understates what can be built.\n- Counting an unapproved look-alike part as a substitute turns a stock gap into a quality problem.\n- Promising kits from goods that have not arrived. Future receipts are not current stock.\n\n## How to present the result\n\nLead with the number of complete kits that can be promised now and the component that limits it. Then give a table: component, free stock, needed per kit, kits it supports and left after building. Flag missing stock records. For several kits, show the build order and the stock left after each.\n\n## Worked example\n\n**Request:** How many gift kits are available now?\n\n**Supplied material:**\n\n```text\nPer kit: BOX 1, LINER 1 in base plus LINER 1 in lid, MUG 2. Physical BOX 12 reserved 2; LINER 30 reserved 9; MUG 22 reserved 3.\n```\n\n**Answer:** Nine gift kits can be made now. Mugs limit the run to nine pairs. After assembly the free stock is one box, three liners and one mug. The reserved units remain committed.\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 buildable as the integer number of complete kits or null, bottlenecks as the sorted IDs attaining the minimum capacity, leftovers as an object of available units remaining by component, and missing as sorted required IDs without a quantity. For missing records return empty bottlenecks and leftovers. For an ordered multi-kit request return built_by_kit and final leftovers by component instead.\n\n## Sources\n\n- [Odoo \u00b7 Sell sets of products as kits](https:\/\/www.odoo.com\/documentation\/19.0\/applications\/inventory_and_mrp\/manufacturing\/advanced_configuration\/kit_shipping.html): Odoo treats a kit as a bill of materials whose components are delivered separately, says a kit cannot be sold if any required component is out of stock, and recommends replenishing at component level. The skill calculates availability from components for the same reason.\n- [Microsoft \u00b7 Get an availability overview](https:\/\/learn.microsoft.com\/en-us\/dynamics365\/business-central\/inventory-how-availability-overview): Business Central's Item Availability by BOM Level page shows how many parent units can be made from the availability of child items, and its Bottleneck field names the item that prevents a larger quantity. The skill reports the same two figures.\n\nTest cases and an answer checker for this skill: https:\/\/skills.raq.com\/skills\/calculate-kit-availability\n","scope":"contextual","trigger_keywords":["Calculate kit availability","calculate-kit-availability","calculate kit availability","How many gift sets can we make from the stock on the shelf?","How many gift sets can we make from the stock on the shelf","how many kits can","available complete kits","kit availability"],"is_private":true,"is_active":true,"scripts":[{"name":"calculate-kit-availability-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":"calculate-kit-availability-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: calculate-kit-availability\ndescription: \"Work out how many complete kits or bundles can be built and promised from shared component stock after reservations, naming the bottleneck component and what is left over. Use when asked how many kits, bundles, gift sets or assemblies can be made or promised now.\"\nlicense: CC-BY-4.0\nmetadata:\n  author: Raq.com\n  version: \"2026-11-22\"\n  homepage: https:\/\/skills.raq.com\/skills\/calculate-kit-availability\n---\n\n# Calculate kit availability\n\nWork out how many complete kits can be promised from shared component stock after existing reservations.\n\n## When to use this skill\n\n- Someone asks how many gift sets, bundles or kits can be made from what is on the shelf.\n- Sales wants to promise a quantity and needs to know which component runs out first.\n- Several kits share components and one order has priority.\n\n## When not to use it\n\n- Deciding how much of each component to reorder. Use the stock reorder skill.\n- Explaining differences between a stock count and the books. Use the stocktake cut-off skill.\n- Scheduling assembly labour or machine time. The method checks components only.\n\n## What you need\n\n- Component quantities required per kit, from the current bill of materials\n- On-hand units, reservations and any alternate components explicitly approved\n\n## Ask before you start\n\nIf any of these are missing or unclear, ask before doing the work.\n\n- Which bill of materials and version applies, with the quantity of each component per kit and its unit?\n- Is the stock figure physical on hand, or already net of reserved orders?\n- Are there firm orders or reservations, and which kit has priority if several share parts?\n- Are any substitute components formally approved?\n\n## Method\n\n1. Choose the correct bill of materials and version. Convert required quantities and stock to the same unit before dividing, and combine repeated uses of the same component in one kit.\n2. Work out free stock: physical stock less committed units, deducted once, floored at zero. Leave out supplier stock, future receipts and stock held elsewhere unless the request sets a future date or another location.\n3. For each required component, divide free stock by units per kit and round down. The smallest result limits complete kits. List every component tied at that minimum as a bottleneck, and calculate what remains of each component after building that many kits.\n4. If a required component has no stock record, keep the result unknown. Use a substitute only if it is explicitly approved.\n5. For several kits sharing stock, build in the stated priority or committed order and reduce each component balance after each kit type. With no priority or mix, present the separate maxima as alternatives and ask which mix is wanted before promising a combined quantity.\n6. Before a firm promise, check that the bottleneck stock figure is reliable, for example with a quick count, and state how many more bottleneck units each extra kit would need.\n\n## Checks before you deliver\n\n- Adding capacities across components returns imaginary kits.\n- Two uses of the same bag or fastener in one bill consume twice the stock.\n- Deducting reservations from a figure that is already net of them understates what can be built.\n- Counting an unapproved look-alike part as a substitute turns a stock gap into a quality problem.\n- Promising kits from goods that have not arrived. Future receipts are not current stock.\n\n## How to present the result\n\nLead with the number of complete kits that can be promised now and the component that limits it. Then give a table: component, free stock, needed per kit, kits it supports and left after building. Flag missing stock records. For several kits, show the build order and the stock left after each.\n\n## Worked example\n\n**Request:** How many gift kits are available now?\n\n**Supplied material:**\n\n```text\nPer kit: BOX 1, LINER 1 in base plus LINER 1 in lid, MUG 2. Physical BOX 12 reserved 2; LINER 30 reserved 9; MUG 22 reserved 3.\n```\n\n**Answer:** Nine gift kits can be made now. Mugs limit the run to nine pairs. After assembly the free stock is one box, three liners and one mug. The reserved units remain committed.\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 buildable as the integer number of complete kits or null, bottlenecks as the sorted IDs attaining the minimum capacity, leftovers as an object of available units remaining by component, and missing as sorted required IDs without a quantity. For missing records return empty bottlenecks and leftovers. For an ordered multi-kit request return built_by_kit and final leftovers by component instead.\n\n## Sources\n\n- [Odoo \u00b7 Sell sets of products as kits](https:\/\/www.odoo.com\/documentation\/19.0\/applications\/inventory_and_mrp\/manufacturing\/advanced_configuration\/kit_shipping.html): Odoo treats a kit as a bill of materials whose components are delivered separately, says a kit cannot be sold if any required component is out of stock, and recommends replenishing at component level. The skill calculates availability from components for the same reason.\n- [Microsoft \u00b7 Get an availability overview](https:\/\/learn.microsoft.com\/en-us\/dynamics365\/business-central\/inventory-how-availability-overview): Business Central's Item Availability by BOM Level page shows how many parent units can be made from the availability of child items, and its Bottleneck field names the item that prevents a larger quantity. The skill reports the same two figures.\n\nTest cases and an answer checker for this skill: https:\/\/skills.raq.com\/skills\/calculate-kit-availability\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\/calculate-kit-availability\nReferenced third-party materials retain their own terms.\n"},{"path":"examples\/worked-example.md","content":"# Two liners per gift box\n\nHow many gift kits are available now?\n\n## Supplied material\n\nPer kit: BOX 1, LINER 1 in base plus LINER 1 in lid, MUG 2. Physical BOX 12 reserved 2; LINER 30 reserved 9; MUG 22 reserved 3.\n\n## Worked answer\n\nNine gift kits can be made now. Mugs limit the run to nine pairs. After assembly the free stock is one box, three liners and one mug. The reserved units remain committed.\n\n## Reasoning\n\nNineteen free mugs make nine complete pairs. Both liners must be counted.\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":"How many gift kits are available now?\nReturn only the JSON specified in SKILL.md for this test.\n\nPer kit: BOX 1, LINER 1 in base plus LINER 1 in lid, MUG 2. Physical BOX 12 reserved 2; LINER 30 reserved 9; MUG 22 reserved 3.\n"},{"path":"tests\/case-1\/expected.json","content":"{\n    \"buildable\": 9,\n    \"bottlenecks\": [\n        \"MUG\"\n    ],\n    \"leftovers\": {\n        \"BOX\": 1,\n        \"LINER\": 3,\n        \"MUG\": 1\n    },\n    \"missing\": []\n}\n"},{"path":"tests\/case-1\/explanation.txt","content":"Nineteen free mugs make nine complete pairs. Both liners must be counted.\n"},{"path":"tests\/case-2\/request.txt","content":"Can the team promise these kits?\nReturn only the JSON specified in SKILL.md for this test.\n\nPer kit: BRACKET 1, WASHER 2. Physical BRACKET 20, none reserved. The stock extract contains no WASHER row. Similar spare rings are unapproved.\n"},{"path":"tests\/case-2\/expected.json","content":"{\n    \"buildable\": null,\n    \"bottlenecks\": [],\n    \"leftovers\": {},\n    \"missing\": [\n        \"WASHER\"\n    ]\n}\n"},{"path":"tests\/case-2\/explanation.txt","content":"The missing record prevents a defensible promise.\n"},{"path":"tests\/case-3\/request.txt","content":"Fill A first, then build as many B as possible.\nReturn only the JSON specified in SKILL.md for this test.\n\nFree stock BEARING 12, BOX 4, BAG 3. A requires two BEARING and one BOX. B requires three BEARING and one BAG. Firm order A 2, no other reservations.\n"},{"path":"tests\/case-3\/expected.json","content":"{\n    \"built_by_kit\": {\n        \"A\": 2,\n        \"B\": 2\n    },\n    \"leftovers\": {\n        \"BEARING\": 2,\n        \"BOX\": 2,\n        \"BAG\": 1\n    }\n}\n"},{"path":"tests\/case-3\/explanation.txt","content":"Two A consume four bearings. Eight remain and support only two B.\n"}],"is_active":true,"is_approved":false}]}]}