← back to dashboard · playground · simulator
Rule authoring
Pick a rule shape, fill in the form, and the wizard emits a Catala module. Validate against the live catala typecheck + catala interpret. Save back to rules/ if the API is started in admin mode (HABEAS_ADMIN_MODE=1 python3 api/server.py) — otherwise download the file. The generated module ships with a single #[test] scope using the values you entered, so saving immediately wires it into CI alongside the existing rule library.
How to use this page
Draft a new rule, validate it, add it to the library
Most legal rules fall into a small number of shapes : threshold tests (does X exceed Y?), multi-prong tests (do all of A, B, C hold?), arithmetic awards (rate × period), gate-and-act (admissibility before substance). This page lets you produce a working Catala rule by picking a shape and filling in a form — no Catala syntax required. The result is a real, typechecked rule module identical in structure to the 12 already in the library.
Three steps
Pick a shape on the left. Each shape comes with a short blurb explaining when to use it. The form below adapts to the shape.
Fill in the form — rule name, jurisdiction, source citation, the actual logic (prongs / threshold / formula), and at least one test case.
Validate. The right-hand panel shows the live Catala source as you type. "Validate" runs catala typecheck against it. "Download" gives you the .catala_en file. "Save to rules/" writes it directly into the repo (admin mode only).
What you'll get
A Catala module under rules/<your_rule_id>.catala_en with a typechecked predicate.
A metadata file rules/<your_rule_id>_metadata.json with the rule's state set to draft and your authorship recorded.
A #[test] scope using the test inputs you entered, which CI runs on every push.
Auto-registration in the playground and simulator's rule pickers.
New rules enter the certification lifecycle at draft. To advance to submitted, open a PR. See rules/_certification.yaml for the full process.
Generated Catala source
(pick a shape on the left)