How to Write Better ChatGPT Prompts (5 Step Guide)

How to Write Better ChatGPT Prompts (5 Step Guide)

How to Write Better ChatGPT Prompts (5 Step Guide)

·

16 min read

Prompting is the skill of the future, and writing better AI or ChatGPT prompts for anything will help you perform almost any task.

ChatGPT is now a go-to tool for everyone worldwide, and it makes sense because it can do a lot of tasks that take hours to complete.

How? By writing a simple prompt, feeding it to ChatGPT, and boom, getting a solution.

But, the easier it sounds, the harder it is. A lot of people on public forums have shown their frustration writing good prompts that work. The problem is, that ChatGPT works on parameters, the more parameters it gets in a single prompt the better the chatbot’s output.

So, in this guide, you will learn everything about writing a better ChatGPT prompts on your own. And hey, maybe bookmark this post for future reference? Just a thought!

Let’s get started!

Basics of Prompting

In order to understand the skill of writing prompts, you need to first understand what prompts are.

We are not going to delve deeper into this topic as this is not something which you should know if you’re not a complete beginner.

So, understand this:

What a ChatGPT prompt is

At its core, a prompt is an instruction or query that directs the AI’s response. It’s akin to asking someone a question or giving them a task. The clarity and specificity of this instruction often determine the quality of the resulting answer.

For example, asking “Tell me about fruits” might yield a general overview, while “Describe the nutritional benefits of blueberries” would provide a more specific, focused response.

Without prompts, any type of AI generator that uses text to generate responses, images, videos or audio, is useless and cannot perform any task on its own.

This is the reason why prompts are so hyped right now, and almost everyone wants to learn it.

In this guide, our main focus is to make you understand the techniques and ways of writing better AI prompts specifically for ChatGPT. However, these tips are universal, and it can help you write prompts for any chatbot like Bard, Bing Chat, Chatsonic and more.

Here’s How to Write Better ChatGPT Prompts

Prompting can be performed in a few steps, these steps are crucial for a prompt engineer, and they make a lot of difference in writing a good prompt.

Start by following these steps to get better results on ChatGPT.

Step 1. Be Specific with Your Task

Imagine you’re trying to chat with a smart friend who can answer almost any question, but there’s a catch – you have to be very specific about what you’re asking.

That’s ChatGPT. Initially, the most common mistake people make is not keeping their prompts specific.

They try to be indirect for example:

Imagine you’re asking a stranger for directions. If you say, “Where’s the cafe?”, they might point you to the nearest one. But if you say, “Where’s John’s Cafe that serves gluten-free muffins?”, they’ll guide you precisely where you want to go.

The same goes for ChatGPT. A lot of times, you might be making this prompt mistake:

🚫 Unspecific Prompt: Hey ChatGPT, I want to make a recipe for tonights dinner, help me create dish.

This is the worst type of prompt that you can give to ChatGPT as this will only provide very vague responses. Read the prompt once again and you’ll find that a lot of specifications are missing.

This prompt could be rewritten like this:

✅ Specific Prompt: Hey ChatGPT, today I have a themed dinner party the theme is [name your theme e.g. halloween], in my refrigerator I've been left with a pumpkins, cucumbers, onions, garlic, red chillies, bell peppers, mushrooms, cheese, tomatoes and chicken. Create a recipe using only these items and make sure the dish does not use stove as I have a microwave oven.

This prompt will make a lot of difference. Why? You have now mentioned a lot of details to ChatGPT like the theme of your dinner, the ingredients you have, and the method of cooking you prefer.

Step 2: State the Intent Clearly while Prompting ChatGPT

When interacting with ChatGPT or any other AI chatbot, the clarity of intent in your prompt can significantly impact the quality and relevance of the AI’s response.

Explicitly mentioning the intent provides context that enables the AI model to tailor its response to better fit the user’s requirements.

Another common mistake in most of the prompts on the internet are, they lack intent.

Intent is what makes ChatGPT provide a clear response. For example, let’s say you want your 7-year-old kid to understand how clouds are formed, what you will prompt in ChatGPT.

Here’s what most of the users will prompt:

🚫 Bad Prompt: Explain how clouds are formed in the sky.

Do you know how this prompt lacks intent. Though the prompt clearly states “Explain How Clouds are Formed” it does not mention how you want your response to be and the intent of your prompt (what you want to achieve with the prompt).

ChatGPT will respond as shown in the below image:

Vague response by ChatGPT as intent is not specified in the prompt

Vague response by ChatGPT as the intent is not specified in the prompt

There’s no way a seven-year-old kid will understand this answer.

Intent can be specified using this prompt formula:

Prompt formula to specify intent: [Context or Setting (if necessary)] + [Direct Action] + " to [Specific Goal/Objective]" + " for [Target Audience/Scenario (if applicable)]" + " using [Preferred Method/Style (if any)]" + ". Consider [Any Special Instructions or Constraints]."

Here’s a real-life usage of the above prompt formula to specify your intent to ChatGPT:

  • Context or Setting: This sets the stage for the prompt, providing background or situational context.

  • Direct Action: What you want ChatGPT to do.

  • Specific Goal/Objective: The end goal of the task.

  • Target Audience/Scenario: Whom the output is intended for or under what circumstances.

  • Preferred Method/Style: If there’s a specific approach or tone you want the AI to take.

  • Special Instructions or Constraints: Any additional guidelines or boundaries.

Now, let’s use this prompt intent formula to create a much better ChatGPT prompt:

Context: "Imagine explaining to a 7-year-old,"

Direct Action: "Describe"

Goal/Objective: "how clouds are formed"

Target Audience/Scenario: "in a way that's easy for a child to grasp"

Preferred Method/Style: "using simple language and relatable analogies"

Special Instructions: "Consider avoiding complex scientific jargon."

By using the above formula, here’s how your final prompt will look like:

ChatGPT I am explaining to a 7-year-old, describe how clouds are formed in a way that's easy for a child to grasp using simple language and relatable analogies. Consider avoiding complex scientific jargon.

After using the above prompt, ChatGPT’s response will be 10x better than the previous vague and jargon response.

Revised ChatGPT response after specifying the intent in the prompt.

Revised ChatGPT response after specifying the intent in the prompt.

Step 3: Use Few-Shot Prompting Technique

Few-shot prompting is a subtle technique of guiding ChatGPT’s outputs by providing a handful of examples or “shots” right before your main prompt.

The idea is to put ChatGPT in the right frame of mind by showing it what you want.

This technique is a lot like training a dog; you give it a few commands (with demonstrations) to show it how to behave.

It works almost every time because OpenAI’s ChatGPT has been trained on a vast amount of text. When you provide examples, you’re re-calibrating or fine-tuning the model’s focus for your specific task.

It’s a way to make the vast knowledge of ChatGPT more laser-focused on your intent.

Let’s check out some examples for a better understanding:

If you ask ChatGPT, “Translate the following English sentence to French”, it will wait for the sentence.

But if you lead with examples:

Few Shot Prompt example:

ChatGPT, I want you to act as a english to french translator. I will provide with english sentences and you'll resopond back with french translations. Here's an example of what I want you to do:

English: "Hello, how are you?" French: "Bonjour, comment ça va?"

English: "Thank you very much." French: "Merci beaucoup."

And then provide your sentence, it gives ChatGPT a clearer context, ensuring a more accurate translation.

Using the above few shot prompts, here’s how ChatGPT responded. The output is exactly how the user wants it to be without any mistakes:

Few shot prompt of translating English sentences to French.

Few-Shot prompt used for translating English sentences to French.

Step 4: ChatGPT Works on Order of Importance

Even reading the above heading will shock you, haha. See, ChatGPT’s prompts are not like sentences, with each sentence being important. No.

ChatGPT prompts usually operate on six important components ranked in order of importance. Those six components are:

  • [Task]: What do you want ChatGPT to do?

  • [Context]: What background or situational information should ChatGPT consider?

  • [Exemplar]: Can you provide an example to illustrate your expectations?

  • [Persona]: What role or voice should ChatGPT adopt?

  • [Format]: How should the response be structured?

  • [Tone]: What mood or style should the answer reflect?

Now, it is important to remember that these components have an importance hierarchy from top to bottom, which means [Task] is the most important component in a given prompt while [Tone] is optional or least important.

Why? Because even if you add a prompt with just a [Task] say “Write me a letter” and do not provide the [Format], [Tone], [Persona], or other components, ChatGPT will still come up with a decent output.

So, the best way to write a better prompt is to keep the order of importance of these six components in mind.

Here’s a simple example to illustrate the usage of components if you want to create the best AI prompts:

Illustrative Example 1:

Task: Write a short article.

Context: About the benefits of green tea.

Exemplar: "Green tea, originating from China, has been praised for its numerous health benefits. For instance, it aids in..."

Persona: A nutritionist.

Format: Introduction, 3 benefits, conclusion.

Tone: Informative yet engaging.

ChatGPT Response:

"Green tea, an ancient beverage from China, has garnered worldwide attention due to its myriad of health benefits. As a nutritionist, I've witnessed firsthand the advantages it offers. Firstly, green tea is a rich source of antioxidants, essential in fighting off cellular damage. Secondly, its properties can boost metabolism, aiding in weight management. Lastly, the drink is known for its calming effects, providing mental clarity and reducing stress. In conclusion, integrating green tea into your daily routine can be a step towards a healthier lifestyle. Dive into its warm, refreshing taste and let your body cherish its benefits."

Illustrative Example 2 (Leaving out the last component):

Task: Describe a sunset.

Context: Viewed from a beach.

Exemplar: "As the sun kissed the horizon, the sky painted a beautiful canvas of orange and purple..."

Persona: A poet.

Format: A poetic description in 4 lines.

ChatGPT Response:

"As the sun kissed the horizon's edge, The beach bore witness to twilight's pledge. Orange and purple, a canvas so grand, Nature's art, drawn by a divine hand."

In this example, even without specifying the tone, ChatGPT understands from the task, context, exemplar, persona, and format that a poetic, suggestive tone is appropriate.

Illustrative Example 3 (Keeping only top components):

Task: Translate the following sentence.

Context: Into French.

Exemplar: "Hello, how are you?" becomes "Bonjour, comment ça va?"

ChatGPT Response:

Example of chatgpt prompt and writing better prompts

You can see how the most important components can generate good responses.

"Certainly! Please provide the sentence you'd like me to translate into French, and I'll do my best to provide the translation for you."

So, if you want to create better prompts in ChatGPT or any other chatbot like Bing Chat, Bard, Claud AI or any other alternative, just use the below prompt formula.

Prompt Formula (Using the Order of Importance Technique)

Begin with your primary [Task] followed by the specific [Context] to set the scene. If you have a particular example or [Exemplar] in mind, weave it into your request for clarity. Then, set the [Persona] by indicating who or how you'd like ChatGPT to respond. If there's a [Format] you prefer, guide ChatGPT towards that style within your sentence, and finally, close by defining the [Tone] of the desired answer.

Step 5: Using “Roles” and “Act As” Prompting

Finally, we are at the last step of writing better prompts, and trust us, this is the most fun technique that most prompt engineers love using.

Even on Github, you can find a ton of role-play and act as prompts for ChatGPT. This prompting technique is so popular because it has the lowest chance of error in GPT response.

Here’s how Act As or Role Play ChatGPT prompts work.

Role-play prompting revolves around the principle of identity and behavior mimicry.

By instructing the model to emulate a particular [Persona] component that we talked about in Step 4 – be it Shakespeare, a detective, or a food critic – the prompt essentially offers the AI a ‘lens’ through which to process the subsequent task or question.

Because of this, the AI’s next responses are styled and content-wise tailored to the job it has been given. Well, there are various applications of this prompt technique, and here are some examples:

Styling Text

A prime application of this technique is to imbue text with a specific style or tone. For instance, a prompt asking ChatGPT to describe a sunset “as Shakespeare” would yield an eloquent, poetic response that mirrors the Bard’s iconic language.

Similarly, prompting the AI to describe the same sunset “as a scientist” would produce a factual, detailed account of the physics and atmospheric phenomena at play.

Example Prompt: "You are Shakespeare. Describe a sunset."

Output: "As twilight's curtain draws nigh, the heavens blush with hues of amber and crimson, a silent ode to the day's grand finale."

Improving Accuracy

Beyond mere stylistic adjustments, the role-play prompting technique can also enhance the accuracy of responses, particularly when the designated role is associated with expertise.

By instructing ChatGPT to answer “as a brilliant mathematician” or “as a history professor,” users can often produce more detailed and accurate responses.

Guiding Behavior and Interaction

The technique can also guide the AI’s behavior during an interaction. For instance, instructing ChatGPT to “act as a personal coach” or “embody a patient listener” shapes the nature of the interaction, ensuring the AI offers guidance, reassurance, or listens, based on the chosen role.

Now, coming back to writing better prompts via Act As a technique, you can use this simple template:

Template:

"You are [Role/Persona]. [Context, if necessary]. [Specific Task or Question]."

Example 1:

Prompt: "You are [Historical Figure]. [Provide context or situation]. How would you respond to [Specific Scenario or Question]?"

Here’s what ChatGPT responded to when we gave the above template (You are [socrates]. [You have to explain enlightenment to me and what you think about it]. How would you respond to [if someone asks you why enlightenment is not achievable]):

ChatGPT response

ChatGPT response

Now, the best part of role-play prompts is, that you can as many parameters to them and get better responses each time you feed it with longer context, and other components.

For example, a prompt like the one below will provide a much better response:

I want you to act as an English translator, spelling corrector and improver. I will speak to you in any language [specific language e.g., “Turkish”] and you will detect the language, translate it and answer in the corrected and improved version of my text, in English. I want you to replace my simplified A0-level words and sentences with more beautiful and elegant, upper level English words and sentences. Keep the meaning same, but make them more literary. I want you to only reply the correction, the improvements and nothing else, do not write explanations. [Specify if there’s a theme or topic for the conversation] My first sentence is “istanbulu cok seviyom burada olmak cok guzel.

Source

Limitations

Even though role-play prompting works very well on ChatGPT, it’s imperfect.

The model’s information is fixed, based on data available until 2022, when it stopped being trained. So, asking it to play the part of someone who knows what happened after 2022 would not give you true information about what’s happening now.

Also, the model can copy the style of a certain part, but they might not always be able to capture the subtleties and depth of knowledge that are unique to real people.

That’s it. These five simple steps can help you write better prompts and generate better responses from ChatGPT.

In case you want to know some additional tips, do not skip the below section.

Additional Important Tips on Writing ChatGPT Prompts

Sometimes, even the above steps could generate unexpected and unsatisfying responses.

To make sure you get the best outputs from ChatGPT, make sure you don’t skip these prompting tips:

Tip #1: Use Iterative Refinement

Instead of expecting a perfect response in one shot, interact with ChatGPT iteratively.

Ask, evaluate the response, refine your question, and ask again. Each interaction can help clarify and improve in on your desired response from ChatGPT.

For example, refer the below image and how we improved the response with every prompt:

We asked ChatGPT to explain how can we grow wheat at home, the first response was vague as you can see the below image.

ChatGPT explains how can we grow wheat

Vague ChatGPT response

The next prompt, improved the response and removed the vagueness from the output. Check the below image:

Chatgpt explained how to grow wheat in a better way now

A much better ChatGPT response

Tip #2: Set the Model’s “Mindset” Early

Begin your prompt by setting the scene or context. Let the model know the context through which you want the information filtered.

Example Prompt: "Imagine you are a historian from the 31st century looking back on the 21st century. Describe the technological advancements that defined that era."

Tip #3: Be Cautious with Hypotheticals

While ChatGPT can handle hypothetical scenarios, the more removed they are from factual or logical bases, the more unpredictable the results can be.

Grounding your hypotheticals in real-world logic or established fiction can lead to better outcomes.

Example:

Rather than asking, "How would a unicorn help in modern transportation?" consider, "If unicorns, as described in mythological texts, were real, how might they impact modern transportation?"

Tip #4: Avoid Ambiguity

Ambiguous questions can lead to ambiguous answers. If you’re interested in a particular aspect or angle of a topic, specify it in your prompt. Do not make this beginner mistake, and try to be specific with your purpose of the prompt. We have discussed this a lot of times in this post. However, ambiguity in prompts is still the most common mistake ChatGPT users make often.

Example: Instead of "Tell me about apples," ask "Discuss the nutritional benefits of consuming apples regularly."

Tip #5: Set Desired Response Length

If you’re looking for a succinct summary or a detailed exposition, specify the desired length in your prompt. This ensures you receive information at the depth you desire.

You might want your responses to be short or sometimes longer, this is the best way to make sure ChatGPT responds under your desired output length.

You can also use words like [Short, Shorter, Simple, Straightforward] to get shorter outputs from GPT and [Long, Large, Detailed, Deep, and In-Depth] to get longer responses.

Example: "Give me a brief overview of the Industrial Revolution. Make sure your response is more than 200-words or longer and well detailed."

Tip #6: Get ChatGPT Plus

For users who want to delve deeper, consider subscribing to ChatGPT Plus.

This provides additional features, including more detailed analytics and the potential to pull information from a wider web context.

ChatGPT Plus plugins

Plugins you get when you become a ChatGPT plus user.

You can get a lot of plugins and Bing search with ChatGPT plus. This makes ChatGPT a better chatbot that doesn’t have any restrictions like the information from 2022.

And We Are at The End

Woah, you read this complete post and learned to write the best prompts on your own.

Hats off to you. Make sure you save this post and share it with your friends willing to learn the skills of the future. Oh, and if you want some help, comment on your queries or contact us via our contact page.

Well, we have to take leave, but don’t worry; we have a lot of other posts that we recommend you to take a look.

These posts can help you a lot in understanding prompting, tools and more.

Did you find this article valuable?

Support Codingwithregan by becoming a sponsor. Any amount is appreciated!