{"skills":[{"name":"Build a shopping list from planned meals and stock","description":"Allocate existing ingredients to dated meals first, then combine the remaining shortfalls into a shopping list.","content":"# Build a shopping list from planned meals and stock\n\nAllocate existing ingredients to dated meals first, then combine the remaining shortfalls into a shopping list.\n\n## When to use this skill\n\n- Someone has a week of planned meals and a list of what is in the fridge, freezer and cupboards.\n- Someone wants to use food before its use-by date and buy only the shortfall.\n- Someone asks how many tins, bags or packs to buy across several recipes.\n\n## When not to use it\n\n- Judging whether food past its use-by date is still safe. In the UK a use-by date marks when food is no longer safe to eat, so expired stock is left out, not assessed.\n- Costing the meals. Use the cost-a-portion-from-pack-prices skill.\n- Nutrition or special-diet planning. This skill matches quantities only.\n\n## What you need\n\n- Dated meals with per-meal ingredient quantities, stock lots with quantities and use-by dates, and any items already reserved.\n- Pack sizes and units for items that need buying, plus whether the purchases can serve all the planned dates.\n\n## Ask before you start\n\nIf any of these are missing or unclear, ask before doing the work.\n\n- What is in stock, how much of each item, and what use-by or best before date is on each? Is any of it set aside for something else?\n- When will you shop, and will items bought then still be in date for the later meals?\n- What pack sizes does your shop sell, and for tins, is the recipe amount drained or including the liquid?\n\n## Method\n\n1. Put the meals in date order and list each ingredient's quantity per meal in the recipe's unit and form (fresh, frozen, tinned, drained, dry).\n2. List stock lots with quantity, unit and date, and take out anything reserved for another use. Keep different forms separate unless a stated yield converts them; for drained ingredients use the can's drained weight, not its net weight, for both stock and new packs.\n3. Allocate stock meal by meal in date order, using the lot with the earliest date first. A lot can serve a meal only on or before its use-by date. Carry each lot's remainder forward so nothing is counted twice.\n4. Treat date labels correctly. Under UK guidance a use-by date marks when food is no longer safe to eat, while food is usually safe after its best before date but may be lower in quality. Leave out use-by stock past its date and flag unknown or unreadable dates rather than judging by look or smell. Food frozen before its use-by date can be used, within 24 hours of defrosting.\n5. Total each ingredient's shortfall across the shopping period in one unit, then round up once to whole packs. Do not round each meal's shortfall separately.\n6. Check the new packs will stay in date until the last meal they serve. If not, split the shop by date or leave that pack count open until the shopping date is settled.\n\n## Checks before you deliver\n\n- An unopened pack marked for another recipe is unavailable to the current plan.\n- Rounding each day's small shortfall to a whole pack independently can double the purchase.\n- Counting a can by its net weight when the recipe wants drained weight: 600 g of drained chickpeas at 240 g a can needs three cans, not two.\n- Using leftover stock from a lot for a meal after its use-by date because some is still there.\n\n## How to present the result\n\nGive the shopping list first: item, number of packs and pack size. Then a short 'use from stock' list by meal (which lot, how much, by when), and a note of anything left out as past its use-by, reserved, or needing a date check.\n\n## Worked example\n\n**Request:** Make one shopping list. New packs are suitable through Wednesday.\n\n**Supplied material:**\n\n```text\nMonday soup needs carrots 450 g. Wednesday stew needs carrots 350 g. Lot C1 carrots 500 g use by Monday. C2 carrots 200 g use by Thursday, 50 g reserved. Shop carrots in 500 g packs.\n```\n\n**Answer:** Buy one 500 g pack of carrots. Use 450 g from C1 for Monday, then 150 g from C2 and 200 g from the new pack on Wednesday. The 50 g reserved from C2 stays available for its other meal.\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 stock_used as quantities keyed by lot ID in its original unit, including zero; shortfall keyed by ingredient as the amount required beyond stock, including zero; buy_packs keyed by ingredient as integer packs or null if pack size or dated suitability is unknown. Assume no substitutions unless stated.\n\n## Sources\n\n- [US Environmental Protection Agency: preventing wasted food at home](https:\/\/www.epa.gov\/recycle\/preventing-wasted-food-home): Advises checking the fridge, freezer and pantry before shopping, planning the week's meals and buying only what those meals need. This is the order the skill follows.\n- [GOV.UK: best before and use-by dates](https:\/\/www.gov.uk\/understanding-food-labelling\/best-before-and-use-by-dates): UK guidance that use-by dates show when food is no longer safe to eat, best before dates are about quality, food frozen before its use-by date does not deteriorate, and defrosted food should be used within 24 hours. This is why expired use-by stock is never allocated.\n- [USDA Food Buying Guide, Appendix B: using the yield column](https:\/\/foodbuyingguide.fns.usda.gov\/Content\/TablesFBG\/USDA_FBG_Appendix_B.pdf): Works out the drained yield of a can from its listed yield and rounds purchase quantities up so enough food is bought. The skill uses drained weight for tinned stock and new tins on the same basis.\n\nTest cases and an answer checker for this skill: https:\/\/skills.raq.com\/skills\/shop-from-a-pantry-meal-plan\n","scope":"contextual","trigger_keywords":["Build a shopping list from planned meals and stock","shop-from-a-pantry-meal-plan","shop from a pantry meal plan","What do I need to buy for this week\u2019s meals, given what\u2019s already in the cupboards?","What do I need to buy for this week\u2019s meals, given what\u2019s already in the cupboards","shopping list from my pantry","pantry shopping list","shopping list from this meal plan"],"is_private":true,"is_active":true,"scripts":[{"name":"shop-from-a-pantry-meal-plan-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":"shop-from-a-pantry-meal-plan-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: shop-from-a-pantry-meal-plan\ndescription: \"Turn a dated meal plan and what is already in the fridge, freezer and cupboards into a shopping list, using stock before its use-by date and rounding to real pack sizes. Use when someone asks for a shopping list from their meal plan, what to buy given what they have, or how many packs or tins they need.\"\nlicense: CC-BY-4.0\nmetadata:\n  author: Raq.com\n  version: \"2026-11-22\"\n  homepage: https:\/\/skills.raq.com\/skills\/shop-from-a-pantry-meal-plan\n---\n\n# Build a shopping list from planned meals and stock\n\nAllocate existing ingredients to dated meals first, then combine the remaining shortfalls into a shopping list.\n\n## When to use this skill\n\n- Someone has a week of planned meals and a list of what is in the fridge, freezer and cupboards.\n- Someone wants to use food before its use-by date and buy only the shortfall.\n- Someone asks how many tins, bags or packs to buy across several recipes.\n\n## When not to use it\n\n- Judging whether food past its use-by date is still safe. In the UK a use-by date marks when food is no longer safe to eat, so expired stock is left out, not assessed.\n- Costing the meals. Use the cost-a-portion-from-pack-prices skill.\n- Nutrition or special-diet planning. This skill matches quantities only.\n\n## What you need\n\n- Dated meals with per-meal ingredient quantities, stock lots with quantities and use-by dates, and any items already reserved.\n- Pack sizes and units for items that need buying, plus whether the purchases can serve all the planned dates.\n\n## Ask before you start\n\nIf any of these are missing or unclear, ask before doing the work.\n\n- What is in stock, how much of each item, and what use-by or best before date is on each? Is any of it set aside for something else?\n- When will you shop, and will items bought then still be in date for the later meals?\n- What pack sizes does your shop sell, and for tins, is the recipe amount drained or including the liquid?\n\n## Method\n\n1. Put the meals in date order and list each ingredient's quantity per meal in the recipe's unit and form (fresh, frozen, tinned, drained, dry).\n2. List stock lots with quantity, unit and date, and take out anything reserved for another use. Keep different forms separate unless a stated yield converts them; for drained ingredients use the can's drained weight, not its net weight, for both stock and new packs.\n3. Allocate stock meal by meal in date order, using the lot with the earliest date first. A lot can serve a meal only on or before its use-by date. Carry each lot's remainder forward so nothing is counted twice.\n4. Treat date labels correctly. Under UK guidance a use-by date marks when food is no longer safe to eat, while food is usually safe after its best before date but may be lower in quality. Leave out use-by stock past its date and flag unknown or unreadable dates rather than judging by look or smell. Food frozen before its use-by date can be used, within 24 hours of defrosting.\n5. Total each ingredient's shortfall across the shopping period in one unit, then round up once to whole packs. Do not round each meal's shortfall separately.\n6. Check the new packs will stay in date until the last meal they serve. If not, split the shop by date or leave that pack count open until the shopping date is settled.\n\n## Checks before you deliver\n\n- An unopened pack marked for another recipe is unavailable to the current plan.\n- Rounding each day's small shortfall to a whole pack independently can double the purchase.\n- Counting a can by its net weight when the recipe wants drained weight: 600 g of drained chickpeas at 240 g a can needs three cans, not two.\n- Using leftover stock from a lot for a meal after its use-by date because some is still there.\n\n## How to present the result\n\nGive the shopping list first: item, number of packs and pack size. Then a short 'use from stock' list by meal (which lot, how much, by when), and a note of anything left out as past its use-by, reserved, or needing a date check.\n\n## Worked example\n\n**Request:** Make one shopping list. New packs are suitable through Wednesday.\n\n**Supplied material:**\n\n```text\nMonday soup needs carrots 450 g. Wednesday stew needs carrots 350 g. Lot C1 carrots 500 g use by Monday. C2 carrots 200 g use by Thursday, 50 g reserved. Shop carrots in 500 g packs.\n```\n\n**Answer:** Buy one 500 g pack of carrots. Use 450 g from C1 for Monday, then 150 g from C2 and 200 g from the new pack on Wednesday. The 50 g reserved from C2 stays available for its other meal.\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 stock_used as quantities keyed by lot ID in its original unit, including zero; shortfall keyed by ingredient as the amount required beyond stock, including zero; buy_packs keyed by ingredient as integer packs or null if pack size or dated suitability is unknown. Assume no substitutions unless stated.\n\n## Sources\n\n- [US Environmental Protection Agency: preventing wasted food at home](https:\/\/www.epa.gov\/recycle\/preventing-wasted-food-home): Advises checking the fridge, freezer and pantry before shopping, planning the week's meals and buying only what those meals need. This is the order the skill follows.\n- [GOV.UK: best before and use-by dates](https:\/\/www.gov.uk\/understanding-food-labelling\/best-before-and-use-by-dates): UK guidance that use-by dates show when food is no longer safe to eat, best before dates are about quality, food frozen before its use-by date does not deteriorate, and defrosted food should be used within 24 hours. This is why expired use-by stock is never allocated.\n- [USDA Food Buying Guide, Appendix B: using the yield column](https:\/\/foodbuyingguide.fns.usda.gov\/Content\/TablesFBG\/USDA_FBG_Appendix_B.pdf): Works out the drained yield of a can from its listed yield and rounds purchase quantities up so enough food is bought. The skill uses drained weight for tinned stock and new tins on the same basis.\n\nTest cases and an answer checker for this skill: https:\/\/skills.raq.com\/skills\/shop-from-a-pantry-meal-plan\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\/shop-from-a-pantry-meal-plan\nReferenced third-party materials retain their own terms.\n"},{"path":"examples\/worked-example.md","content":"# A use-by date between two meals\n\nMake one shopping list. New packs are suitable through Wednesday.\n\n## Supplied material\n\nMonday soup needs carrots 450 g. Wednesday stew needs carrots 350 g. Lot C1 carrots 500 g use by Monday. C2 carrots 200 g use by Thursday, 50 g reserved. Shop carrots in 500 g packs.\n\n## Worked answer\n\nBuy one 500 g pack of carrots. Use 450 g from C1 for Monday, then 150 g from C2 and 200 g from the new pack on Wednesday. The 50 g reserved from C2 stays available for its other meal.\n\n## Reasoning\n\nThe unused 50 g from C1 cannot cover Wednesday. C2 has only 150 g available.\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":"Make one shopping list. New packs are suitable through Wednesday.\nReturn only the JSON specified in SKILL.md for this test.\n\nMonday soup needs carrots 450 g. Wednesday stew needs carrots 350 g. Lot C1 carrots 500 g use by Monday. C2 carrots 200 g use by Thursday, 50 g reserved. Shop carrots in 500 g packs.\n"},{"path":"tests\/case-1\/expected.json","content":"{\n    \"stock_used\": {\n        \"C1\": 450,\n        \"C2\": 150\n    },\n    \"shortfall\": {\n        \"carrots\": 200\n    },\n    \"buy_packs\": {\n        \"carrots\": 1\n    }\n}\n"},{"path":"tests\/case-1\/explanation.txt","content":"The unused 50 g from C1 cannot cover Wednesday. C2 has only 150 g available.\n"},{"path":"tests\/case-2\/request.txt","content":"What do we need for both nights? New stock lasts the week.\nReturn only the JSON specified in SKILL.md for this test.\n\nFriday noodles use peas 190 g, Saturday pasta uses peas 190 g. Frozen bag P1 has 100 g available for either meal. Peas sold in 300 g bags.\n"},{"path":"tests\/case-2\/expected.json","content":"{\n    \"stock_used\": {\n        \"P1\": 100\n    },\n    \"shortfall\": {\n        \"peas\": 280\n    },\n    \"buy_packs\": {\n        \"peas\": 1\n    }\n}\n"},{"path":"tests\/case-2\/explanation.txt","content":"Combining the shortfall lets one 300 g bag cover both meals.\n"},{"path":"tests\/case-3\/request.txt","content":"Shop for Tuesday using stock and unopened tins suitable on the meal date.\nReturn only the JSON specified in SKILL.md for this test.\n\nNeed 600 g drained chickpeas and 500 g dry pasta on Tuesday. Lot C contains 2 cans, 400 g net\/240 g drained each, one whole can reserved. Lot P contains 0.5 kg dry pasta. Store sells the same chickpea cans and 500 g pasta packs. Report stock in cans and kg, shortfalls in recipe grams.\n"},{"path":"tests\/case-3\/expected.json","content":"{\n    \"stock_used\": {\n        \"C\": 1,\n        \"P\": 0.5\n    },\n    \"shortfall\": {\n        \"chickpeas\": 360,\n        \"pasta\": 0\n    },\n    \"buy_packs\": {\n        \"chickpeas\": 2,\n        \"pasta\": 0\n    }\n}\n"},{"path":"tests\/case-3\/explanation.txt","content":"One available can provides 240 g. The remaining 360 g needs two new cans, leaving 120 g of usable chickpeas from those purchases.\n"}],"is_active":true,"is_approved":false}]}]}