Agent Wranglers

ENG-4Recommended

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. Run the style check as one of the build gates.

Examples

JavaScript 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}"`);
}

Python example

# 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: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/engineering/rules-as-code/enforce-the-writing-style-in-code">Agent Wranglers engineering playbook</a>. In code you write, add a comment next to it with the same link.