{"skills":[{"name":"Convert recipe cups to ingredient weights","description":"Replace cup measures with grams using the right ingredient, preparation and chart, leaving unsupported conversions visible.","content":"# Convert recipe cups to ingredient weights\n\nReplace cup measures with grams using the right ingredient, preparation and chart, leaving unsupported conversions visible.\n\n## When to use this skill\n\n- A US recipe lists flour, sugar, butter or nuts in cups and the person wants to weigh them in grams.\n- An Australian or other metric-cup recipe needs converting, or someone wants millilitres for their own measuring jug.\n- Someone asks what a cup of a particular ingredient weighs.\n\n## When not to use it\n\n- Scaling the recipe up or down. Convert first, then use the recipe resize skill.\n- Measuring infant formula or medicines. Follow the manufacturer's scoop or the prescriber's instructions, not a kitchen conversion.\n- Working out nutrition or allergen content from the converted weights. Use the product labels or a nutrition database.\n\n## What you need\n\n- Original recipe measurements, cup convention and ingredient descriptions including packed, sifted, chopped or whole.\n- The recipe author's gram equivalents or a compatible ingredient-specific reference chart and any intended scaling.\n\n## Ask before you start\n\nIf any of these are missing or unclear, ask before doing the work.\n\n- Which country is the recipe from, or what cup and spoon sizes does it state? Australian recipes use a 250 mL cup and a 20 mL tablespoon; a US customary cup is slightly smaller.\n- How is each ingredient described: packed, sifted, chopped, whole, melted or softened? Each form has its own weight per cup.\n- Does the recipe author give gram weights or say how they filled the cup? Those take priority over a general chart.\n\n## Method\n\n1. Identify the cup and spoon convention from the recipe's country or its stated sizes. Do not apply a chart written for one cup size to a recipe written for another without converting the volume first.\n2. For each line, choose the weight basis in this order: the recipe author's own gram weight for that recipe, then a reference entry that matches the ingredient, its form (packed, sifted, chopped, whole) and the cup convention. Record the basis used for each line.\n3. Normalise the chosen entry to grams per cup before multiplying. A row quoted per half-cup or per tablespoon must be scaled first: 43 g per \u00bd cup is 86 g per cup. Keep fractions exact until the final figure, then round to one decimal gram.\n4. Leave a line unconverted when no matching entry exists. Do not borrow a weight from a different form of the same ingredient, and do not treat millilitres as grams for a powder, solid or oil unless the person supplies a weight or density.\n5. When millilitres are requested, use the recipe's own cup or spoon size: two Australian tablespoons are 40 mL. A known volume can be reported even when its weight is unknown.\n6. Keep an ingredient that appears twice in different forms as separate lines, and for every unconverted line say what would let it be weighed: an author's weight, a matching chart entry or the packet's weight per cup.\n\n## Checks before you deliver\n\n- A US cup is a measure of volume. Different ingredients occupying a cup can have very different masses.\n- Packed brown sugar and loose sugar may not match the same conversion.\n- Reading a per-half-cup row as per cup halves the weight: \u00be cup of sliced almonds at 43 g per \u00bd cup is 64.5 g, not 32.25 g.\n- Taking an Australian tablespoon as 15 mL under-measures by a quarter; it is 20 mL.\n- Using a chopped-nut weight for whole nuts. King Arthur lists chopped walnuts at 113 g per cup and whole walnuts at 64 g per half cup.\n\n## How to present the result\n\nGive the converted ingredient list first, in recipe order, with grams beside the original measure ('1\u00bd cups plain flour: 180 g'). Mark each line's basis (author's weight or which chart). Then list any line left unconverted with exactly what is needed to weigh it, and say which cup convention was used.\n\n## Worked example\n\n**Request:** Convert these US cup measures to grams.\n\n**Supplied material:**\n\n```text\nChart: plain flour 1 cup = 120 g; sliced almonds 1\/2 cup = 43 g. A: 1.5 cups plain flour. B: 3\/4 cup sliced almonds. C: 1\/4 cup whole almonds, reference unavailable.\n```\n\n**Answer:** Weigh out 180 g of plain flour and 64.5 g of sliced almonds. Keep the whole almonds at \u00bc cup until you have a weight for whole almonds.\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 grams keyed by line ID (number rounded to one decimal, or null), and unsupported as unmatched line IDs in input order. Use the supplied conversion chart for tests and prefer an author's explicit weight for that recipe when both exist. If millilitres are requested, also return volume_ml keyed by the lines requested in volume, using null when the source convention is unresolved.\n\n## Sources\n\n- [King Arthur Baking: ingredient weight chart](https:\/\/www.kingarthurbaking.com\/learn\/ingredient-weight-chart): Gives volume-to-weight equivalents for each ingredient and form (packed brown sugar, chopped and whole nuts, flours), some per cup and some per half cup, and tells readers to go by the weight in the recipe where it differs. The skill's matching and normalising steps follow this chart's layout.\n- [Illawarra Shoalhaven Local Health District (NSW Health): metric cup and spoon measurements](https:\/\/www.islhd.health.nsw.gov.au\/sites\/default\/files\/Health_Promotion\/Cookbooks\/Baby_Toddler_cookbook.pdf): The cookbook's cooking tips table lists 1 metric cup as 250 mL, 1 tablespoon as 20 mL and 1 teaspoon as 5 mL for its Australian recipes. This is the basis for the Australian spoon conversion.\n- [NIST: culinary measurement tips](https:\/\/www.nist.gov\/pml\/owm\/culinary-measurement-tips): The US measurement authority recommends weighing ingredients with a kitchen scale for accuracy, notes that customary measures differ between countries and that metric cups are slightly larger than US customary cups, and warns against using dry cups for liquids.\n\nTest cases and an answer checker for this skill: https:\/\/skills.raq.com\/skills\/convert-recipe-cups-by-ingredient\n","scope":"contextual","trigger_keywords":["Convert recipe cups to ingredient weights","convert-recipe-cups-by-ingredient","convert recipe cups by ingredient","How many grams are the cups of flour, sugar and butter in this recipe?","How many grams are the cups of flour, sugar and butter in this recipe","cups to grams","convert these cup measurements","grams per cup"],"is_private":true,"is_active":true,"scripts":[{"name":"convert-recipe-cups-by-ingredient-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":"convert-recipe-cups-by-ingredient-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: convert-recipe-cups-by-ingredient\ndescription: \"Convert cup and spoon measures in a recipe to grams using ingredient-specific weights, and flag lines that cannot be converted safely. Use when someone asks for cups to grams, wants to weigh a US or Australian recipe instead of using measuring cups, or asks what a cup of an ingredient weighs.\"\nlicense: CC-BY-4.0\nmetadata:\n  author: Raq.com\n  version: \"2026-11-22\"\n  homepage: https:\/\/skills.raq.com\/skills\/convert-recipe-cups-by-ingredient\n---\n\n# Convert recipe cups to ingredient weights\n\nReplace cup measures with grams using the right ingredient, preparation and chart, leaving unsupported conversions visible.\n\n## When to use this skill\n\n- A US recipe lists flour, sugar, butter or nuts in cups and the person wants to weigh them in grams.\n- An Australian or other metric-cup recipe needs converting, or someone wants millilitres for their own measuring jug.\n- Someone asks what a cup of a particular ingredient weighs.\n\n## When not to use it\n\n- Scaling the recipe up or down. Convert first, then use the recipe resize skill.\n- Measuring infant formula or medicines. Follow the manufacturer's scoop or the prescriber's instructions, not a kitchen conversion.\n- Working out nutrition or allergen content from the converted weights. Use the product labels or a nutrition database.\n\n## What you need\n\n- Original recipe measurements, cup convention and ingredient descriptions including packed, sifted, chopped or whole.\n- The recipe author's gram equivalents or a compatible ingredient-specific reference chart and any intended scaling.\n\n## Ask before you start\n\nIf any of these are missing or unclear, ask before doing the work.\n\n- Which country is the recipe from, or what cup and spoon sizes does it state? Australian recipes use a 250 mL cup and a 20 mL tablespoon; a US customary cup is slightly smaller.\n- How is each ingredient described: packed, sifted, chopped, whole, melted or softened? Each form has its own weight per cup.\n- Does the recipe author give gram weights or say how they filled the cup? Those take priority over a general chart.\n\n## Method\n\n1. Identify the cup and spoon convention from the recipe's country or its stated sizes. Do not apply a chart written for one cup size to a recipe written for another without converting the volume first.\n2. For each line, choose the weight basis in this order: the recipe author's own gram weight for that recipe, then a reference entry that matches the ingredient, its form (packed, sifted, chopped, whole) and the cup convention. Record the basis used for each line.\n3. Normalise the chosen entry to grams per cup before multiplying. A row quoted per half-cup or per tablespoon must be scaled first: 43 g per \u00bd cup is 86 g per cup. Keep fractions exact until the final figure, then round to one decimal gram.\n4. Leave a line unconverted when no matching entry exists. Do not borrow a weight from a different form of the same ingredient, and do not treat millilitres as grams for a powder, solid or oil unless the person supplies a weight or density.\n5. When millilitres are requested, use the recipe's own cup or spoon size: two Australian tablespoons are 40 mL. A known volume can be reported even when its weight is unknown.\n6. Keep an ingredient that appears twice in different forms as separate lines, and for every unconverted line say what would let it be weighed: an author's weight, a matching chart entry or the packet's weight per cup.\n\n## Checks before you deliver\n\n- A US cup is a measure of volume. Different ingredients occupying a cup can have very different masses.\n- Packed brown sugar and loose sugar may not match the same conversion.\n- Reading a per-half-cup row as per cup halves the weight: \u00be cup of sliced almonds at 43 g per \u00bd cup is 64.5 g, not 32.25 g.\n- Taking an Australian tablespoon as 15 mL under-measures by a quarter; it is 20 mL.\n- Using a chopped-nut weight for whole nuts. King Arthur lists chopped walnuts at 113 g per cup and whole walnuts at 64 g per half cup.\n\n## How to present the result\n\nGive the converted ingredient list first, in recipe order, with grams beside the original measure ('1\u00bd cups plain flour: 180 g'). Mark each line's basis (author's weight or which chart). Then list any line left unconverted with exactly what is needed to weigh it, and say which cup convention was used.\n\n## Worked example\n\n**Request:** Convert these US cup measures to grams.\n\n**Supplied material:**\n\n```text\nChart: plain flour 1 cup = 120 g; sliced almonds 1\/2 cup = 43 g. A: 1.5 cups plain flour. B: 3\/4 cup sliced almonds. C: 1\/4 cup whole almonds, reference unavailable.\n```\n\n**Answer:** Weigh out 180 g of plain flour and 64.5 g of sliced almonds. Keep the whole almonds at \u00bc cup until you have a weight for whole almonds.\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 grams keyed by line ID (number rounded to one decimal, or null), and unsupported as unmatched line IDs in input order. Use the supplied conversion chart for tests and prefer an author's explicit weight for that recipe when both exist. If millilitres are requested, also return volume_ml keyed by the lines requested in volume, using null when the source convention is unresolved.\n\n## Sources\n\n- [King Arthur Baking: ingredient weight chart](https:\/\/www.kingarthurbaking.com\/learn\/ingredient-weight-chart): Gives volume-to-weight equivalents for each ingredient and form (packed brown sugar, chopped and whole nuts, flours), some per cup and some per half cup, and tells readers to go by the weight in the recipe where it differs. The skill's matching and normalising steps follow this chart's layout.\n- [Illawarra Shoalhaven Local Health District (NSW Health): metric cup and spoon measurements](https:\/\/www.islhd.health.nsw.gov.au\/sites\/default\/files\/Health_Promotion\/Cookbooks\/Baby_Toddler_cookbook.pdf): The cookbook's cooking tips table lists 1 metric cup as 250 mL, 1 tablespoon as 20 mL and 1 teaspoon as 5 mL for its Australian recipes. This is the basis for the Australian spoon conversion.\n- [NIST: culinary measurement tips](https:\/\/www.nist.gov\/pml\/owm\/culinary-measurement-tips): The US measurement authority recommends weighing ingredients with a kitchen scale for accuracy, notes that customary measures differ between countries and that metric cups are slightly larger than US customary cups, and warns against using dry cups for liquids.\n\nTest cases and an answer checker for this skill: https:\/\/skills.raq.com\/skills\/convert-recipe-cups-by-ingredient\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\/convert-recipe-cups-by-ingredient\nReferenced third-party materials retain their own terms.\n"},{"path":"examples\/worked-example.md","content":"# Match the chart\u2019s reference volume\n\nConvert these US cup measures to grams.\n\n## Supplied material\n\nChart: plain flour 1 cup = 120 g; sliced almonds 1\/2 cup = 43 g. A: 1.5 cups plain flour. B: 3\/4 cup sliced almonds. C: 1\/4 cup whole almonds, reference unavailable.\n\n## Worked answer\n\nWeigh out 180 g of plain flour and 64.5 g of sliced almonds. Keep the whole almonds at \u00bc cup until you have a weight for whole almonds.\n\n## Reasoning\n\nThe almond reference is per half-cup and applies only to sliced almonds.\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":"Convert these US cup measures to grams.\nReturn only the JSON specified in SKILL.md for this test.\n\nChart: plain flour 1 cup = 120 g; sliced almonds 1\/2 cup = 43 g. A: 1.5 cups plain flour. B: 3\/4 cup sliced almonds. C: 1\/4 cup whole almonds, reference unavailable.\n"},{"path":"tests\/case-1\/expected.json","content":"{\n    \"grams\": {\n        \"A\": 180,\n        \"B\": 64.5,\n        \"C\": null\n    },\n    \"unsupported\": [\n        \"C\"\n    ]\n}\n"},{"path":"tests\/case-1\/explanation.txt","content":"The almond reference is per half-cup and applies only to sliced almonds.\n"},{"path":"tests\/case-2\/request.txt","content":"Use this recipe author's weights if supplied.\nReturn only the JSON specified in SKILL.md for this test.\n\nChart for US cups: plain flour 1 cup = 120 g. Author's note for this dough: my cup of plain flour weighed 128 g. A: 2.25 cups of that flour. B: 1\/2 cup chopped dried fruit, no equivalent.\n"},{"path":"tests\/case-2\/expected.json","content":"{\n    \"grams\": {\n        \"A\": 288,\n        \"B\": null\n    },\n    \"unsupported\": [\n        \"B\"\n    ]\n}\n"},{"path":"tests\/case-2\/explanation.txt","content":"The dough's own measured baseline takes precedence over a general chart.\n"},{"path":"tests\/case-3\/request.txt","content":"Give flour in grams, and oil in grams and millilitres for my jug.\nReturn only the JSON specified in SKILL.md for this test.\n\nAustralian recipe: 250 mL cup, 20 mL tablespoon. A: one level cup of the specified flour, supplier gives 150 g per 250 mL cup. B: two tablespoons oil, no mass or density supplied.\n"},{"path":"tests\/case-3\/expected.json","content":"{\n    \"grams\": {\n        \"A\": 150,\n        \"B\": null\n    },\n    \"unsupported\": [\n        \"B\"\n    ],\n    \"volume_ml\": {\n        \"B\": 40\n    }\n}\n"},{"path":"tests\/case-3\/explanation.txt","content":"Two Australian tablespoons give 40 mL; that volume does not establish the oil's weight.\n"}],"is_active":true,"is_approved":false}]}]}