AI-Assisted Coding: A Practical Guide to Working Faster with LLMs

    This guide explains why AI coding tools often feel fast but deliver slow results, and how to fix the workflow. It covers writing executable requirement documents, feeding models the right context, using specific constraints to reduce rework, orchestrating build and deployment tasks, shifting verification earlier, and avoiding common anti-patterns. The goal is a repeatable process that turns AI from a code completion helper into an engineering executor.

    1. Why AI Coding Looks Fast but Feels Slow

    AI coding tools are now part of most developers’ daily workflow. Many teams have the same early experience: generating a block of code takes seconds, but making that code actually run, integrate, and stay maintainable takes repeated clarification and manual fixes. The total time often does not drop much.

    The root cause is usually not model capability. It is input quality and how clearly the goal is defined. The gains from AI-assisted coding do not come from typing less. They come from three things: turning vague requirements into executable constraints, handing repetitive work to automation, and moving verification earlier. Using AI effectively means building a stable collaboration process, not constantly switching tools.

    2. Write Requirements as an Executable Document, Not a Casual Sentence

    The most effective practice is to capture task requirements in a standalone document (for example, feature-requirements.md) and keep it under version control alongside the source code. This document is not a comment for humans. It is context input for the model.

    A usable requirements document usually contains four layers of information:

    • Hardware and runtime environment: development platform, peripheral model, connection method, bus type, device address;
    • Data sources: where reference materials such as datasheets are stored, and which sections matter most (for example, interface timing and address details);
    • Functional goals: program form (console program, service process, library), sampling period, output format;
    • Engineering constraints: source file name, output artifact name, toolchain path, compiler flags, deployment target, and permission requirements.

    The value of a requirements document is that it is reusable and diffable. When requirements change, you only edit the document and resubmit it to the model. You avoid re-explaining the background in every conversation, and other team members can understand the basis for the generated result.

    3. Context Feeding: Make the Model Read, Not Guess

    A model’s knowledge of a specific device is unreliable, especially details like addresses, register layout, and timing requirements. If these are generated by guessing, the code may look reasonable but will not work. The right approach is to provide key materials as files and explicitly point out what to focus on.

    For example, when working with a light sensor, the requirement should state: the sensor is attached to a specified interface over the I2C bus, the device address is a fixed value, the datasheet is stored in the repository as a PDF, and the model should first read the sections on the I2C interface and address before writing the read logic. This turns a “memory problem” into a “retrieval problem” and significantly improves the hit rate.

    Organize context from coarse to fine: first the goal and acceptance criteria, then environment and interface constraints, and finally code style and output format requirements. Avoid dumping unrelated content all at once. Redundant information dilutes the weight of key constraints.

    4. The More Specific the Constraints, the Less Rework

    Vague instructions produce vague code. Rewriting “read the sensor” into a verifiable description is the turning point for efficiency. Example:

    1. Implement a Linux console program:
    2. 1. Periodically read the light sensor and print both the raw I2C data and the converted lux value;
    3. 2. Fixed output format: "Light: %d lux";
    4. 3. Print a level hint based on ranges, for example normal office lighting is about 300~500 lux,
    5. strong indoor light is about 1000~3000 lux, overcast outdoor is about 500~1000 lux,
    6. and shade on a sunny day outdoors is about 10000~20000 lux;
    7. 4. Sampling period of 1 second; on a read error, print the error and keep running, do not exit.

    Items like “fixed output format”, “do not exit”, and “1 second period” are assertions that can be checked automatically. When requirements contain assertions, verification can be scripted instead of relying on manual line-by-line review.

    5. Let AI Handle Build and Deployment Too: Task Orchestration Is Key

    Many developers only let the model write business code and then compile and flash manually, wasting the biggest efficiency gain. A more mature approach is to have the model also generate the project task configuration, closing the loop of generate, build, deploy, and run.

    For the build step, you can ask for editor task configuration with the absolute toolchain path, source file and artifact name, and compiler flags, naming the task Build:

    1. {
    2. "label": "Build",
    3. "type": "shell",
    4. "command": "${workspaceFolder}/toolchain/bin/arm-linux-gnueabihf-gcc",
    5. "args": ["-o", "test_sensor", "test_sensor.c"]
    6. }

    For deployment, use SSH to copy the artifact to the target device and fix permissions, naming the task Deploy via SSH, and explicitly declare that it does not depend on the build task so it can be retried on its own:

    1. {
    2. "label": "Deploy via SSH",
    3. "type": "shell",
    4. "command": "scp test_sensor root@192.168.1.123:/root/ && ssh root@192.168.1.123 'chmod 777 /root/test_sensor'"
    5. }

    There are two common pitfalls here. First, escaping and nested quotes in JSON are easy to get wrong when mixing shell commands, so ask the model to output complete, parseable JSON rather than fragments. Second, task dependencies: if deployment should not be blocked by the build, you must state the dependency explicitly, otherwise debugging is unnecessarily slowed down.

    6. Shift Verification Earlier: Have AI Produce a Decidable Way to Accept Results

    The reliability of AI-generated code depends on how cheap verification is. During the requirements phase, ask the model to also produce verification methods: unit tests, boundary cases, log assertions, or a simple self-check script. For hardware-related programs, ask it to print raw register values so they can be compared against expected values in the datasheet. For pure logic code, ask it to cover empty input, extreme values, and exception branches.

    A practical habit is “small-step commits”: each time, have the model complete only one independently verifiable goal, and move to the next step only after verification passes. In contrast, generating an entire framework at once makes the cost of locating errors grow exponentially once something goes wrong.

    7. Common Anti-Patterns and How to Avoid Them

    • Describing only symptoms without constraints: the model can only guess, and the output will be generic. The fix is to add assertions for format, period, and exception handling.
    • Not providing reference materials: for specific devices, always provide the datasheet and point out the sections to focus on.
    • Ignoring engineering configuration: build, deployment, permissions, and dependencies should be written into the requirements and generated by the model.
    • Skipping code review: AI output still needs human review of boundary conditions, resource release, and error paths.
    • Not storing requirements in the repository: verbal requirements cannot be reused and make team collaboration hard, so document them and put them under version control.

    8. A Practical Workflow Summary

    Stringing these points together forms a stable process: write and commit the requirements document, attach key context such as datasheets, submit prompts in layers (goal, environment, format, engineering constraints), generate build and deployment tasks, compile automatically and push to the target device, verify output against assertions, and iterate in small steps.

    Once this process runs smoothly, the role of AI upgrades from “code completion” to “engineering executor”. The efficiency gain shows up as less rework and more process automation, not just faster generation. For teams that want to adopt AI-assisted coding in real projects, the highest marginal returns are usually in three areas: toolchain integration, task orchestration, and verification scripts. Combined with a unified cloud development environment and baseline capabilities like logging and monitoring, you can further reduce the extra cost caused by environment differences.