DEV Community

shashank ms
shashank ms

Posted on

Building Technical Writing Tools with LLM

We are going to build a CLI tool that takes a rough markdown draft and a plain-text style guide, then returns a revised version with clearer structure, consistent terminology, and tighter prose. It is useful for developer relations teams, documentation maintainers, or any engineer who ships a lot of READMEs and API docs. The whole thing runs against Oxlo.ai's flat per-request API, so long drafts and bulky style guides do not inflate the cost.

What you'll need

Step 1: Bootstrap the client

I start every project with the client setup. Create a file named tech_writer.py and point the OpenAI SDK at Oxlo.ai.

from openai import OpenAI

client = OpenAI(
    base_url="https://api.oxlo.ai/v1",
    api_key="YOUR_OXLO_API_KEY",
)

Step 2: Define the system prompt

The system prompt is where we encode the personality and constraints. We want the model to act as a technical editor that preserves code blocks, front matter, and tables, but reworks prose for clarity and voice.

SYSTEM_PROMPT = """You are a senior technical editor. Your job is to revise markdown drafts according to a provided style guide.

Rules:
- Preserve all code blocks, YAML front matter, tables, and CLI commands exactly.
- Rewrite body prose for clarity, active voice, and consistent terminology.
- Output only the revised markdown file. Do not add commentary outside the document.
- If the style guide specifies terminology, apply it strictly."""

Step 3: Write the revision function

This function accepts the draft and style guide, sends them to Llama 3.3 70B on Oxlo.ai, and returns the polished text. Because Oxlo.ai charges a flat rate per request, a long style guide plus a long draft still costs the same single request.

def revise_draft(draft: str, style_guide: str, model: str = "llama-3.3-70b") -> str:
    user_message = f"""Style Guide:
---
{style_guide}
---

Draft to revise:
---
{draft}
---"""

    response = client.chat.completions.create(
        model=model,
        messages=[
            {"role": "system", "content": SYSTEM_PROMPT},
            {"role": "user", "content": user_message},
        ],
        temperature=0.3,
    )
    return response.choices[0].message.content

Step 4: Add a CLI interface

Finally, I wire the function to argparse so we can invoke it against local files.

import argparse

def main():
    parser = argparse.ArgumentParser(
        description="Polish a markdown draft against a style guide."
    )
    parser.add_argument("--draft", required=True, help="Path to the markdown draft")
    parser.add_argument("--style", required=True, help="Path to the plain-text style guide")
    parser.add_argument("--model", default="llama-3.3-70b", help="Oxlo.ai model ID")
    args = parser.parse_args()

    with open(args.draft, "r", encoding="utf-8") as f:
        draft = f.read()

    with open(args.style, "r", encoding="utf-8") as f:
        style_guide = f.read()

    revised = revise_draft(draft, style_guide, model=args.model)
    print(revised)

if __name__ == "__main__":
    main()

Run it

Create two local files. style_guide.txt:

Use "initialize" not "boot up".
Use second person ("you") for instructions.
Avoid passive voice.
Keep sentences under 25 words.

draft.md:

# Getting Started

The server can be boot up by running the following command.

It is recommended that the environment variables are configured prior to execution.

Run the tool:

export OXLO_API_KEY="YOUR_OXLO_API_KEY"
python tech_writer.py --draft draft.md --style style_guide.txt

Example output:

# Getting Started

Initialize the server by running the following command.

Configure the environment variables before you run the command.

Wrap-up

You now have a working technical writing assistant backed by Oxlo.ai. Two natural next steps are to add a --diff flag that prints a line-by-line comparison before and after, or to switch the model to qwen-3-32b or kimi-k2.6 when you need multilingual or vision-capable review. For pricing details on the flat per-request model, see https://oxlo.ai/pricing.

Top comments (0)