Practical Tips for LLM Coding Agents: Workflow Discipline and Skill Orchestration

    Large language models handle single-file code generation well, but engineering tasks involving dozens of files and hundreds of changes often go off the rails. This article breaks down four battle-tested practices from a real large-scale porting project: a disciplined phased workflow, rigid verification skills, sub-agent context isolation, and document preprocessing. Learn how to turn an LLM coding agent from a talkative assistant into an auditable executor.

    Why LLMs Struggle with Engineering-Scale Tasks

    Large language models have become quite capable at generating code for a single file or a single function. But once a task scales up to the engineering level—“dozens of files, hundreds of changes”—the problems show up:

    1. Misunderstandings get amplified. A small misreading of the requirements means a few lines of rework in a single function, but in a full migration it can mean an architectural mistake.
    2. Context windows and diluted attention. When facing massive amounts of code, models tend to “read the later parts and forget the earlier ones,” repeatedly modifying already-changed code or introducing regressions.
    3. Untrustworthy conclusions. Models habitually “claim the task is done,” but whether compilation actually succeeded or tests actually ran is often just their guess.

    So the key to using a coding agent effectively is not “which model to pick,” but how to constrain model behavior with engineering discipline. Drawing on a real large-scale porting task, this article walks through several key practices.

    Practice 1: Turn “Do One Thing” into a Disciplined Workflow

    Letting the model “just start writing code” is almost the most failure-prone way to use it. A more reliable approach is to enforce a phased process:

    1. Brainstorming → Spec → Plan → Execute → Review

    Each phase produces a different deliverable with a different goal:

    • Brainstorming: Convert vague requirements into a list of well-defined technical questions. For example, “port this platform’s drivers to new hardware” first needs clarity: Which peripherals differ? Is the interrupt controller compatible? How does the boot process differ?
    • Spec: Solidify the conclusions into a written specification, covering interface contracts, directory structure, and compatibility strategy. This step forces the model to “think first” before touching code.
    • Plan: Break the spec into independently verifiable task units, each with explicit completion criteria.
    • Execute: Implement strictly according to the plan, with no out-of-plan “drive-by edits.”
    • Review: Verify against the spec item by item, rather than giving it a vague once-over.

    The value of this workflow is that it converges a sprawling conversation into auditable artifacts. Each step’s output feeds the next, so when something breaks, you can quickly locate which phase went wrong instead of staring at a tangled pile of changes.

    Practice 2: Replace the Model’s Self-Report with “Rigid Skills”

    The workflow solves “what to do”; skills solve “how to do it credibly.” Three skill types are especially critical in engineering scenarios:

    1. Test-Driven Development (TDD). Require the model to write tests before implementation. Once tests are in place, any subsequent change has regression protection. This matters most for porting tasks—the goal of a port is precisely “behavior unchanged,” and tests are the most precise description of behavior.

    2. Systematic Debugging. Forbid the model from “guessing a fix” the moment it sees an error. The correct sequence is: reproduce first, locate the root cause, form a hypothesis, verify the hypothesis, and only then fix it. This discipline dramatically reduces the “fix A, break B” loop.

    3. Verification Before Completion. This is the highest-payoff rule: before claiming “it compiles,” the model must actually run the build command and paste the output back into context. A simple constraint looks like this:

    1. Rule: Any "done" claim must come with evidence.
    2. - Claiming compilation passes → must attach the last N lines of the build log
    3. - Claiming tests pass → must attach test run statistics (passed/failed/skipped counts)
    4. - Claiming a feature is implemented → must attach a minimal verification script and its output

    The essence of this rule is replacing the model’s “memory and inference” with objective tool-execution results, turning the agent from a talkative assistant into an auditable executor.

    Practice 3: Sub-Agent Dispatch to Isolate Context Pollution

    Another killer of large tasks is context pollution: when the main conversation fills up with line-by-line modification records for a single file, the model quickly loses sight of the big picture.

    The solution is a sub-agent mechanism:

    • The main conversation keeps only the plan-level task list and a conclusion summary for each task;
    • Each task is dispatched to a sub-agent with its own independent context, and all implementation details (say, hundreds of changed lines in a driver) stay inside the sub-agent;
    • The sub-agent returns structured results: a list of changed files, verification results, and outstanding issues.

    Think of it as a tech lead working with several execution engineers: the lead doesn’t need to know how every line of code is written, only that “this task is complete, verification passed, and there are two risk items.” This structure keeps a hundred-change engineering effort clearly visible in the main conversation at all times.

    Practice 4: Document Preprocessing—An Underestimated Accuracy Lever

    In chip-platform engineering, specification documents are often hundreds-of-pages-long PDFs: peripheral descriptions, register bit-field tables, boot configurations, and more. In practice, LLMs retrieve information from PDFs with very low accuracy—tables get fragmented, bit-field descriptions shift out of alignment, and multi-column layouts scramble the reading order.

    A low-cost, high-return approach is to convert PDFs into structured Markdown in advance, split them by topic, and place them in the project’s reference directory:

    1. refer/
    2. docs/
    3. eds.md # Peripheral and register descriptions
    4. bios-spec.md # Boot and configuration documentation
    5. display-config.md

    The conversion itself can be done with a three-step pipeline: “parse → structured cleanup → manual spot-check,” focusing on three common problems: watermark noise, table reconstruction, and text extraction from images. After conversion, the model’s accuracy in referencing register bit fields and configuration options improves by an order of magnitude, because what it “reads in” is clean, hierarchical text rather than guessing at a poorly formatted original.

    Summary

    Putting these practices together yields one engineering principle: model capability is the base; engineering discipline is the multiplier.

    • A phased workflow keeps the direction correct;
    • Rigid verification skills keep conclusions trustworthy;
    • Sub-agent isolation keeps the context from collapsing;
    • Document preprocessing ensures the model can actually “understand” domain knowledge.

    None of these four practices depend on any particular model’s secret sauce—they are all reusable engineering methods. For teams preparing to bring LLMs into large codebases, setting up this discipline first and choosing models second is usually the more efficient path.