Using Large Language Models for Coding: Three Advanced Practices and Implementation Methods
This article presents three reusable ways to use LLM coding assistants in real software development: building a global understanding of complex projects, breaking down tasks through staged collaboration with clear acceptance criteria, and applying models to code review, test design, and issue diagnosis. It also covers context management and governance practices for teams.
Introduction: From “Writing Code” to “Completing Tasks”
In recent years, the role of large language models in software development has been changing. Early AI coding tools mainly handled code completion, syntax hints, and simple function generation. Today, LLM-based coding assistants can take part in the full development cycle, including requirements analysis, code reading, solution design, test writing, issue localization, and documentation.
However, a larger model does not guarantee reliable results when you simply ask it to “build a system.” What determines the outcome is usually how the task is broken down, how context is organized, how results are verified, and where the boundary between human and AI work lies.
Think of a coding assistant as an experienced developer who does not yet know your project. The user’s job is not simply to issue commands. It is to provide a clear goal, necessary constraints, verifiable acceptance criteria, and a scope of work that the model can handle well.
The following sections describe three practical methods, drawn from real development workflows, that are broadly reusable.
1. Using LLMs to Quickly Build a Global Understanding of Complex Projects
1.1 Why understanding code matters more than generating it
In real projects, developers spend much of their time not writing new code but understanding existing code:
- Where a request enters the system;
- Which modules process the data, and in what order;
- What a configuration item ultimately affects;
- Why a given error occurs only in specific scenarios;
- Which business processes are affected when a shared method changes;
- Why a piece of legacy code cannot simply be refactored.
Without a full picture, asking a model to generate code often produces changes that are locally correct but break the system as a whole. The first high-value use is therefore not to start building features immediately, but to have the model help create a “project map.”
1.2 Recommended analysis workflow
Provide information to the model in this order.
Step 1: Describe the project type and current goal. For example, is it an API service, a data processing system, an admin console, or a user-facing client application?
Step 2: Provide the directory structure and key files. You do not need to submit the entire codebase at once. Prioritize entry points, core business modules, configuration files, the data access layer, and test directories.
Step 3: Ask the model to output module relationships rather than modify code. You can ask it to answer:
- What are the main startup entry points of the system?
- What is the processing path of core requests or tasks?
- What responsibility does each module have?
- Which modules are clearly coupled?
- What risk points may exist in the current code?
- If a new feature is added, where is the best place to start?
Step 4: Verify the model’s analysis against the code. After the model gives its conclusions, developers should check key call relationships in the actual code. Do not treat the model’s inferences as facts.
1.3 A general prompt template
You can use a prompt like this:
Please do not modify any code yet. Based on the directory structure and key files I provide, outline the system’s startup process, core data flow, module responsibilities, and dependencies. Clearly separate “facts that can be confirmed from the code” from “inferences based on context,” and finally list the questions that require further verification.
This prompt has three advantages. It keeps the model from jumping into coding too early. It requires the model to separate facts from inference. And it helps developers identify key parts of the system they have not yet understood.
1.4 Applicable scenarios
This method works especially well for:
- Taking over a legacy project;
- Reading code written by an unfamiliar team;
- Investigating problems that span multiple modules;
- Impact analysis before refactoring;
- Writing technical documentation and system design notes;
- Helping new team members get up to speed on a project.
Project analysis is not a security audit, and it is not an architecture review. The model can help surface leads. For permissions, data consistency, concurrency control, and handling of sensitive information, qualified professionals still need to confirm the findings.
2. Having the Model Handle Task Decomposition and Multi-Turn Collaboration
2.1 Moving from one-shot generation to staged progress
Complex requirements usually have several layers. For example, a user management feature may involve data structures, API logic, permission checks, error handling, logging, test cases, and documentation updates at once.
If all requirements are compressed into one sentence, the model may miss implicit conditions. A more reliable approach is staged collaboration:
- Stage 1: Clarify requirements and boundaries;
- Stage 2: Design the implementation approach;
- Stage 3: Confirm the scope of file changes;
- Stage 4: Generate the core code;
- Stage 5: Add error handling and tests;
- Stage 6: Perform code review;
- Stage 7: Write the change summary.
Each stage should have a clear deliverable. The model should not make large-scale changes across the project without an agreed plan.
2.2 Let the model ask questions before it executes
When requirements are incomplete, a good coding assistant should raise clarifying questions instead of immediately producing code. Examples include:
- Are empty inputs allowed?
- How should duplicate submissions be handled?
- Should the operation roll back if it fails?
- Do different roles have different permissions?
- Must the API be idempotent?
- Should error messages target users or logs?
- Does legacy data need to remain compatible?
You can state this explicitly:
Before implementation, list all key questions that affect the solution, and sort them into “must confirm” and “can use a default value.”
This reduces rework and helps requesters notice implicit conditions in their original description.
2.3 Use acceptance criteria to constrain output
Requirements should include verifiable acceptance conditions. For example:
- Valid input completes the expected operation;
- Missing required fields return a clear error;
- Repeated requests do not create duplicate data;
- Unauthorized users cannot perform sensitive operations;
- Key exceptions record the necessary context;
- Core logic has basic test coverage;
- The change does not alter the behavior of existing interfaces.
The clearer the criteria, the easier it is to evaluate the model’s output. For enterprise projects, this matters more than raw code generation speed.
2.4 Have the model produce a change plan
Before making changes, ask the model for a change plan:
Goal:Problem to solve:Files to modify:1. File A: add input validation2. File B: add business logic3. File C: add exception branches4. File D: add new testsPotential impact:- May affect existing callers- Needs compatibility with old data- Needs permission checks addedVerification:- Unit tests- API tests- Exception scenario tests- Regression tests
After the developer approves the plan, the model can implement it step by step. This turns an uncontrolled, large-scale change into a series of small, reviewable changes.
3. Using LLMs for Code Review, Test Generation, and Issue Diagnosis
3.1 Verify generated code
Generated code can have the following problems:
- Calls to methods that do not exist;
- Ignored null values, boundary values, or exception branches;
- Misunderstood existing business rules;
- Unnecessary complexity;
- Broken compatibility with existing interfaces;
- Insufficient handling of permissions and sensitive data;
- Race conditions in high-concurrency scenarios.
Generated code is therefore an intermediate step in development, not a finished result. A better approach is to have the model act as a reviewer that independently checks what it just produced.
3.2 Have the model review from multiple angles
Ask the model to analyze code from each of these perspectives.
Functional correctness
Check whether the code meets the requirements, whether the normal and exception paths are complete, and whether the return values match the agreed contract.
Maintainability
Check naming, module boundaries, duplicated logic, separation of responsibilities, and the cost of future extension.
Security
Check input validation, permission checks, output of sensitive information, file access, injection risks, and error messages that leak information.
Performance
Check for unnecessary repeated computation, expensive operations inside loops, batch processing methods, and potential resource leaks.
Compatibility
Check whether interface fields, data formats, configuration items, and legacy behav
