Solution · Your first Rule

A reference solution that satisfies the exercise’s success criteria.

Example rule

# rules/kitchen-timer.yaml
id: rule.kitchen-timer
kind: timer
value: "Time's up! (5m)"

Why it satisfies the criteria

  • Valid YAML — matches the flat id / kind / value shape the reference bin/pico parser accepts.
  • Stable id — namespaced under rule. and named after the concept, not the implementation.
  • Composer-actionable — a timer-aware Composer could read the scalar value and emit a Pico that surfaces the message when the duration elapses. The reference Composer in this repo only handles kind: greeting, so this Rule intentionally targets a broader design conversation rather than direct composition here.

Automatable check

pico parse rules/kitchen-timer.yaml --out /tmp/parsed.json \
  && echo "OK: parsed rules/kitchen-timer.yaml"

Expected output ends with OK: parsed rules/kitchen-timer.yaml and the command exits with status 0.

Variations

  • Replace timer with a domain of your own (e.g. greeting, webhook, sensor) — keeping the flat id / kind / value shape so pico parse still accepts it.
  • Add a second Rule and compose both into a single Pico, matching the “two rules” variation in labs/hello-pico/solution.qmd.