Rules as code Recommended
Enforce the writing style in code
Check the writing of every page and document in the build, so the language stays plain and short as more people and AI tools write.
How to do it
Strip code from each page's text and check it. Each sentence has at most 25 words, with no semicolons and no banned jargon. A colon never sits between a sentence and an inline list. Headings never join a fragment with a comma, and a measured change always says where it started. Check the visible HTML too, not only the Markdown. Give each rule tests with words it must allow and words it must catch. A pattern for one banned word can block a correct word that starts the same way.
Example
// One of the writing checks: sentences of at most 25 words
const sentences = text.split(/(?<=[.!?])\s+/);
for (const s of sentences) {
const words = s.split(/\s+/).length;
if (words > 25) problems.push(`${words} words (max 25): "${s}"`);
}
# The same check in Python
for sentence in re.split(r"(?<=[.!?])\s+", text):
words = len(sentence.split())
if words > 25:
problems.append(f'{words} words (max 25): "{sentence}"')
How to check
Add a 30-word sentence or a semicolon to any page. The build stops and quotes the sentence.
For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers engineering playbook: https://agentwranglers.se/playbook/engineering/rules-as-code/enforce-the-writing-style-in-code.