How to Write Better Prompts: A Simple 3-Part Formula
Prompt engineering is the art of asking the right questions in the right way. Whether you're writing prompts for ChatGPT, building a custom AI assistant, or just trying to get more accurate responses, how you structure your prompt matters—a lot. At the heart of every good prompt are three key parts: context, instruction, and example. In this article, we’ll break each of these down so you can craft clearer, more effective prompts that get better results. 1. Context — Setting the Stage Before asking a question or giving a task, it helps to set the scene. The context gives background information that helps the AI understand the scenario, domain, or objective. What can context include? Relevant background details Definitions of key terms or roles A description of the situation or goal Example: Let’s say you want to write a follow-up email after a meeting. Context: "You had a meeting with a potential client about a product launch. You want to send them an email summarizing the meeting and thanking them for their time." By setting the context, you help the AI frame its response around a specific situation. 2. Instruction — Giving Clear Direction The instruction is the core of your prompt. It tells the AI exactly what you want it to do. Being clear and specific here is key. What makes a good instruction? It directly states the task It avoids ambiguity It may include formatting, tone, or length guidelines Example: "Write a follow-up email thanking the client for the meeting and summarizing the key discussion points." The more precisely you phrase your instruction, the more reliably the AI will produce the result you’re looking for. 3. Example — Showing What You Mean When a task is complex or subjective—like writing in a certain tone or structure—providing an example helps steer the AI toward your desired output. Why include examples? They clarify formatting or content expectations They reduce guesswork They serve as templates the AI can imitate Example: "Dear [Client Name], Thank you for meeting with me yesterday. We discussed the upcoming product launch, marketing strategy, and potential timelines. I appreciate your insights and look forward to our continued collaboration." This brief example shows the tone, structure, and length you want. It also gives the AI a reference point to stay aligned with. Putting It All Together Here’s what a full, well-structured prompt might look like when combining all three parts: Context: I had a meeting with a potential client about a new product launch. Instruction: Write a professional follow-up email thanking them and summarizing the main points we discussed. Example: "Dear [Client Name], Thank you for meeting with me yesterday..." This layered structure leads to more accurate, relevant, and helpful responses from the AI. Wrapping up A well-crafted prompt doesn't happen by accident. The best results come when you: Provide clear context Give direct instruction Offer a relevant example This structure is simple, but incredibly effective—especially as your prompts grow more complex or creative. As you practice writing prompts, try to be intentional about including all three parts. It’s a small shift that can make a big difference in the quality of your results. If you're a software developer who enjoys exploring different technologies and techniques like this one, check out LiveAPI. It’s a super-convenient tool that lets you generate interactive API docs instantly. So, if you’re working with a codebase that lacks documentation, just use LiveAPI to generate it and save time! You can instantly try it out here!

Prompt engineering is the art of asking the right questions in the right way. Whether you're writing prompts for ChatGPT, building a custom AI assistant, or just trying to get more accurate responses, how you structure your prompt matters—a lot.
At the heart of every good prompt are three key parts: context, instruction, and example. In this article, we’ll break each of these down so you can craft clearer, more effective prompts that get better results.
1. Context — Setting the Stage
Before asking a question or giving a task, it helps to set the scene. The context gives background information that helps the AI understand the scenario, domain, or objective.
What can context include?
- Relevant background details
- Definitions of key terms or roles
- A description of the situation or goal
Example:
Let’s say you want to write a follow-up email after a meeting.
Context:
"You had a meeting with a potential client about a product launch. You want to send them an email summarizing the meeting and thanking them for their time."
By setting the context, you help the AI frame its response around a specific situation.
2. Instruction — Giving Clear Direction
The instruction is the core of your prompt. It tells the AI exactly what you want it to do. Being clear and specific here is key.
What makes a good instruction?
- It directly states the task
- It avoids ambiguity
- It may include formatting, tone, or length guidelines
Example:
"Write a follow-up email thanking the client for the meeting and summarizing the key discussion points."
The more precisely you phrase your instruction, the more reliably the AI will produce the result you’re looking for.
3. Example — Showing What You Mean
When a task is complex or subjective—like writing in a certain tone or structure—providing an example helps steer the AI toward your desired output.
Why include examples?
- They clarify formatting or content expectations
- They reduce guesswork
- They serve as templates the AI can imitate
Example:
"Dear [Client Name],
Thank you for meeting with me yesterday. We discussed the upcoming product launch, marketing strategy, and potential timelines. I appreciate your insights and look forward to our continued collaboration."
This brief example shows the tone, structure, and length you want. It also gives the AI a reference point to stay aligned with.
Putting It All Together
Here’s what a full, well-structured prompt might look like when combining all three parts:
Context:
I had a meeting with a potential client about a new product launch.
Instruction:
Write a professional follow-up email thanking them and summarizing the main points we discussed.
Example:
"Dear [Client Name], Thank you for meeting with me yesterday..."
This layered structure leads to more accurate, relevant, and helpful responses from the AI.
Wrapping up
A well-crafted prompt doesn't happen by accident. The best results come when you:
- Provide clear context
- Give direct instruction
- Offer a relevant example
This structure is simple, but incredibly effective—especially as your prompts grow more complex or creative.
As you practice writing prompts, try to be intentional about including all three parts. It’s a small shift that can make a big difference in the quality of your results.
If you're a software developer who enjoys exploring different technologies and techniques like this one, check out LiveAPI. It’s a super-convenient tool that lets you generate interactive API docs instantly.
So, if you’re working with a codebase that lacks documentation, just use LiveAPI to generate it and save time!
You can instantly try it out here!