Exercise · Your first Rule

Write and validate one Rule for a Pico.

Reusable exercise exemplar. Demonstrates the exercise convention documented in exercises/index.qmd.

Task

Write a single Rule for a Pico of your choice. The Rule must:

  • Have a stable id in the form rule.<slug>.
  • Declare a kind you would recognize in a real system.
  • Include a scalar value (a single-line string) the Composer could act on. The reference bin/pico parser only accepts the flat id / kind / value shape used in labs/hello-pico/.

Save it as rules/<your-slug>.yaml.

Success criteria

Automatable check

Confirm the Rule is well-formed by parsing it with the reference pico CLI shipped in this repository. From the root of your local clone, with the Hello Pico one-time setup applied so pico resolves to bin/pico:

pico parse rules/<your-slug>.yaml --out /tmp/parsed.json \
  && echo "OK: parsed $(basename rules/<your-slug>.yaml)"

The command exits with status 0 and prints an OK: line when the Rule declares the required id, kind, and value fields. Any other exit status means the Rule is missing a required field or uses an unsupported key — re-read the parser error and fix the Rule.

Hints

Start from the Hello Pico example in labs/hello-pico/solution.qmd and change the kind and value to something meaningful in your own domain.

Solution sketch

See solution.qmd for a worked example.