Guard · Rules

Rules

The anti-pattern rule engine, in one panel. List every rule, tune a rule's thresholds, test a candidate against live data before you keep it, or author a new declarative rule with no code file.

Where to find it

  • Localhost: /rules.html?repo=<id>
  • API: GET /api/rules, POST /api/rules/evaluate (the playground), POST /api/rules/<id>/params (save tuned thresholds), POST /api/rules/custom (author a rule), POST /api/rules/custom/evaluate (test a draft without saving it)
  • Keyboard: ⌘ K then rules
  • Navigation: Memory in the sidebar, then Rules under All tools, in the Decisions and errors group

What it does for you

Tune a rule without editing code.Each built-in rule with tunable params exposes its thresholds as a form on the panel; the server validates the values against the rule's param schema and merges them onto the defaults, so you adjust when a rule fires without touching a source file.
Test a candidate live before you keep it.The evaluate endpoints run a rule (built-in with candidate params, or a draft you are authoring) against the current data and show what it would flag, so you see the effect before you save it.
Author a declarative custom rule.Write a new rule in the authoring vocabulary and it persists as a declarative definition at config/rules/custom/<id>.json, registered live, no code file required. The same endpoint prefix replaces (PUT) or removes (DELETE) a custom rule; built-in ids are refused.

Read more

Last updated