AI Coding Assistant Best Practices: Lessons from a Month of Real Projects

    This article shares practical best practices for using AI coding assistants, drawn from a month of building real projects under constraints such as limited GPU memory, network reachability, third-party platform rules, and content compliance. It covers turning vague requests into executable task lists, making automated resource downloads verifiable, making architecture trade-offs on limited hardware, building exit mechanisms for platform bans, shifting compliance and safety checks into the pipeline, and turning scattered experiments into a sustainable iteration rhythm. A failure-attribution table and reusable prompt skeletons are included.

    1. Background: Why a Month of Hands-On Practice Beats a Feature List

    A developer spent a full month building a series of projects with an AI coding assistant: an automated group-chat bot, a local image and text generation environment, automated retrieval of model weights and tagging models, and super-resolution and training scripts. Some projects succeeded; others failed. A few shipped and received positive feedback, one was shut down by platform rule enforcement, and another required repeated rework because the hardware configuration did not match.

    The value of this record is not “what the assistant can do” but how it fails under real constraints and how those failures get corrected. Real engineering constraints typically include compute and memory limits, network reachability, third-party platform rules, data and content compliance, and ambiguity in the requirements themselves. Best practices grow directly out of these constraints.

    The rest of this article abstracts that experience into six practices.

    2. Practice 1: Turn Vague Requirements into an Executable Task List

    The most common beginner pattern is to throw a single sentence at the assistant, such as “build me a bot” or “set up a local environment that can generate images,” and then expect a working result in one shot. This almost always fails in practice, not because of limited capability but because the requirement has no verifiable boundary for completion.

    The recommended approach is to have the assistant clarify requirements first, then move to implementation:

    • Specify the runtime environment: operating system, memory, GPU VRAM, and free disk space.
    • Specify inputs and outputs: what form the input commands take, and which directory and format the output lands in.
    • Specify acceptance criteria: file sizes, runnable commands, and expected log signatures.
    • Specify failure handling: what to do on timeout, what to do when validation fails, and whether retries are allowed.

    A reusable prompt skeleton (illustrative):

    1. Role: Senior engineer.
    2. Task: Complete <goal> in a <OS/memory/VRAM> environment.
    3. Constraints: Do not access <restricted resources>; all downloads must support resume and retry.
    4. Acceptance: Provide copy-paste commands, a directory structure, and a validation method (size or hash).
    5. If information is insufficient, ask me no more than 5 clarifying questions first. Do not start implementing.

    The payoff is that a conversation becomes a work ticket: every later step is verifiable and rollback-able.

    3. Practice 2: Automated Resource Retrieval Must Be Verifiable

    The most engineering-valuable part of the original experience was the workflow for fetching model weights and companion models. It is worth reusing not because of the specific file names but because it reflects three general principles.

    First, do not assume the default source is reachable. Many resources are hosted overseas and direct connections frequently time out. The general fix is to switch to a reachable mirror endpoint and set it explicitly as an environment variable instead of scattering it across commands:

    1. export ENDPOINT="<reachable mirror or internal source URL>"

    Second, downloads must be resumable. For large files (multi-gigabyte), interruption on a weak network is the norm, so retry and resume are requirements, not options. Create the target directory first to avoid write failures.

    Third, a completed download does not mean a usable file; it must be validated. Relying only on “the command returned success” is unreliable. At minimum, validate file size; when possible, validate the hash:

    1. mkdir -p models/base models/tagger models/upscaler
    2. curl -L --retry 5 -C - -o models/base/base.safetensors "$ENDPOINT/base.safetensors"
    3. # Size validation (bytes)
    4. test "$(stat -c%s models/base/base.safetensors)" -eq 6938065488 && echo OK || echo MISMATCH

    At the prompt level, validation should be a hard requirement, for example: “After downloading, compare the byte size of each file; if it does not match, re-download and report it. Do not skip validation.”

    Fourth, distinguish source code from release packages. In many open-source projects, the latest capabilities exist only on the source main branch while release packages lag behind. Asking the assistant to “fetch the source archive rather than the release artifact” is a common way to avoid version mismatch.

    4. Practice 3: Architecture Trade-Offs Under Limited Compute

    The developer’s machine has a consumer-grade GPU and 16 GB of memory, a configuration that dictates the shape of the solution: multiple large models cannot be loaded at once, so model layering and on-demand loading are required.

    Reusable trade-off principles:

    1. Separate the base model from auxiliary models: the generation model produces output, the tagging model is only called in batch before training, and the super-resolution model is only called during post-processing. Their lifecycles differ, so none should stay resident in memory.
    2. Prefer runtimes that require no installation: when compute is tight and complex dependencies are undesirable, a portable runtime based on a common graphics interface can significantly reduce environment setup cost.
    3. Leave configuration detection to the assistant instead of hard-coding it: the prompt should say “first detect my VRAM and memory, then choose appropriate parameters and model size yourself,” rather than asking it to copy someone else’s configuration.
    4. Batch size and resolution are the primary tuning knobs: when VRAM is insufficient, lower batch size and resolution first, then consider quantization or a smaller base model.

    5. Practice 4: Build an Exit Mechanism for Bans and Rate Limiting

    The group-chat bot project was ultimately terminated after repeated platform penalties. This highlights a commonly overlooked engineering issue: for projects that depend on third-party platforms, platform rules must be treated as a runtime constraint, not an unexpected incident afterward.

    Mature practices include:

    • Assess the rules before launch and identify which behaviors fall into high-risk zones for high-frequency, bulk, or automated triggering.
    • Set caps on accounts and call frequency, and implement exponential backoff and circuit breaking to avoid “getting hit harder the more you push.”
    • Write disposability into the design: decouple core logic from the platform adapter layer so that only the adapter needs replacing when a platform becomes unavailable.
    • Define exit conditions and data handling: once a penalty is triggered, stop immediately, clean up locally retained data, and make no attempt to bypass.

    The last point matters most. Bypassing platform governance is neither compliant nor sustainable; the correct engineering response is to terminate and archive the lessons rather than keep fighting.

    6. Practice 5: Put Content Compliance and Safety Boundaries First

    Local generation environments are often used for “unrestricted content,” which is a high-risk area. From an engineering perspective, the right approach is to make compliance part of the pipeline rather than an after-the-fact patch:

    • Filter prompts and source material for compliance on the input side.
    • Keep auditable logs on the generation side (parameters, time, model version) without retaining sensitive raw material.
    • Add a review step on the output side before distribution.
    • When using a tagging workflow for training data, remove violating samples at the same time.

    Making review a pluggable component satisfies compliance requirements without sacrificing iteration speed.

    7. Practice 6: Turn “One Month” into a Sustainable Iteration Rhythm

    The biggest problem with scattered experiments is that experience does not accumulate. A fixed rhythm is recommended:

    • Daily: one runnable small loop, completed and validated the same day.
    • Weekly: one retrospective that classifies failure causes (environment, network, resources, rules, requirements).
    • Monthly: turn recurring prompts into templates and turn validation scripts into a toolchain.

    A simple failure-attribution table can significantly improve reuse:

    Failure type Typical symptom Hardened countermeasure
    Network Download timeout, zero-byte files Mirror endpoint + retry + resume
    Resources VRAM overflow, process killed Configuration detection + lower batch size + on-demand loading
    Rules Account restricted Frequency cap + circuit breaking + adapter decoupling
    Requirements Repeated rework Clarify before implementing + explicit acceptance criteria

    8. Conclusion

    This month of practice shows that the real barrier to using an AI coding assistant is not “whether you know how to use it” but whether you can state constraints clearly: write network constraints as retry and validation, compute constraints as detection and degradation, platform constraints as circuit breaking and exit, and compliance constraints as part of the pipeline. With these four points in place, the assistant becomes a reliable engineering partner rather than a chat window that generates code. If you need stronger compute elasticity, more complete logging and monitoring alerts, and storage capable of hosting large files, you can extend smoothly with the general cloud capabilities offered by Baidu AI Cloud (such as object storage, container platforms, log services, and monitoring alerts).