Smart Programming: Strict Outcomes, Flexible Paths for Reliable Delivery
As large language models become part of everyday software development, the main failure is often not that the model cannot write code. The problem is that the task is overloaded with conflicting process instructions while the expected result remains vague. This article presents a more reliable approach: define observable acceptance criteria, leave implementation choices open, produce verifiable artifacts, and use people or automated tests to decide whether the result is acceptable. It also covers prompt design, tool-use boundaries, short feedback loops, and how teams can operationalize the method.
1. Define “Done” Before Allowing Creative Freedom
Outcome constraints define a deliverable that can be judged independently by its functionality, format, boundaries, and failure behavior. Flexible paths mean that the model is not forced to follow specific intermediate reasoning steps, tool-call sequences, or coding styles unless those details are themselves acceptance criteria.
A useful definition of “done” normally includes four types of information:
- Artifact format. Specify whether the deliverable is an executable code fragment, a vector graphic document, an API contract, or a reproducible operating record. The format determines how the result can be evaluated.
- Observable behavior. For example: “The subject is fully visible, the wheels are connected to the frame, and there is no obvious geometry intersection,” or “The game loop starts, input changes the state, and the exit path is explicit.” Describe observable facts instead of using unverifiable terms such as “high quality” or “stunning.”
- Hard boundaries. Prohibit external network access, unauthorized changes to user directories, and secret output. Require explicit errors on timeouts or failures instead of allowing the system to pretend that the task succeeded.
- Acceptance method. Specify at least one evaluation method, such as a manual checklist, schema validation, unit tests, screenshot comparison, or log sampling. An outcome without a validation method is only a wish.
The implementation path can remain flexible. This includes whether intermediate drafts are shown, which internal data structures are used, how much code is commented, and whether the skeleton or details are implemented first. In practice, the more rules are placed on how to work instead of what must be delivered, the more likely the model is to overfit local instructions and produce a worse overall result.
2. Turn Creative Tasks into Verifiable Artifacts
A request such as “draw a bird riding a bicycle” is not merely conversational. It is a structured graphics-generation task. If the request contains only descriptive adjectives, the model can vary freely in composition, proportions, and layers, making results difficult to compare. Rewriting the request around a concrete outcome makes it reusable.
An example of a verifiable graphics outcome might include:
- Output one complete vector graphics document that can be rendered directly, without explanatory text.
- Make the subject, frame, two wheels, and pedals distinguishable. The wheels must be closed shapes, and the frame must connect to the wheel axles.
- Use a side view. Place the subject above the seat without extensive overlap with the wheels.
- Use a fixed canvas size. Keep the subject inside a safe margin and maintain a simple background for visual comparison.
A representative validation target does not depend on a model-specific private interface. It depends only on the format itself:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 360"><!-- Wheels, frame, and subject are layered; coordinates stay inside the viewBox --></svg>
During review, ask only three questions: Can a standard renderer open the document? Are the required components present? Does the result violate margin or overlap constraints? Generation time and the elegance of the wording should not affect the score. This turns the question of whether an output is usable from a subjective impression into a checklist.
The same principle applies to a more complex interactive project. If the goal is “a small playable 2D or 3D scene,” do not require the model to reproduce every adjective from a concept image. Instead, define the scene elements, input mappings, win or completion conditions, and fallback behavior when resources are missing. The concept image is a visual reference; the code and runtime result are the actual outcomes.
Rather than predefining a complete architecture in the prompt, first request a minimal loop that can start, then add constraints based on failed test cases. Releasing every requirement at once often produces a structurally attractive but nonfunctional prototype.
3. Keep Constraints in the Prompt, Not a Script
A practical prompt template can be reduced to four sections:
- Role and permissions: You are the implementer and must deliver the artifact. You may not access undeclared external systems.
- Outcome: Define the required format, behavior, and boundaries.
- Inputs: Provide the user’s sketch description, existing file fragments, and interface names that must be preserved. If material is missing, state: “It does not exist. Create a reasonable placeholder and label the assumption.”
- Failure strategy: When information is insufficient, list assumptions and still provide a runnable version. Do not replace the artifact with a long plan.
The anti-patterns are equally important. Do not require both “the steps must be as detailed as possible” and “the final code must be as short as possible.” Do not prescribe an algorithm while also demanding unrestricted innovation in the same instruction. Do not keep appending obsolete restrictions from previous conversations. For every process rule, ask whether it changes the acceptance result. If it does not, remove it.
Flexible implementation does not mean unrestricted access. What is open is the choice of implementation, not permissions. When a task involves file writes, accounts, or production configuration, the outcome must include a read-only preview, a change list, and human confirmation before execution. A model can perform reversible experiments inside a sandbox. For irreversible actions, the outcome should stop at a proposed change rather than an executed one.
4. Separate Tool Operations from Pure Generation
Some tasks produce files. Others require an edit to be completed inside an existing design or office application. These should not be combined into one vague instruction.
Pure generation is appropriate for code, vector graphics, configuration, tests, and documentation. Its advantages include versionable artifacts, reproducible rendering, and easy diff comparison. Its limitation is that it cannot prove the actual pixel state or button state of an external interface.
Tool operation is appropriate when the result must be placed on an existing canvas, spreadsheet, or design file. In that case, define an operation contract:
- Which applications may be opened
- Which areas may be clicked
- Which submissions or external transfers are prohibited
- What screen state or exported file must remain for verification at the end
Whether the underlying mechanism uses mouse and keyboard automation or a dedicated connector, evaluation should focus on three types of evidence: the state before the operation, the state afterward, and whether unrelated parts of the interface were changed.
In enterprise environments, the safer default is to generate an artifact for a person to paste or import after approval. Treat computer operation itself as the outcome only when the environment is isolated, actions can be replayed, and mistakes can be undone. “Let the system click through everything” is not a substitute for acceptance testing.
5. Use Short Loops Instead of One Large Bet
When model performance is still variable, the right approach is not to compress a 45-minute ambition into one massive prompt. Break the goal into short, reversible iterations. Each round should add one observable increment.
A practical loop is:
- Skeleton: Create an empty scene or graphic and verify that the format is valid and the entry point exists.
- Main path: Add one subject, one interaction, and one success condition.
- Failure path: Handle missing resources, invalid input, and timeouts.
- Visual alignment: Tighten layout, colors, and wording only after behavior is stable.
- Regression: Automate the earlier acceptance checklist so that new constraints do not break existing behavior.
Each prompt iteration should add evidence of failure, such as “the left wheel is disconnected from the frame” or “the application does not respond to input after startup.” Do not paste the entire fictional setting again. Evidence is more effective than adjectives for correcting model output.
If one iteration fails repeatedly, reduce the scope of the outcome instead of adding more descriptive language. For example, first ensure that two wheels and one frame have correct geometry, then add the riding pose. Reducing the outcome is an engineering technique, not a lower standard. It makes the standard achievable so it can be raised again later.
6. How Teams Can Productize This Method
An individual expert may write effective prompts manually, but teams need a process. Otherwise, quality will vary with the person conducting the conversation.
- Use task templates that contain only the outcome, inputs, prohibited actions, and acceptance criteria. Remove a “recommended approach” section so that the implementation path is not fixed unnecessarily.
- Store artifacts separately. Keep graphics, code, and operation records in appropriate systems. Put code in version control, images and exported files in object storage, and runtime logs in logging and monitoring systems. This makes it easier to identify which constraint caused a regression.
- Separate review roles. The person who proposed the goal should not be the only person deciding that the result “looks good.” Reviewers should check the acceptance list, and release-related changes should go through the normal code review process.
- Separate environments. Use containers or isolated workspaces for experiments. Production configuration, secrets, and real customer data should be inaccessible by default. Use message queues to transmit task status, not to carry unreviewed executable content.
- Measure process quality. Useful metrics include first-pass success rate, rework rounds, defect density across acceptance items, and rollback frequency. Without controlled comparisons, do not claim that one model is “the best” or that a certain amount of reasoning time guarantees success.
These capabilities are general engineering infrastructure: version control, object storage, container isolation, logging, and alerting. They do not depend on a particular model provider and should not be treated as promises about any specific cloud platform.
7. Common Failure Modes and Boundaries
If the outcome is specified too precisely—down to every pixel coordinate and internal function name—the path is no longer flexible. The model is merely filling in blanks, and even a small conflict can produce contradictory code. If the outcome is too vague and says only “make it beautiful,” the outputs cannot be compared. The balance is to lock down user-visible behavior and safety boundaries while leaving internal structure open.
Another failure mode is treating the model’s confident explanation as runtime evidence. A complete plan does not prove that a graphic can render, a loop can run, or an interface was actually changed. Any result that cannot be opened, executed, or compared before and after should be considered incomplete.
Do not interpret open implementation paths as open permissions. Code generation, drawing, and interface operations can involve privacy, copyright material, and accidental deletion. Use least privilege, reversibility, and unauthorized-material avoidance by default. When a task involves real accounts or production systems, keep a human at the confirmation point.
8. A Minimal Practice You Can Reuse
For the next task, do only three things.
First, write down the artifact format, three observable behaviors, and two prohibited actions in no more than ten lines.
Second, ask the model to produce the artifact directly instead of starting with a long plan.
Third, use a fixed checklist to score the result. If it fails, provide only the failure evidence and run another iteration. For graphics tasks, validate the format and component completeness first. For interactive tasks, validate startup and input handling first. For tool tasks, validate the before-and-after states first.
When unnecessary rules are removed, performance often improves—not because constraints have disappeared, but because they have finally been placed where they belong: on the outcome, not on the route.
