How to Write Prompts That Get the Answer You Want on the First Try
AI may look very intelligent, but it is actually a system that generates responses probabilistically based on the instructions it receives. This means vague prompts produce vague results, and the more specific the instruction, the more consistent the output quality.
A well-written prompt gets you the response you want in a single attempt. A poorly written prompt leads to multiple rounds of revisions that cost both time and money.
Here are four essential principles to keep in mind for efficient prompt writing.
1. Specify Conditions Concretely: Numbers, Regions, Time
When giving AI a task, include information that narrows the scope as much as possible. Without conditions like time, location, target, or quantity, the model generates the most generic possible answer.
Recommend a good book.
Recommend the top 3 best-selling self-help books published in the United States in 2023.
In the good example, the following are clear:
- Time: 2023
- Region: United States
- Category: Self-help
- Quantity: 3 books
Specifying conditions sets the direction for the response and reduces unnecessary filler.
2. Show the Desired Response Format as an Example
For AI, "how" to answer is just as important as "what" to answer. Without a specified format, models tend to produce generic explanatory responses.
Create a plan for a website development project.
Write a development project plan for a company introduction website following the format below.
1. Project Overview: Purpose and scope
2. Key Phases: Tasks per phase and estimated duration
3. Staffing & Budget: Required team composition and budget summary
Example format:
1. Project Overview: Redesign of existing site and improvements to user experience
2. Key Phases:
- Requirements analysis (1 week)
- Design (2 weeks)
- Development (4 weeks)
3. Staffing & Budget:
- 1 frontend developer, 1 backend developer, 1 designer
- Total budget: $40,000
When you present the format first, the model follows that structure when responding. This is especially effective when writing reports, plans, or policy documents.
3. Use Delimiters to Make Structure Clear
The longer a prompt gets, the more easily instructions and body text become mixed together. Using delimiters helps the model recognize the structure more accurately.
Translate to English
If this technology is successfully implemented, it could be used broadly across various industries.
Through this, we hope to bring positive change throughout society.
### Instruction
Translate in the tone of a professional translator, and separately list the 3 key vocabulary words.
### Source Text
"""
If this technology is successfully implemented, it could be used broadly across various industries.
Through this, we hope to bring positive change throughout society.
"""
### Output Format
1. Translation
2. 3 key vocabulary words
Using delimiters like ### and """ allows the model to clearly distinguish instructions, data, and output format. The clearer the structure, the more consistent the response.
4. Limit Length or Set a Clear Objective
AI naturally tends to over-explain. Without a length constraint, responses can become unnecessarily long.
Explain the severity of the low birth rate problem.
Explain the population decline caused by low birth rates in 200 characters or fewer.
Alternatively, instead of a length limit, you can specify an objective:
- Summarize in 5 sentences for an executive presentation
- Explain in a way that a middle school student can understand
- Present 3 arguments for and 3 against
Specifying length or the target audience like this adjusts the response to fit the purpose.
Summary
The core principles for effective prompt writing are:
- Specify conditions concretely.
- Present the desired response format.
- Use delimiters to make structure clear.
- Set a length limit or a clear objective.
The practice of crafting optimal prompts based on these principles is called prompt engineering.
Try prompt engineering to get the answer you want on the first try.
Want to learn more?
Join CodeFriends Plus membership or enroll in a course to start your journey.