Chapter 3: Best Practices for Prompt Engineering
By now, you know what prompts are and how to write them in different styles. In this chapter, letβs cover some best practices to make your prompts consistently deliver great results.
Be Clear and Specific
Avoid vague instructions. A well-structured prompt gives the model a clear path to follow.
Bad Prompt: Explain AI.
Better Prompt: Explain artificial intelligence in 3 sentences as if you are teaching a high school student.
Use Context
Provide the model with enough background information to guide its output.
Example:
Iterate and Refine
Prompt engineering is iterative. Experiment with phrasing, formatting, and structure to get better results.
Set Output Constraints
If you want a list, code block, or table, explicitly request it.
Example: Provide 5 bullet points summarizing the benefits of clean energy.
π‘ Tip
π§© Quick Quiz
1. Which of the following is NOT a good best practice?
- A. Provide context
- B. Be vague and generic
- C. Iterate and refine
- D. Set output format
Show Answer
B. Be vague and generic β this leads to unpredictable results.
2. Fill in the Blank: Providing background information in your prompt is called adding __________.
Show Answer
Context.
3. Reflection: Write a prompt template you could reuse for generating social media posts about new product launches.