Skip to content

Best Practices

The following are some best practices for writing great rules. If you are using Straion’s rule import, your rules will automatically follow these best practices.

Consistent modality is critical for both humans and AI to interpret rules correctly.

Use must for rules that are clearly mandatory or enforced (for example, security controls, compliance constraints, org-wide architecture decisions).

Use should for rules that are recommended, preferred, or optional, where deviations are allowed with justification.

Rules can include a code snippet that demonstrates how to implement or enforce the rule. Choose a snippet that directly illustrates the rule. This gives the AI a concrete pattern to follow rather than a generic template.

Atomicity The rule describes exactly one action.

Good: “The API gateway must reject requests without an Authorization header.”

Bad: “The API gateway must reject unauthenticated requests and log all errors to Datadog.”

Completeness The rule includes a precise verb, object/parameters, and any important conditions or scope.

Clarity The rule uses active voice and precise verbs. Avoid vague verbs like “support”, “handle”, or “ensure”.

Good: “The webhook processor must retry failed deliveries up to 3 times with exponential backoff.”

Vague: “The webhook processor must handle failures.”

Good: “The upload service must accept files up to 500 MB and process them within 60 seconds.”

Vague: “The system should support large files.”