Grocery list from recipes
Read the recipes, build one merged list, sort it by store department, check it
with the user, then print it with print-to-thermal. The thermal skill
covers the printer itself. If print-to-thermal config exits with code 3, the
printer is not set up: follow that skill's first-run setup before printing.
1. Get the ingredients
- Recipe URL: fetch it. The skill doesn't pre-approve web fetches, so
the user approves each one when prompted. Most recipe sites embed
schema.org/Recipe JSON-LD, and its recipeIngredient array is the most
reliable ingredient list, so look for that first and use the page text only
if it's missing.
Also note name (the dish name) and recipeYield.
- Menu URL or meal plan (a list of dishes, not recipes): work out a
typical ingredient list for each dish. Tell the user these are your
assumptions, not quoted from the page, and invite corrections.
- Pasted text: use it as given.
- Several sources: handle each one, remembering which dish each
ingredient came from.
- If the user declines the fetch, or a page refuses it, is paywalled or needs
a login, ask the user to paste the recipe. Don't retry it or try other
routes to the same page.
If the user asks for more or fewer servings, scale the amounts before merging.
2. Normalize and merge
Turn every line into {name, qty} for buying, not cooking:
- Drop prep words: "finely diced", "divided", "softened", "plus more for
serving", "at room temperature". Keep words that change what you buy:
"boneless skinless", "low-sodium", "full-fat", "fresh" vs "dried".
- Use the plain item name a shopper looks for: "Yellow onions", not "1 medium
yellow onion, halved".
- Turn cooking amounts into buying amounts where it's obvious: 3 cloves garlic
becomes "1 head", juice of 2 limes becomes "2" limes, 1/4 cup chopped
cilantro becomes "1 bunch", 2 cups cooked rice becomes the dry rice.
- Merge duplicates across recipes. Add the amounts when the units match
(2 + 1 When they don't, list both ("1 cup + 2 tbsp"). Don't
convert between volume and weight.
- Every item gets a qty. If none applies, use a count ("1"). A blank qty
prints a line of dots that ends in nothing.
- Staples (salt, pepper, cooking oil, common dried spices, flour, sugar)
go in a final Check pantry department with qty
have?, so the user
checks the cupboard instead of buying a duplicate. Leave out water and ice.
3. Sort by department
Use these departments in this order, which is roughly how a store is walked.
Leave out any with nothing in them.
| Department |
Goes here |
| Produce |
fresh fruit and vegetables, fresh herbs, garlic, ginger, fresh chiles, tofu if the store keeps it there |
| Bakery |
bread, rolls, buns, tortillas, pita, naan |
| Deli |
sliced meats, deli-counter cheese, olives, prepared salads |
| Butcher |
beef, pork, lamb, poultry, ground meat, sausage, bacon |
| Seafood |
fish, shrimp, shellfish |
| Dairy & Eggs |
milk, cream, butter, eggs, yogurt, sour cream, packaged cheese |
| Canned & Jarred |
canned tomatoes, beans, stock and broth, coconut milk, pickles, jarred sauces |
| Dry Goods & Pasta |
pasta, rice, grains, lentils, dried beans, breadcrumbs, cereal, nuts |
| Baking |
flour, sugars, baking soda and powder, yeast, chocolate, vanilla |
| Spices & Condiments |
dried spices and blends, oils, vinegars, soy sauce, mustard, ketchup, honey |
| International |
fish sauce, gochujang, curry paste, tahini, harissa, specialty items |
| Frozen |
frozen vegetables and fruit, puff pastry, ice cream |
| Beverages |
drinks, wine or beer used in cooking |
| Check pantry |
staples, from step 2 |
Rules for the borderline items:
- Fresh herbs go in Produce; dried herbs go in Spices & Condiments.
- Parmesan, feta and other packaged cheese go in Dairy & Eggs. Only cheese
"sliced at the counter" goes in Deli.
- Anything described as "frozen" goes in Frozen, whatever it is.
- Stock and broth go in Canned & Jarred, even when sold in cartons.
- An oil or spice the dish depends on, such as toasted sesame oil, smoked
paprika or saffron, goes in its department, not Check pantry.
- Within a department, list items in the order a shopper would want them,
or alphabetically if no order is obvious.
If the user has said how their store is laid out, use their order instead.
4. Check before printing
Show the grouped list in chat: department headings, then one item — qty per
line. Say which dishes it covers and list any ingredient you inferred. Then ask:
"Anything you already have, or anything to add?" Apply their changes. Skip this
step when they've said to just print it.
5. Print
Compose the job yourself from the printer's primitives (the thermal skill
lists them all). There is no grocery template in print-to-thermal, on purpose:
the layout lives here, so it can change without touching the program. The layout:
- a
big title (keep it short: "Groceries", the store name, "Sunday dinner"),
- a centred
text line naming the dishes, shortened to one line if possible,
- a
rule of =,
- for each department, a size-2 bold inverted
text heading with a space on
either side of the name, one row per item ([ ] name on the left, qty on
the right, . fill), then a space.
{ "blocks": [
{ "type": "big", "text": "Groceries", "height": 7 },
{ "type": "text", "text": "Tikka masala + naan", "align": "center" },
{ "type": "rule", "char": "=" },
{ "type": "text", "text": " Produce ", "size": 2, "bold": true, "invert": true },
{ "type": "row", "left": "[ ] Yellow onions", "right": "3", "fill": "." },
{ "type": "row", "left": "[ ] Garlic", "right": "1 head", "fill": "." },
{ "type": "space" },
{ "type": "text", "text": " Check pantry ", "size": 2, "bold": true, "invert": true },
{ "type": "row", "left": "[ ] Garam masala", "right": "have?", "fill": "." },
{ "type": "space" }
] }
- Write the job to a file in a temporary directory, then preview it with
print-to-thermal preview <file>. Fix every warning: and OVERFLOW.
Long names wrap onto a second line, which is fine. Shorten them only if the
list becomes hard to read.
- Print with
print-to-thermal print <file>. "sent" means the printer
accepted the job, not that paper came out. Say so.
- Text prints as ASCII only. Accents and symbols such as
é and ½ are
converted automatically ("jalapeno", "1/2"), so write fractions as 1/2.
A list longer than about 40 items makes a long receipt. Mention that, and
offer to split it into one print per store or per trip.
1---2name: grocery-list3description: Turn recipes or a menu into a shopping list grouped by grocery store department (produce, bakery, deli, butcher, seafood, dairy, canned goods, dry goods, baking, spices, frozen...) in walking order, with duplicate ingredients merged, then print it on the thermal receipt printer. Takes a recipe or menu URL, pasted recipe text, or several of them at once. TRIGGER when the user asks for a shopping or grocery list from a recipe, menu, meal plan or link, asks "what do I need to buy for...", or wants a recipe's ingredients printed.4allowed-tools: Bash(print-to-thermal *)5metadata:6 source: https://skillmd.com/skills/matmar10/grocery-list7---89# Grocery list from recipes1011Read the recipes, build one merged list, sort it by store department, check it12with the user, then print it with `print-to-thermal`. The `thermal` skill13covers the printer itself. If `print-to-thermal config` exits with code 3, the14printer is not set up: follow that skill's first-run setup before printing.1516## 1. Get the ingredients1718- **Recipe URL:** fetch it. The skill doesn't pre-approve web fetches, so19 the user approves each one when prompted. Most recipe sites embed20 `schema.org/Recipe` JSON-LD, and its `recipeIngredient` array is the most21 reliable ingredient list, so look for that first and use the page text only22 if it's missing.23 Also note `name` (the dish name) and `recipeYield`.24- **Menu URL or meal plan** (a list of dishes, not recipes): work out a25 typical ingredient list for each dish. Tell the user these are your26 assumptions, not quoted from the page, and invite corrections.27- **Pasted text:** use it as given.28- **Several sources:** handle each one, remembering which dish each29 ingredient came from.30- If the user declines the fetch, or a page refuses it, is paywalled or needs31 a login, ask the user to paste the recipe. Don't retry it or try other32 routes to the same page.3334If the user asks for more or fewer servings, scale the amounts before merging.3536## 2. Normalize and merge3738Turn every line into `{name, qty}` for **buying**, not cooking:3940- Drop prep words: "finely diced", "divided", "softened", "plus more for41 serving", "at room temperature". Keep words that change what you buy:42 "boneless skinless", "low-sodium", "full-fat", "fresh" vs "dried".43- Use the plain item name a shopper looks for: "Yellow onions", not "1 medium44 yellow onion, halved".45- Turn cooking amounts into buying amounts where it's obvious: 3 cloves garlic46 becomes "1 head", juice of 2 limes becomes "2" limes, 1/4 cup chopped47 cilantro becomes "1 bunch", 2 cups cooked rice becomes the dry rice.48- **Merge duplicates** across recipes. Add the amounts when the units match49 (2 + 1 onions = 3). When they don't, list both ("1 cup + 2 tbsp"). Don't50 convert between volume and weight.51- **Every item gets a qty.** If none applies, use a count ("1"). A blank qty52 prints a line of dots that ends in nothing.53- **Staples** (salt, pepper, cooking oil, common dried spices, flour, sugar)54 go in a final **Check pantry** department with qty `have?`, so the user55 checks the cupboard instead of buying a duplicate. Leave out water and ice.5657## 3. Sort by department5859Use these departments in this order, which is roughly how a store is walked.60Leave out any with nothing in them.6162| Department | Goes here |63|---|---|64| Produce | fresh fruit and vegetables, fresh herbs, garlic, ginger, fresh chiles, tofu if the store keeps it there |65| Bakery | bread, rolls, buns, tortillas, pita, naan |66| Deli | sliced meats, deli-counter cheese, olives, prepared salads |67| Butcher | beef, pork, lamb, poultry, ground meat, sausage, bacon |68| Seafood | fish, shrimp, shellfish |69| Dairy & Eggs | milk, cream, butter, eggs, yogurt, sour cream, packaged cheese |70| Canned & Jarred | canned tomatoes, beans, stock and broth, coconut milk, pickles, jarred sauces |71| Dry Goods & Pasta | pasta, rice, grains, lentils, dried beans, breadcrumbs, cereal, nuts |72| Baking | flour, sugars, baking soda and powder, yeast, chocolate, vanilla |73| Spices & Condiments | dried spices and blends, oils, vinegars, soy sauce, mustard, ketchup, honey |74| International | fish sauce, gochujang, curry paste, tahini, harissa, specialty items |75| Frozen | frozen vegetables and fruit, puff pastry, ice cream |76| Beverages | drinks, wine or beer used in cooking |77| Check pantry | staples, from step 2 |7879Rules for the borderline items:8081- Fresh herbs go in Produce; dried herbs go in Spices & Condiments.82- Parmesan, feta and other packaged cheese go in Dairy & Eggs. Only cheese83 "sliced at the counter" goes in Deli.84- Anything described as "frozen" goes in Frozen, whatever it is.85- Stock and broth go in Canned & Jarred, even when sold in cartons.86- An oil or spice the dish depends on, such as toasted sesame oil, smoked87 paprika or saffron, goes in its department, not Check pantry.88- Within a department, list items in the order a shopper would want them,89 or alphabetically if no order is obvious.9091If the user has said how their store is laid out, use their order instead.9293## 4. Check before printing9495Show the grouped list in chat: department headings, then one `item — qty` per96line. Say which dishes it covers and list any ingredient you inferred. Then ask:97"Anything you already have, or anything to add?" Apply their changes. Skip this98step when they've said to just print it.99100## 5. Print101102Compose the job yourself from the printer's primitives (the `thermal` skill103lists them all). There is no grocery template in `print-to-thermal`, on purpose:104the layout lives here, so it can change without touching the program. The layout:105106- a `big` title (keep it short: "Groceries", the store name, "Sunday dinner"),107- a centred `text` line naming the dishes, shortened to one line if possible,108- a `rule` of `=`,109- for each department, a size-2 bold inverted `text` heading with a space on110 either side of the name, one `row` per item (`[ ] name` on the left, qty on111 the right, `.` fill), then a `space`.112113```json114{ "blocks": [115 { "type": "big", "text": "Groceries", "height": 7 },116 { "type": "text", "text": "Tikka masala + naan", "align": "center" },117 { "type": "rule", "char": "=" },118 { "type": "text", "text": " Produce ", "size": 2, "bold": true, "invert": true },119 { "type": "row", "left": "[ ] Yellow onions", "right": "3", "fill": "." },120 { "type": "row", "left": "[ ] Garlic", "right": "1 head", "fill": "." },121 { "type": "space" },122 { "type": "text", "text": " Check pantry ", "size": 2, "bold": true, "invert": true },123 { "type": "row", "left": "[ ] Garam masala", "right": "have?", "fill": "." },124 { "type": "space" }125] }126```127128- Write the job to a file in a temporary directory, then preview it with129 `print-to-thermal preview <file>`. Fix every `warning:` and `OVERFLOW`.130 Long names wrap onto a second line, which is fine. Shorten them only if the131 list becomes hard to read.132- Print with `print-to-thermal print <file>`. "sent" means the printer133 accepted the job, not that paper came out. Say so.134- Text prints as ASCII only. Accents and symbols such as `é` and `½` are135 converted automatically ("jalapeno", "1/2"), so write fractions as `1/2`.136137A list longer than about 40 items makes a long receipt. Mention that, and138offer to split it into one print per store or per trip.