Weekly Menu Generator
Overview
This skill produces a random menu for a week. By default it covers 7 days, each
day with three meals (breakfast / lunch / dinner), drawn from a built-in dish
library (scripts/dishes.json). It focuses on everyday meal planning: the same dish
is not repeated within the same meal slot across a week whenever the pool is large
enough, output is human-readable, and a --seed value makes any run repeatable.
- Generates a complete week (day -> meal -> dish) in one call.
- In-week de-duplication is applied per meal slot (breakfast dishes only compete with breakfast dishes, and so on).
- Reproducible through
--seed; when omitted, a random seed is chosen and printed so the run can be reproduced. - Self-contained: pure Python 3 standard library, no network, no credentials.
Prerequisites
- Python 3.8+ available as
python3(orpython) onPATH. - No Huawei Cloud credentials, CLI (KooCLI), SDK, or network access are needed; this skill is entirely local.
scripts/dishes.jsonmust be present (it ships with the skill) unless a custom library is supplied with--dishes.
Workflow
- Load the dish library —
load_dishes()readsscripts/dishes.jsonand returns a mapping of meal slot to a list of dishes. - Pick the week —
pick_week(seed, days, meals, dedup)walks each day and each meal slot, choosing a dish from the slot's pool withrandom.Random(seed). When de-duplication is on, dishes already used in that slot this week are excluded; if the pool is too small, repeats are allowed and reported. - Render —
render_markdown()/render_text()/ JSON turn the week into readable output. - Emit — the result is written to standard output, or to a file when
--outputis given.
Core Commands
# Default: a 7-day Markdown menu, reproducible with the given seed
python3 scripts/generate_weekly_menu.py --seed 20240501
# Plain text
python3 scripts/generate_weekly_menu.py --seed 42 --format text
# JSON (machine-readable)
python3 scripts/generate_weekly_menu.py --seed 42 --format json
# Custom number of days and meal slots
python3 scripts/generate_weekly_menu.py --seed 7 --days 2 --meals breakfast,dinner
# Allow repeats (disable in-week de-duplication)
python3 scripts/generate_weekly_menu.py --no-dedup
# Use a custom dish library and write the result to a file
python3 scripts/generate_weekly_menu.py --dishes /path/to/dishes.json --output menu.md
# Run the bundled unit tests
python3 -m unittest discover -s tests -v
The command-line entry point is scripts/generate_weekly_menu.py. The built-in
scripts/dishes.json is what the examples above read by default.
Parameter Confirmation
| Parameter | Required | Description | Default |
|---|---|---|---|
--days |
No | Number of days to generate | 7 |
--meals |
No | Comma-separated meal slots | breakfast,lunch,dinner |
--seed |
No | Integer seed for reproducible output | random (printed) |
--format |
No | Output format: markdown, text, or json |
markdown |
--no-dedup |
No | Allow the same dish to repeat within the week | de-dup on |
--dishes |
No | Path to a custom dish library JSON | scripts/dishes.json |
--output |
No | Write the menu to a file instead of stdout | stdout |
Reference Documents
| Document | Description |
|---|---|
| references/usage-guide.md | Command recipes, reproducibility rules, extending the library |
| references/verification-method.md | How the skill is verified (offline unit tests + spot checks) |
| references/acceptance-criteria.md | Acceptance criteria and out-of-scope items |
| references/dataflow-diagram.md | Mermaid data flow diagram |
| references/iam-policies.md | Permission notes (none required) |
Notes
- The generator is read-only with respect to the cloud: it reads only its local
dish library and writes only to standard output or a user-chosen
--outputfile. - Output ordering: days are labelled
Day 1..Day Nwith a weekday name cycling from Monday. - To expand the menu, add dishes to the arrays in
scripts/dishes.json; each meal array should keep at least 7 entries so a duplicate-free week remains possible.
