AI-Assisted Technical Writing: Diagram Generation and Content Proofreading in Practice

    Technical sharing depends on two things: diagrams that help readers understand structure, and text that accurately describes workflows and code. This article explains where generative tools and large language models are useful for diagram generation and technical proofreading, where their limits are, and how to build practical human-in-the-loop workflows. It covers structured prompts for diagrams, a proofreading checklist, examples of correcting vague statements and workflow-code mismatches, a script for consistency checks, and review principles that keep authors accountable for the final content.

    1. Problem Background

    The quality of technical sharing usually depends on two factors: whether diagrams help readers understand the structure, and whether the text accurately describes the workflow and code. Many authors spend a large amount of time on both tasks. Manually drawing architecture diagrams and flowcharts is time-consuming, and every revision requires adjusting the layout again. After the text is drafted, authors often have to read through it themselves, which makes it difficult to spot unclear references, missing steps, or descriptions that no longer match the code.

    Generative tools and large language models can take over part of this work. However, their output is a draft, not a conclusion. To use them well, authors need to define the boundaries of each task and design corresponding review methods.

    2. Boundaries of the Two Task Types

    Diagram generation is suitable for concept illustrations, layered structure diagrams, data flow illustrations, and simple sequence sketches. The purpose of these diagrams is to create an intuitive impression; they are not responsible for conveying precise data.

    Diagram generation is not suitable for API field tables, performance metrics, precise parameter defaults, and similar content. If such content is wrong, readers may accept it directly. It should therefore be provided in text or tables and verified against the source code.

    Technical proofreading is suitable for identifying ambiguous sentences, unifying terminology, checking whether steps are complete and in the right order, and comparing workflow descriptions with code logic. Its judgments are based on the materials provided by the author, so the more complete the input, the more reliable the result.

    Technical proofreading cannot replace fact-checking. A model may misread the intent of code, or give a plausible but incorrect explanation for a framework it does not know well. All changes must be confirmed against the source code or official documentation.

    3. Diagram Workflow

    Diagram quality depends on whether the initial description is clear. The following four steps are recommended.

    Step 1: Define the audience and purpose. Is the diagram for beginners or experienced colleagues? Is it meant to show call relationships, data flow, or deployment locations? Different purposes require different levels of detail and labeling.

    Step 2: List the required elements. Write down component names, key data, and arrow meanings as a checklist. The more specific the checklist, the closer the generated result will be to expectations.

    Step 3: Write a structured prompt. The following is a general template; replace the content as needed:

    1. Diagram type: layered architecture diagram, horizontal layout, three layers from top to bottom
    2. Audience: beginners with backend experience
    3. Required elements:
    4. - Access layer: receives requests, labeled "HTTP requests"
    5. - Business layer: handles core logic, labeled "business rule validation"
    6. - Storage layer: labeled "relational database" and "cache"
    7. Arrows: solid lines for synchronous calls, dashed lines for asynchronous writes
    8. Style: flat, generous whitespace, neutral color palette
    9. Prohibited: any real brand logos, real domain names, or product screenshots

    Step 4: Manually review the generated result. Check each item: whether labels are spelled correctly, whether arrow directions match the text, whether the hierarchy matches the real architecture, and whether any brand elements or text that should not appear are present. If the generated result contains detail errors, the safest approach is to correct it manually with a drawing tool rather than repeatedly regenerating it.

    4. Technical Proofreading Workflow

    The proofreading input should include three parts: the text to be reviewed, the relevant code snippets, and the author’s own description of the workflow. Without code, the model can only judge whether the text is fluent; it cannot judge whether the text matches the implementation.

    The recommended checklist is as follows:

    1. Are references clear? What object do “it,” “the service,” or “the above method” refer to?
    2. Is terminology consistent? Does the same concept use the same name throughout the article?
    3. Are conditions and boundaries complete? Are trigger conditions, retry counts, timeout values, and similar parameters described?
    4. Is the step order correct? Does the sequence match the code execution order?
    5. Are exception branches covered? Is the behavior on failure described?
    6. Are numbers and units consistent? Are units such as seconds, milliseconds, and item counts used consistently?

    Case 1: Correcting a Vague Statement

    The original statement was: “The API automatically retries when it fails.” The problem is that it does not specify the retry condition, count, or interval. Readers cannot use this sentence to understand the system behavior.

    The corresponding code is as follows:

    1. import time
    2. def call_with_retry(func, max_retries=3, base_delay=0.5):
    3. """Call func and retry with exponential backoff only on timeout errors."""
    4. for attempt in range(max_retries + 1):
    5. try:
    6. return func()
    7. except TimeoutError:
    8. if attempt == max_retries:
    9. raise
    10. time.sleep(base_delay * (2 ** attempt))

    A corrected statement could be: “When a timeout error occurs, retry at most 3 times. The first wait is 0.5 seconds, and the wait time doubles after each attempt. Other error types are not retried and are raised directly.” The revised sentence includes the trigger condition, retry count, interval, and non-retry branch, corresponding item by item with the code.

    Case 2: Workflow Description Does Not Match the Code

    The original text said: “Write to the cache first, then write to the database.” However, the code actually executes in the opposite order. This type of error is common in technical sharing because authors often describe workflows from memory.

    The approach is to compare the code line by line, list the execution order as numbered steps, and then compare it with the article text. If the order itself has a design problem, explain that in the article rather than only changing the text to hide the difference.

    5. Using a Script for Consistency Checks

    For content with many configuration items, manual comparison can easily miss things. A simple script can automatically check whether configuration items mentioned in the documentation actually exist in the code. The following example assumes that the documentation marks configuration names with backticks and that the code reads configuration through environment variables:

    1. import re
    2. from pathlib import Path
    3. def extract_doc_keys(doc_path: str) -> set[str]:
    4. text = Path(doc_path).read_text(encoding="utf-8")
    5. return set(re.findall(r"`([A-Z][A-Z0-9_]+)`", text))
    6. def extract_code_keys(code_path: str) -> set[str]:
    7. text = Path(code_path).read_text(encoding="utf-8")
    8. return set(re.findall(r'os\.getenv\("([A-Z][A-Z0-9_]+)"', text))
    9. if __name__ == "__main__":
    10. doc_keys = extract_doc_keys("article.md")
    11. code_keys = extract_code_keys("config_loader.py")
    12. print("Config mentioned in docs but not read by code:", sorted(doc_keys - code_keys))
    13. print("Config read by code but not mentioned in docs:", sorted(code_keys - doc_keys))

    The script’s results can only indicate differences; they cannot determine which side is correct. When differences appear, a human must decide whether the documentation is outdated or the code is missing a configuration.

    6. Human Review and Responsibility Boundaries

    Whether the task is diagram generation or proofreading, the final responsibility lies with the author. Three principles are recommended.

    First, treat all model output as a draft. For facts, numbers, APIs, and commands, verify against the source code or official documentation.

    Second, keep a record of changes. Record the reason and basis for each change so that others can review it and so that the article can be traced when it is updated later.

    Third, control the source of materials. Avoid real trademarks, real domain names, and unauthorized interface screenshots in diagrams. Avoid performance data in text when its accuracy cannot be confirmed.

    7. Implementation Recommendations

    • Build a prompt template library for common diagram types, such as layered architecture, request sequences, and deployment topology, and update it as experience grows.
    • Make the proofreading checklist a required step before publishing each article.
    • For content that can be compared mechanically, such as configuration items and API names, write consistency-check scripts and run them automatically before submission.
    • Review diagrams and text separately. Diagrams build intuition; text and code ensure accuracy.
    • After each sharing session, record which steps saved time and which still required substantial manual revision, and adjust the division of work accordingly.

    With this workflow, authors can focus on judging whether the content is correct and whether the expression is clear, instead of spending time repeatedly drawing diagrams and reading through every word.