10 Efficient Practices for LLM-Assisted Programming

    This article explores the transition from prompt engineering to goal engineering when collaborating with large language models (LLMs). It emphasizes defining clear acceptance criteria rather than imposing strict process constraints. By introducing 10 efficient practices—ranging from structured graphics generation to test-first development and repository-level context feeding—teams can transform occasional impressive AI outputs into repeatable engineering productivity.

    1. The Real Problem: From “Prompt Tricks” to “Goal Engineering”

    The reason a recent concentrated test of new model capabilities sparked discussion is not because of some mystical incantation, but because it exposed a long-ignored fact: most people fail in collaborating with LLMs not because the model lacks capability, but because of misaligned requirement descriptions. They spend massive energy dictating “how to do it” while rarely taking the time to define “what constitutes done.”

    The traditional outsourcing-style communication habit is to provide exhaustive process constraints: what structure to use, how many steps, which function to write first, how to name variables. This habit might work with human colleagues, but when facing models equipped with long-chain reasoning and tool-calling capabilities, it actually compresses their search space, locking the optimal solution into a suboptimal path. Therefore, what truly needs an upgrade is the way requirements are expressed—moving from “prompt engineering” to “goal engineering.”

    2. Core Principle: Strict on Destinations, Lenient on Routes

    This principle can be broken down into two orthogonal dimensions.

    Strict on destinations means acceptance criteria must be unambiguous and automatically verifiable: inputs and outputs, boundary conditions, performance metrics, compatibility scope, and failure behaviors must all be clearly defined. Lenient on routes means not dictating internal implementation: allowing the model to choose its own data structures, split modules, and decide dependencies and call sequences.

    Compare the difference between two descriptions:

    • Inefficient description: First create a class, put three methods in the class, the first method does parameter validation using a specific library, then…
    • Efficient description: Implement a batch file validation tool. The input is a directory path and a set of rules, and the output is a structured report; empty directories, no permissions, and symbolic links must each return a clear status; when a single file exceeds 100MB, skip it and mark it in the report. The implementation method is unrestricted.

    The latter contains less information but has stronger constraints because it constrains the result, not the steps. In engineering terms, this can be implemented as an acceptance checklist:

    1. acceptance:
    2. - id: empty_dir
    3. input: "/tmp/empty"
    4. expect: status=ok, report.total=0
    5. - id: no_permission
    6. input: "/root/secret"
    7. expect: status=skipped, reason=permission_denied
    8. - id: large_file
    9. input: "big.bin(120MB)"
    10. expect: status=skipped, reason=size_exceeded

    3. 10 Efficient Practices

    1. Use Structured Graphics Generation as a Reasoning Stress Test

    Asking the model to output a piece of self-contained vector graphics code (e.g., drawing a pelican riding a bicycle) is a capability probe with extremely low cost and extremely clear verification. Graphics tasks simultaneously test three things: spatial geometric reasoning, coordinate and layer organization, and self-consistency in long outputs—an extra coordinate or a wrong closing tag will immediately expose errors in the rendered result. It is harder to get away with memorized answers than “writing a sorting algorithm.” It is recommended to include such tasks in internal evaluation sets as regression items during version upgrades.

    2. Generate a Runnable Minimal Complete Project in One Go

    Generating a small game or small service from scratch—complete with scenes, resource loading, input response, main loop, and basic physics—is a hard indicator for testing “long-context consistency.” The key is to rewrite the vague “make a game” into a verifiable engineering contract: the tech stack is unrestricted, but it must be launchable with a single command, frame rate or throughput must meet a given lower limit, and there must be placeholder fallbacks for missing assets. After generation, get it running first before talking about optimization, avoiding meaningless reviews on non-runnable code.

    3. Let the Model Directly Operate Interfaces for End-to-End Tasks

    Agents equipped with graphical user interface and browser operation capabilities can bridge scenarios where “there is no API, only clicking.” The value of this capability is not in showing off, but in compressing long-tail automation costs to near zero. When using them, be sure to pair with a sandbox environment, least privilege accounts, and operation log retention. Set up manual confirmation gates for actions involving submission, payment, and deletion.

    4. Test-First: Turn Acceptance Criteria into Executable Code

    First, let the model produce test cases and stub data, and after manual confirmation, let it write the implementation. Tests act as contracts, significantly reducing rework for things that “look right but fail when running.” Illustrative process:

    1. # Step 1: Only generate tests, manually review and pass before generating implementation
    2. cases = [
    3. {"name": "normal", "in": [1, 2, 3], "out": 6},
    4. {"name": "empty", "in": [], "out": 0},
    5. {"name": "neg", "in": [-1, 1], "out": 0},
    6. ]

    5. Provide Sufficient Reasoning Budget, Do Not Interrupt Midway

    It is a normal phenomenon for complex tasks to have a thinking pause on the order of minutes, as the model searches for solutions and self-verifies internally. Frequently appending messages and repeatedly urging will break the reasoning chain, causing the context to be occupied by noise. The correct approach is to wait after submitting, and write all supplementary information into the initial requirement at once.

    6. Repository-Level Context Feeding

    Giving only a single sentence of requirement leaves the model to guess. The minimum set of effective context includes: the directory tree, dependency manifest, core interface definitions, data models, and coding and error handling conventions. Example:

    1. project/
    2. cmd/ # Entry point
    3. internal/api/ # Interfaces and DTOs
    4. internal/store/ # Persistence
    5. configs/ # Structured configurations
    6. Constraints: Errors are uniformly wrapped into a struct with an error code; direct connection to the storage layer within handlers is prohibited.

    7. Introduce Self-Review and Multi-Round Iteration

    Let the model first produce an implementation, then act as a reviewer to find bugs according to a checklist (boundary conditions, concurrency safety, resource release, exception paths), and finally revise. Pseudocode is as follows:

    1. plan = model.generate(spec, context)
    2. for i in range(3):
    3. review = model.critique(plan, checklist)
    4. if review.blockers == 0:
    5. break
    6. plan = model.revise(plan, review)

    The key is that the review checklist is defined by humans and executed by the model, avoiding “self-praise.”

    8. Paste Raw Errors, Provide Minimal Reproducible Examples

    Do not paraphrase errors. Pasting the full stack trace, environment versions, reproduction steps, and excluded items can reduce a lot of ineffective back-and-forth. A minimal reproducible example has higher information density than a long background story.

    9. Replace Style Prohibitions with Acceptance Checklists

    Prohibitions like “do not use this pattern” or “must be divided into three layers” yield very low returns. Replace them with measurable goals: P99 latency for a single request below a given value, upper limit on cyclomatic complexity per function, lower limit on test coverage, and zero static analysis warnings. Only when the goals are measurable can the model have an optimization direction.

    10. Small-Step Delivery, Rollbackable, Observable

    Advance only one verifiable increment at a time, paired with the branch and commit granularity of version control, ensuring that any step can be independently rolled back. After launch, integrate logging services, monitoring alerts, and distributed tracing to connect “generation-phase quality” with “runtime-phase quality” into a closed loop. On the engineering side, you can leverage general cloud-native infrastructure like object storage, container platforms, message queues, logging, and monitoring to carry the load, decoupling it from the model’s capabilities.

    4. Common Pitfalls

    • Treating process constraints as requirements: The more constraints, the more conservative the model, and the more mediocre the output.
    • Starting work without acceptance criteria: If completion cannot be judged, iteration is impossible.
    • Requesting massive deliverables at once: Context consistency degrades as scale increases; milestones should be split.
    • Ignoring permission boundaries: Agents with operational capabilities must run in isolated environments. Keys are injected via environment variables or key management services, and should never be written into prompts or code.
    • Only doing subjective evaluation: Without a regression evaluation set, capability fluctuations brought by version upgrades cannot be quantified.

    5. Conclusion

    “Fewer rules, better performance” is not an encouragement to let things run wild, but a reminder to put constraints in the right place: lock down the destination with executable, measurable standards, and hand the route over to the model for free exploration. By solidifying these ten practices—structured graphics generation, minimal runnable projects, end-to-end operations, test-first development, sufficient reasoning budget, repository-level context, self-review, minimal reproducible examples, measurable goals, and small-step rollback—into team processes, occasional impressive outputs will be transformed into repeatable engineering productivity.