On this page

skryba rule

Hold the writing rules every rewrite is counted against: how many words a sentence may have, how long words run, how many sentences or words a paragraph holds, how many list lines and headings a text may carry, and how often a phrase may appear. A rule is counted from the text, never judged by a model, so it reads no credential and gives the same answer every time. What each metric counts is writing rules.

Invocation

skryba rule list
skryba rule show <NAME>
skryba rule add <NAME> --metric <METRIC> (--max <N> | --min <N>) [--phrase <TEXT>]
skryba rule edit <NAME> [--max <N> | --min <N>] [--phrase <TEXT>]
skryba rule remove <NAME>
skryba rule check [<INPUT> | --draft <ID>]

--metric is one of sentence-words, mean-sentence-words, word-characters, paragraph-sentences, paragraph-words, list-lines, heading-lines and phrase. --max bounds every measured value from above, --min from below; the two cannot be given together. A phrase rule needs --phrase, the exact text it counts, and no other metric takes one. A limit is any finite number of at least zero.

Effect on rewrites

Every rule held is told to the generator of every rewrite candidate, after the style and language, and counted on every candidate. A candidate that breaks a rule is not selected, however undetectable it is; each candidate in the rewrite report carries rules_passed and rule_violations, the rules it broke with what it broke them on. When no candidate of a chunk passes every check, the chunk falls back to its source as it does for the quality gate, and the source's own rule verdict is reported beside it.

check counts every rule on one text — INPUT as a path, - or nothing for stdin, or a retained draft — and writes nothing.

Output

action    "list", "show", "add", "edit", "remove" or "check"
store     stado://database/skryba/<SCHEMA>
rule      {name, metric, bound, value, phrase, created_at, updated_at}; show, add, edit, remove
rules     every rule, alphabetical; list and check
changed   false when an edit changed nothing; edit only
checks    [{rule, metric, bound, value, phrase, observed, passed,
            violations: [{index, value, text}]}]; check only
passed    true when every rule passed; check only

observed is the value furthest toward the bound — the largest for max, the smallest for min — and is absent when the text gave the metric nothing to measure. A violation of a per-sentence or per-paragraph metric names its position and text; a whole-text metric has neither. check exits 0 whether or not the rules pass: the verdict is passed.

Example: hold rewrites to your own sentence length

skryba writing-style profile --quantile 0.9
skryba rule add short-sentences --metric sentence-words --max 22
skryba rule add no-delve --metric phrase --max 0 --phrase delve
skryba rule add no-lists --metric list-lines --max 0
skryba rule check draft.md

Refusals

  • rule name <NAME> is not valid: use lowercase letters, digits or hyphens, starting with a letter.
  • rule <NAME> needs a limit: pass --max <N> or --min <N>.
  • rule <NAME> needs a finite limit of at least zero, not <VALUE>.
  • rule <NAME> counts a phrase: pass --phrase with the exact text to count.
  • --phrase belongs to --metric phrase; rule <NAME> measures <METRIC>.
  • rule <NAME> already exists in <STORE>; change it with `skryba rule edit <NAME> --max <N>` .
  • rule <NAME> is not in <STORE>; held rules: <NAMES>; add it with `skryba rule add <NAME> --metric <METRIC> --max <N>` — show, edit, remove.
  • rule edit needs --max <N>, --min <N> or --phrase <TEXT>; nothing was asked to change.
  • clap's own the argument '--max <MAX>' cannot be used with '--min <MIN>' and invalid value '<V>' for '--metric <METRIC>', exit 2.
  • rule <NAME> in <STORE> holds metric <M>, which this build does not know — a row written by a newer Skryba.
  • creating the writing rules in …, adding rule <NAME> to … and the other store steps carry Postgres's own sentence.

Maintained as part of the website-owned Skryba documentation corpus.