For example, if the indirect object could come before or after the verb. How would I construct a rule for that?
What do you want the rule to do?
Give some examples of the problems and the intended solutions.
So something like,
Tas man patīk / Man patīk tas / Tas patīk man
All those variants are acceptable. But suppose I need to assert that in a sentence, the subject and verb have grammatical agreement (eg. 1st person).
How can I enforce that a verb and subject agree if word order is flexible?
Make a rulegroup (Development Overview | dev.languagetool.org) with 3 rules. Each rule deals with one word order. (Possibly, you will need more than 3 rules, but in principle, one rule for one word order.)