Building an LLM-Powered Auto-Writing System: An Engineering Approach

    This article explains how to turn content production into an engineering pipeline powered by large language models. It covers a four-layer architecture (collection, analysis, decision, generation and validation), parallel hot-topic scanning with deduplication, data-driven topic preferences, three-layer topic filtering, reusable skill packages and shortcut commands, automated pre-publish validation, and cost control. The goal is stable, repeatable output instead of inspiration-driven writing.

    1. Why Content Production Needs Engineering

    The real problem for most content teams is not the inability to write, but the inability to write consistently. Inspiration-driven writing has three inherent weaknesses: random topic selection, fluctuating quality, and non-reusable processes. Once writing is treated as an engineering project, the problem splits into three measurable sub-problems: how to continuously obtain candidate topics, how to decide whether a topic is worth writing, and how to ensure the final draft follows a consistent standard.

    The value of engineering is converting “inspiration” into “data + rules + validation.” Data supplies input, rules narrow the scope, and validation guards the baseline. Missing any one of the three turns the system into a random text generator.

    2. Overall Architecture: A Four-Layer Pipeline

    Split the system into four layers, decoupled through standard data structures:

    1. Collection layer: fetch trending information from multiple sources in parallel, then deduplicate and normalize it.
    2. Analysis layer: produce structured statistics on historical content, outputting topic preferences and patterns.
    3. Decision layer: three-stage filtering (hard exclusion, relevance scoring, value ranking).
    4. Generation and validation layer: generate a first draft from templates, then automatically run format, sensitive-word, and quality checks.

    A sample data structure can be very simple:

    1. {
    2. "topic": "Sample topic",
    3. "source": "feed_17",
    4. "score": 0.82,
    5. "tags": ["engineering practice", "efficiency"],
    6. "status": "passed"
    7. }

    3. Trend Scanning: Parallel Collection and Deduplication

    The core of trend scanning is “breadth first, cost under control.” The common approach is to maintain a list of channels or sources, pull them with concurrent tasks, and clean the results in one pass. Three engineering concerns matter: rate limiting and retries, so target sites do not reject requests; content-fingerprint deduplication, so the same event does not repeatedly enter the candidate pool; and a time window that keeps only content from the last N hours.

    Collection results should first land in general-purpose object storage or a message queue, then be consumed asynchronously downstream. This way, collection jitter does not affect generation stability.

    4. Finding Patterns in Data: From Samples to Topic Preferences

    Data analysis does not require complex models. First tag historical articles: topic, structure, length, publish time, and engagement performance. Then measure which tag combinations perform better. The output should be a “topic preference table” that the decision layer can consume directly.

    The point of this step is turning subjective judgment into explainable rules, for example “a certain type of topic performs more consistently at a fixed time slot,” so later filtering has a basis.

    5. Three-Layer Topic Filtering: Blocking Noise Before Generation

    The first layer is hard rules that exclude non-compliant, low-quality, and duplicate topics. The second layer is relevance scoring, using vector similarity or keyword weights to measure fit with the account’s positioning. The third layer is value ranking, combining timeliness and expected return to take the top N. The three layers have a single goal: let the generation layer handle only inputs that are “very likely worth writing,” which significantly reduces cost.

    6. Skill Packages and Shortcut Commands: Turning Standards into Callable Capabilities

    In AI coding tools, writing style, structural templates, and banned expressions can be packaged as a “skill package,” while scanning, writing, and analysis can be packaged as shortcut commands. Users then only trigger a command and the model executes the established standard. Example:

    1. /scan # Trigger trend scanning and three-layer filtering
    2. /write # Generate a first draft from topics that passed filtering
    3. /analyze # Output topic preferences and quality statistics

    The key is to accumulate prompts as assets rather than writing them by hand every time.

    7. External Tool Integration and Automated Validation

    Collection, storage, and querying are integrated through a standard external tool protocol. Before publishing, automated hooks run validation: format checks, sensitive-word filtering, link and image availability checks, and title length checks. If validation fails, the draft goes back for rewriting, forming a closed loop.

    8. Cost Control and Stability

    Cost comes from three parts: collection bandwidth, model calls, and storage. Control measures include filtering with rules before calling the model, processing long articles in segments, caching repeated requests, and moving non-real-time tasks to off-peak periods. If cloud resources are used, container platforms, log services, and monitoring alerts can add elasticity and observability.

    9. Iteration Path and Implementation Advice

    Do not build everything at once. The recommended order is: data analysis first, then topic filtering, then trend scanning, and finally automatic generation and validation. Validate each step with a small sample, then scale up once it is stable. As long as the pipeline is properly decoupled, swapping models or adding sources will not affect the overall structure, which gives this approach the ability to evolve over the long term.