AI Prompt Writing Guide: From Instruction Engineering to Intent Expression
This article explains how prompt writing is evolving from rigid instruction engineering toward intent expression, and why structured prompts still matter. It covers a four-layer prompt template, common anti-patterns, engineering practices for managing prompts as code assets, and a practical tuning checklist to help teams choose the right level of structure based on the task.
1. Reframing the Problem: What Are Prompts Actually Optimizing?
Many teams treat prompts like magic spells, iterating through trial and error without building anything reusable. A more accurate view is that a prompt compresses a person’s vague goal into an input contract that the model can execute and verify. It serves three roles at once: clarifying intent, constraining behavior, and defining the output shape. So the evolution of prompts is essentially the gradual removal of redundant instructions from the input contract as model capabilities improve.
One clear trend is that prompts are shifting from instruction engineering to intent expression. Early on, you had to break down steps by hand; today the emphasis is on stating the final goal clearly. Structured thinking has not disappeared, though. It has moved from telling the model how to do something to keeping results controllable.
2. Stage One: When Capabilities Are Weak, Structure Is Mandatory
In the stage of limited context windows and weaker complex-instruction following, the model will almost never auto-complete implicit steps. If you do not specify the order, it skips steps; if you do not give a format, it improvises. The typical pattern at this point is a four-section layout:
[Role] Senior market analyst[Task] Summarize the text below and extract three key competitive advantages[Format] Unordered list, each item no more than 30 characters[Content] <text to summarize>
The value of this style is not the ritual. It breaks the task into slots the model can parse and reduces ambiguity. The cost is a long, rigid template with poor portability: a new task means rewriting it.
3. Stage Two: Intent Expression Becomes the Main Path
Today’s mainstream large models have stronger zero-shot and few-shot comprehension and can pick up implicit goals in natural language. At this point a prompt is closer to a verbal handoff between colleagues:
Summarize the material below in the voice of a senior market analyst, using three bullet points to capture the core competitive advantages: <material>
The key difference is that you used to provide reasoning demonstrations (step-by-step guidance), and now you can state the goal directly (results-oriented). This brings two immediate benefits: lower writing cost, and prompts that stay close to business language so non-engineering roles can help maintain them.
4. Why Structure Is Still Irreplaceable
Even with smarter models, three categories of scenarios still require structured design.
- Multi-step complex workflows. For example, “first translate into English, then extract key points, then merge the points with the Chinese source text into a table.” Structure fixes the execution order and avoids skipped steps and confusion between stages. Explicit numbering is recommended, along with specifying the input source for each step.
- Consistency and high precision. Batch generation, information extraction, code generation, and report templates have zero tolerance for randomness. Agreeing on JSON or XML output turns “free text” into “validatable data” that programs can consume directly.
- Style, role, and hard constraints. For example, “describe gravitational waves strictly in the style of a physicist’s popular-science writing, no slang, no undefined terms.” Role and prohibition statements remain the most effective way to control tone and boundaries.
An illustrative output contract:
{"items": [{"point": "advantage", "evidence": "source text basis", "confidence": 0.0}],"constraints_hit": []}
5. A Reusable Layered Template
Split prompts into four layers and narrow down ambiguity layer by layer:
- Goal layer: one sentence stating the business purpose and success criteria;
- Context layer: necessary background, audience, glossary, and the boundary of reference material;
- Constraint layer: length, tone, prohibited items, citation rules, and refusal conditions;
- Output layer: fields, order, examples, and a parseable format.
Goal: Generate a management summary for the ops weekly report; readers care about risk and cost.Context: This week's alert data is as follows; the term "SLA" refers to the service availability target.Constraints: No more than 200 characters; do not speculate about numbers not given; mark missing information as "not provided".Output: JSON with fields summary, risks[], cost_notes.
6. Common Anti-Patterns and Fixes
- Mixing goals and steps: delete the steps the model can infer on its own and keep only the business goal.
- Conflicting constraints: for example, “be as detailed as possible” versus “no more than 100 characters” must be prioritized.
- Missing acceptance criteria: add “what conditions must be met for the task to count as done” so results are judgeable.
- Example contamination: if a few-shot example contains the wrong format, it gets copied consistently, so regression checks are needed regularly.
7. Engineering Implementation Advice
Treat prompts as code assets: unified version control, change review, regression cases, and canary releases. On Baidu AI Cloud, you can combine model services with object storage to save templates, log services to record call traces, and monitoring alerts to track quality metrics, forming a closed loop. When evaluating, look at task success rate, format compliance rate, and manual rework rate together, instead of tuning by subjective feel alone.
8. Tuning Checklist
- Can you state the success criteria in one sentence;
- Is only the necessary context kept;
- Can the output be parsed by a program;
- Have conflicting constraints been ordered;
- Is a failure-sample regression set prepared.
Conclusion: The core of prompt writing is not memorizing templates, but first judging whether a task belongs to “intent expression” or “strongly constrained output,” then choosing the matching level of structure. Fix this judgment into team standards, and prompts can be upgraded from individual skill to a sustainably maintainable engineering capability.
