Deep LLM Coding Agents in Practice: Disciplined Workflows and a Skill System

    Large language models excel at small coding tasks but often fail on large, multi-file engineering work due to requirement misunderstandings, missing verification, and context pollution. This article presents a proven methodology for LLM-driven coding tools built on three pillars: a disciplined five-stage workflow (Brainstorming → Spec → Plan → Execute → Review), rigid skills that force real verification before completion, and subagent dispatch to keep the main context clean. It also covers document preprocessing with Markdown conversion to improve retrieval accuracy, and distills four reusable principles for making LLM-assisted development reliable at engineering scale.

    Why LLM Coding Often Goes Wrong

    Many teams have already tried using large language models to assist with coding. On small tasks, the results are often impressive. But once the task scales up—such as an engineering-level migration or refactoring involving dozens of files and hundreds of changes—the failure rate rises sharply. The common problems fall into three categories:

    1. Requirement misunderstanding: The model starts modifying code immediately after receiving the task, guessing as it goes, and drifts off course.
    2. Missing verification: The model claims “the build passed” or “the tests passed” based purely on context inference, without ever actually running the build.
    3. Context pollution: Large amounts of implementation detail—logs and code snippets—flood the main conversation, causing the model to gradually “forget” earlier decisions, and the quality of later changes degrades noticeably.

    Solving these problems is not about switching to a stronger model. It is about giving the model a disciplined workflow. Drawing on a typical multi-file engineering practice, this article walks through a validated combination of methods.

    Environment and Overall Approach

    The practice described here uses an agentic terminal-based coding assistant paired with a mainstream large language model. In this setup, the model can read and write local files, execute terminal commands, and autonomously loop through tasks, while the developer issues goals in natural language.

    To make complex tasks executable and verifiable, three key mechanisms were introduced:

    • Structured workflow: Break “doing a task” into fixed stages.
    • Rigid verification skills: Force the model to run real checks at critical points.
    • Subagent dispatch: Delegate tasks to subagents with independent contexts.

    Let’s look at each in turn.

    The Disciplined Workflow: Align First, Then Act

    A workflow widely validated in the industry divides a task into five stages:

    1. Brainstorming → Spec → Plan → Execute → Review

    Each stage has a clear responsibility:

    1. Brainstorming (Requirement Clarification)

    Before writing any code, have the model restate its understanding of the task and list all ambiguities—for example, “What is the input format of this API?”, “How should error cases be handled?”, “Do we need backward compatibility?” This step costs almost nothing but catches most directional mistakes.

    2. Spec (Freezing the Specification)

    Write the clarified conclusions into a short specification document and commit it to the repository. The spec serves as the “contract” for all subsequent stages—whenever the model loses its way during execution, it can re-read this document to realign.

    3. Plan (Mapping the Implementation Path)

    Have the model lay out a concrete execution plan: which files to change, in what order, and how each step will be verified. The plan should be granular enough that every task is an independently verifiable unit.

    4. Execute

    Execute step by step according to the plan. The key here: verify immediately after each task is completed, rather than verifying everything at the end.

    5. Review

    After execution, have the model self-check against the spec item by item and produce a discrepancy report.

    The core value of this process is that it forces the model to align on requirements and the implementation path before touching code, instead of diving into files and making changes blindly.

    Rigid Skills: Turning “Claims It Passed” into “Actually Passed”

    The workflow defines the stages; skills define the behavioral constraints within each stage. Here are several universally effective skill designs:

    1. Test-Driven Development (TDD)

    Require the model to write tests first, then implementation. Beyond quality assurance, testing first gives the model a clear completion criterion—when all tests are green, the task is done. This removes subjective judgment.

    2. Systematic Debugging

    Forbid the model from “tweaking a version whenever it sees an error.” Proper debugging discipline is: reproduce the issue first, locate the root cause, form a hypothesis, minimally verify the hypothesis, then fix. This process applies equally to humans and models.

    3. Verification Before Completion

    This is the most valuable skill of all: before the model claims “build passed” or “tests passed,” it must actually run the build and test commands and paste the real output. A simple constraint template works well:

    1. ## Must run before declaring completion
    2. - [ ] Run the build command, paste the actual output
    3. - [ ] Run the test command, paste the actual output
    4. - [ ] If any step fails, do not declare completion

    In domains with long compile chains, such as firmware and embedded systems, this skill is essentially mandatory—concluding from memory often costs several rounds of rework.

    Subagent Dispatch: The Decisive Fix for Context Pollution

    When a task grows to dozens of files and hundreds of changes, even the best workflow cannot prevent the main conversation from being buried in implementation details. The solution is subagent dispatch:

    1. The main conversation retains only the spec, the plan, and the task assignment records.
    2. The tasks broken out of the plan are dispatched to subagents with independent contexts.
    3. When a subagent finishes, it returns only structured results to the main conversation (which files changed, verification results, remaining issues).

    The benefits are obvious:

    • The main conversation keeps a “strategic view”: It stays focused on the overall plan, unpolluted by single-file implementation details.
    • Subagents focus on “tactical execution”: Each subagent sees only the context its own task requires, keeping attention concentrated.
    • Failures are isolated: If a subtask fails, it can be re-dispatched independently without affecting other tasks.

    For migration projects involving hundreds of changes, this mechanism often determines whether the task can succeed at all.

    Document Preprocessing: An Underrated Key Step

    Another frequently overlooked practice is optimizing the format of your knowledge base. LLMs generally retrieve information from PDFs poorly—multi-column layouts, tables spanning pages, and register bit-field diagrams are often read in fragments. The same content converted to Markdown improves retrieval and comprehension accuracy by an order of magnitude.

    Recommended practices:

    1. Batch-convert the technical documents the project depends on (spec sheets, configuration guides, API documentation) to Markdown in advance.
    2. Organize them under refer/docs in the repository with clear file naming.
    3. For tabular content, prefer standard Markdown tables or CSV to preserve structured information.
    4. Spot-check the converted output manually, focusing on tables and diagrams.

    Mature open-source pipelines exist that handle technical documents with watermarks and complex tables through a three-step process: layout analysis → table structure restoration → image description generation. A few hours of preprocessing buys high-quality model comprehension across the entire project lifecycle—excellent return on investment.

    Summary and Recommendations

    The practices above distill into four reusable principles:

    Principle Key Point
    Align before acting Constrain the model with the Brainstorming → Spec → Plan → Execute → Review workflow
    Verify before declaring done Use rigid skills to force real build and test execution
    Subtract from the main context Use subagents to isolate implementation details and preserve the strategic view
    Add to the knowledge base Pre-convert key documents to Markdown to improve model comprehension

    The ceiling of LLM coding capability depends largely on the scaffolding we build around the model. Model capabilities keep improving, but disciplined workflows, rigid verification mechanisms, and clean context management are engineering methodologies that hold at any capability level. A practical way to start: begin with a small real-world task, gradually integrate these four principles into your development process, and then scale up to large engineering projects.