A six-part engineering guide: from individual prompts to specification-driven probabilistic software.
Read: Prompt engineering is becoming programming →Foundations: the shift from prompts to programs
Why prompt engineering is turning into software engineering: the deterministic shell, the probabilistic core, and what can be declared at all.
Prompt programming declares what, not how
From individual prompts to specification-driven probabilistic software. Traditional programming tells the computer exactly how to produce a result. Prompt programming defines what a valid result looks like (context, constraints, capabilities) and lets a probabilistic model decide part of the how.
Same input + same state usually produces the same output.
The system defines the operating boundaries; the model may choose different valid paths.
The tilde is the whole point: the output is sampled, not calculated as a perfectly deterministic function.
Traditional software gives you a promise you can plan around: the same input produces the same output, so you test once and ship. Prompt-based software breaks that promise. The same request can produce several different valid results, which means a successful demo is not evidence that the feature works in production, and a passing test run is not evidence that it will pass tomorrow. The work does not disappear, it moves: away from writing every instruction, towards defining what a valid result is and proving that the system reaches it.
A deterministic shell around a probabilistic core
Use normal code wherever logic can be expressed reliably. Use the language model where interpretation, semantic reasoning, creativity or ambiguity genuinely needs it.
Let the AI decide semantic and creative details.
Do not let it invent permissions, lifecycle rules, success criteria or irreversible actions.
When something goes wrong, the instinctive response is to rewrite the prompt. That produces an endless cycle: each edit fixes one case, silently breaks another, and leaves no audit trail of why the system behaves as it does. Teams that instead put validation, permissions, retries and limits into ordinary code get failures that are reproducible, explainable and fixable once. The boundary between the two is the single most consequential architectural decision in the system.
A prompt program is more than a prompt
A real AI application wraps the prompt in eight further declared parts. Together they form the program.
Goal · requirements · constraints · definition of done · quality thresholds.
Required and optional fields · valid values · structured response schemas · unrepresentable invalid states.
User request · relevant documents · repository state · history · design system · policies · retrieved knowledge.
Chains · branches · routes · parallel workers · loops · escalation paths.
Current stage · completed work · failed attempts · accepted decisions · remaining tasks.
Available capabilities · read/write boundaries · network access · approval requirements · side effects.
Correctness · requirement coverage · quality · safety · functionality · compliance.
When to finish · retry · repair · escalate · abort · ask the user.
Cost · latency · model choice · token budget · logging · retry strategy · deployment mode.
A production-grade prompt feature has seven parts: specification, instructions, context, state, tools and permissions, evaluation, and governance. Only one of them is the prompt. When a team can show you the prompt and nothing else, the other six live in individual heads, which is why these features are so hard to hand over, review or reproduce after the person who built them moves on. This is ordinary key-person risk wearing new clothes.
Can we declare all possible logic?
Nearly all system logic can be declared, but not every semantic decision. Three zones, from fully declared to open-ended.
Schemas, code, policies, explicit configuration.
Implement as schemas, code, policies and explicit configuration.
The model chooses within declared boundaries.
The model chooses, but only inside declared boundaries.
Cannot be enumerated in advance.
This is where agents and generative reasoning add both value and uncertainty.
Nearly all system logic can be declared in advance. A minority genuinely cannot, because it depends on judgement, taste or situations nobody has seen yet. Confusing the two is expensive in both directions: declaring open-ended judgement produces brittle rules that fail on real users, and leaving declarable rules to the model produces variable behaviour in exactly the places that must not vary, such as pricing, permissions and lifecycle. The classification also determines how the work must be tested.
More articles
Design reliable UX for connected devices across hardware, apps, BLE, Wi-Fi, cloud, onboarding, errors, and recovery.
Read: UX for Connected Devices: Designing Experiences Across Hardware, Apps, Connectivity, and Cloud →Hardware companion apps: hard parts, partner skills, and questions that separate specialists from agencies.
Read: How to Choose the Right Companion App Partner for Your Hardware Product →