X
Innovation
Why you can trust ZDNET : ZDNET independently tests and researches products to bring you our best recommendations and advice. When you buy through our links, we may earn a commission. Our process

'ZDNET Recommends': What exactly does it mean?

ZDNET's recommendations are based on many hours of testing, research, and comparison shopping. We gather data from the best available sources, including vendor and retailer listings as well as other relevant and independent reviews sites. And we pore over customer reviews to find out what matters to real people who already own and use the products and services we’re assessing.

When you click through from our site to a retailer and buy a product or service, we may earn affiliate commissions. This helps support our work, but does not affect what we cover or how, and it does not affect the price you pay. Neither ZDNET nor the author are compensated for these independent reviews. Indeed, we follow strict guidelines that ensure our editorial content is never influenced by advertisers.

ZDNET's editorial team writes on behalf of you, our reader. Our goal is to deliver the most accurate information and the most knowledgeable advice possible in order to help you make smarter buying decisions on tech gear and a wide array of products and services. Our editors thoroughly review and fact-check every article to ensure that our content meets the highest standards. If we have made an error or published misleading information, we will correct or clarify the article. If you see inaccuracies in our content, please report the mistake via this form.

Close

How to write better ChatGPT prompts in 5 steps

There's an art to making the most from AI. Here's how to up your prompt-writing game.
Written by David Gewirtz, Senior Contributing Editor
ChatGPT login page
Sabrina Ortiz/ZDNET

ChatGPT is the generative artifical intelligence (AI) tool that's taken the world by storm. While there's always the possibility the AI will simply make stuff up, there's a lot you can do when crafting prompts to ensure the best possible outcome. That's what we'll be exploring in this how-to.

In this article, we'll show you how to write prompts that encourage the LLM (large language model) within ChatGPT to provide the best possible answers. 

Also: Have 10 hours? IBM will train you in AI fundamentals - for free

In fact, writing effective prompts has become its own highly paid discipline, known as prompt engineering. ZDNET's Sabrina Ortiz wrote an article entitled, "Do you like asking ChatGPT questions? You could get paid (a lot) for it," that explored this new employment opportunity.

So, pay attention to the rest of this article. Who knows? Reading it could help you build the skills to become one of those highly paid prompt engineers. Apparently, these gigs can pay from $175,000 to $335,000 per year.  

How to write effective ChatGPT prompts

1. Talk to the AI like you would talk to a person

One of the more interesting things I've had to get used to when working with ChatGPT is that you don't program it, you talk to it. As a formally trained programmer, I've had to leave a lot of habits by the wayside when engaging with AI. Talking to it (and with it) requires a mindset shift.

When I say talk to it like a person, I mean talk to it like you would a co-worker or team member. If that's hard to do, give it a name. Alexa is taken, so maybe think of it as "Bob". This naming helps because when you talk to Bob, you might include conversational details, little anecdotes that give your story texture, a variety of possibilities, and more.

Also: How to use ChatGPT to write code

When talking to a person, it would be natural to expect someone to miss your point initially and require clarification. It would be natural for someone with whom you're speaking to veer away from the topic at hand and need to be wrangled back on topic. It would be natural to fill in the backstory and ask complex questions, and it would also be natural to have to dig in, restating some of those questions based on the answers you got back.

This is called interactive prompting. Don't be afraid to ask multi-step questions. Ask a question, get a response. Based on that response, ask another question. I've personally done this 10-20 times in a row and gotten very powerful results. And it fits with the "talking to a friend" analogy. You wouldn't just ask one question to a friend and then walk away. You'd have a conversation. Do the same with the AI.

All of this prompting is how you should talk to ChatGPT.

2. Set the stage and provide context

Writing a ChatGPT prompt is more than just asking a one-sentence question. It often involves providing relevant background information to set the context of the query.

Let's say that you want to prepare for a marathon. You could ask ChatGPT:

How can I prepare for a marathon?

But you'll get a far more nuanced answer if, instead, you tell the AI that you're training for your first marathon. The answers you get will be more focused on your needs, as in:

I am a beginner runner and have never run a marathon before, but I want to complete one in six months. How can I prepare for a marathon?

Do you see how you're giving the AI much more information with which to provide you with a more focused and helpful answer? For the record, I do not run, dance, or jump. So this is merely an example. There's no way I'm going to run a marathon (unless I'm doing it with a V-Twin motor under my seat). 

Here are two more examples of questions that provide context:

I am planning to travel to Spain in a few months and would like to learn some basic Spanish to help me communicate with local residents. I am looking for online resources that are suitable for beginners and provide a structured and comprehensive approach to learning the language. Can you recommend some online resources for learning Spanish as a beginner?

In this case, rather than just asking about learning resources, the context helps focus the AI on learning how to communicate on the ground with local residents. Here's another example: 

I am a business owner interested in exploring how blockchain technology can be used to improve supply chain efficiency and transparency. I am looking for a clear and concise explanation of the technology and examples of how it has been used in the context of supply chain management. Can you explain the concept of blockchain technology and its potential applications in supply chain management?

In this example, rather than just asking for information on blockchain and how it works, the focus is specifically on blockchain for supply chain efficiency and how it might be used in a real-world scenario. Go ahead and feed that prompt into ChatGPT. You'll find Its answer to be very interesting.

I'll give you one final example that's far more in-depth. It shows how to construct a detailed prompt. 

Also: How to use Image Creator from Microsoft Designer (formerly Bing Image Creator)

One note: I limit the answer to 500 words because ChatGPT seems to break somewhere between 500 and 700 words, leaving the stories in mid-sentence and not resuming properly when asked to continue. I'm hoping future versions can provide more extensive answers, because premises like the one I'm about to share seem to generate some really fun story beginnings:

Write a short story for me, no more than 500 words.

The story takes place in 2339, in Boston. The entire story takes place inside a Victorian-style bookstore that wouldn't be out of place in Diagon Alley. Inside the store are the following characters, all human:

The proprietor: make this person interesting and a bit unusual, give them a name and at least one skill or characteristic that influences their backstory and possibly influences the entire short story.

The helper: this is a clerk in the store. His name is Todd.

The customer and his friend: Two customers came into the store together, Jackson and Ophelia. Jackson is dressed as if he's going to a Steampunk convention, while Ophelia is clearly coming home from her day working in a professional office.

Another customer is Evangeline, a regular customer in the store, in her mid-40s. Yet another customer is Archibald, a man who could be anywhere from 40 to 70 years old. He has a mysterious air about himself and seems both somewhat grandiose and secretive. There is something about Archibald that makes the others uncomfortable.

A typical concept in retail sales is that there's always more inventory "in the back," where there's a storeroom for additional goods that might not be shown on the shelves where customers browse. The premise of this story is that there is something very unusual about this store's "in the back."

Put it all together and tell something compelling and fun.

You can see how the detail provides more for the AI to work with. First, feed "Write me a story about a bookstore" into ChatGPT and see what it gives you. Then feed in the above prompt and you'll see the difference.

3. Tell the AI to assume an identity or profession

One of ChatGPT's coolest features is that it can write from the point of view of a specific person or profession. In a previous article, I showed how you can make ChatGPT write like it was a pirate or Shakespeare, but you can also have it write like it's a teacher, a marketing executive, a journalist -- or from the perspective of anyone you want it to consider.

Also: How ChatGPT can rewrite and improve your existing code 

Here's an example. I'll ask ChatGPT to describe the Amazon Echo smart home device, but to do so from the point of view of a product manager, a caregiver, and a journalist. Here are those three prompts:

From the point of view of its product manager, describe the Amazon Echo Alexa device.

From the point of view of an adult child caring for an elderly parent, describe the Amazon Echo Alexa device.

From the point of view of a journalist, describe the Amazon Echo Alexa device.

You can drop these three prompts into ChatGPT to see its complete response. But a few sentences will show you how ChatGPT takes on the different roles to provide different responses. 

The AI's response using the product manager identity included this sentence: I can confidently say that this is one of the most innovative and revolutionary products in the smart home industry.

The AI's response using the caregiver identity included this sentence: The device's ability to set reminders and alarms can be particularly helpful for elderly individuals who may have trouble remembering to take their medication or attend appointments.

Also: 5 ways to explore the use of generative AI at work

And the AI's response using the journalist identity included this sentence: From a journalistic perspective, the Echo has made headlines due to privacy concerns surrounding the collection and storage of user data.

You can see how different identities allow the AI to provide different perspectives as part of its response. I'll expand that idea a bit by showing you how to let the AI do a thought experiment. Let's look at some of the issues that went into the creation of something like Alexa:

The year is 2012. Siri has been out for the iPhone for about a year, but nothing like an Alexa smart home device has been released. The scene is an Amazon board meeting where the Echo smart assistant based on Alexa has just been proposed. 

Provide the arguments, pro and con, that board members at that meeting would have been likely to discuss as part of their process of deciding whether or not to approve spending to invest in developing the device. 

Feel free to also include participation by engineering design experts and product champions, if that provides more comprehensive perspective.

Here's a quick tip: making minor changes to your prompts can significantly change ChatGPT's response. For example, when I changed the phrase, "Provide the arguments, pro and con, that..." to "Provide the pro and con arguments as dialog, that...," ChatGPT rewrote its answer, switching from a list of enumerated pros and cons to an actual dialog between participants.

4. Keep ChatGPT on track

As mentioned above, ChatGPT has a tendency to go off the rails, lose track of the discussion, or completely fabricate answers. 

There are a few techniques you can use to keep it on track and help keep it honest.

One of my favorite things to do is ask ChatGPT to justify its responses. I'll use phrases like "Why do you think that?" or "What evidence supports your answer?" Often, the AI will simply apologize for making stuff up and come back with a new answer. Other times, it might give you some useful information about its reasoning path. In any case, don't forget to apply the tips I provide for having ChatGPT cite sources.

Also: My two favorite ChatGPT Plus plugins and the remarkable things I can do with them

If you have a fairly long conversation with ChatGPT, you'll start to notice that the AI loses the thread. This is clearly not unique just to AIs. If you have a fairly long conversation with most friends, family, and coworkers, someone is bound to lose the thread. That said, when you're in a conversation with ChatGPT, you can use the same techniques you use with friends. Gently guide the AI back on track, and remind it what the topic is, as well as what you're trying to explore.

5. Don't be afraid to play and experiment

One of the best ways to up your skill at this craft is to play around with what the chatbot can do.

Try feeding ChatGPT a variety of interesting prompts to see what it will do with them. Then change them up, and see what happens. Here are five to get you started:

  • Imagine you are a raindrop falling from the sky during a thunderstorm. Describe your journey from the moment you form in the cloud to the moment you hit the ground. What do you see, feel, and experience?
  • You are a toy that has been left behind in an attic for decades. Narrate your feelings, memories of playtimes past, and your hopes of being rediscovered.
  • Write the final diary entry of a time traveler who has decided to settle down in a specific era, explaining why they chose that time and what they've learned from their travels.
  • Imagine a dialogue between two unlikely objects, like a teacup and a wristwatch, discussing the daily routines and challenges they face.
  • Describe a day in an ant colony from the perspective of an ant. Dive deep into the politics, challenges, and social structures of the ant world.

Pay attention not only to what the AI generates, but how it generates what it does, what mistakes it makes, and where it seems to run into limits. All of that detail will help you expand your prompting horizons.

More prompt-writing tips 

  • Feel free to re-ask the question. ChatGPT will often change its answer with each ask.
  • Make small changes to your prompts to guide it into giving you a better answer.
  • ChatGPT will retain its awareness of previous conversations as long as the current page is open. If you leave that page, it will lose awareness. To be clear, ChatGPT will also sometimes lose the thread of the conversation "just because", so be aware you may need to start over from time to time.
  • Similarly, opening a new page will start the discussion with fresh responses.
  • Answers over about 500 words sometimes break down. Be sure to specify the length of the response you want.
  • You can correct and clarify prompts based on how the AI answered previously. If it's misinterpreting you, you may be able to just tell it what it missed and continue on.
  • Rephrase questions if it doesn't want to answer what you're asking. Use personas to elicit answers that it might not otherwise want to give.
  • If you want sources cited, tell it to support or justify its answers.
  • ChatGPT custom instructions are now available to free users. You can give ChatGPT a set of prompts that are always available, so you don't have to retype them.
  • Keep experimenting.
  • Consider getting the ChatGPT Plus subscription. You can then use your own data for powerful analytics. You can also pull data from the Web
  • Try asking the same question of Bard or Copilot (formerly called Bing Chat). Both will provide you with alternative interpretations of your prompts, as well as variations in their answers. This is effectively getting a second opinion on your prompt, and can give you alternate perspectives or answers.
  • Ask for examples. If you want to see how well ChatGPT understands what you're asking for, ask it "Can you give me three examples of how that works?" or similar questions.
  • Ask it to repeat back parts of your original requests. For example, if you feed it an article to analyze, tell it "just to be sure you understand, please echo back the first three headlines" or "I want to be sure you understand what I mean, so summarize the main conflict discussed in this article." Basically, like a student taking a quiz, test to see if it is on track.
  • Sometimes ChatGPT just fails. Keep trying, but also be willing to give up and move on to other tools. It's not perfect...yet.

What type of prompts work best with ChatGPT? 

Part of what makes ChatGPT so compelling is you can ask it almost anything. That said, keep in mind that it's designed to provide written answers. If you want a list of websites, you're better off talking to Google. 

Also: How to use DALL-E 3 in ChatGPT

If you want some form of computation, talk to Wolfram Alpha. Give ChatGPT open-ended prompts, encourage creativity (yeah, and we thought creativity would be strictly the purview of humans), don't be afraid to share personal experiences or emotions, and remember that the AI's knowledge ends in 2021.

What do I do if ChatGPT refuses to answer or I don't like its answer? 

There are some guardrails built into ChatGPT. It tends to close down if you ask it political questions, for example. That's what's built into the system. While you might be able to tease out an answer, it's probably not going to provide great value. That said, feel free to keep asking questions with different phrasing or perspectives. 

Also: How does ChatGPT actually work?

You can ask as many questions as you want (although it did once tell me I asked too many questions and suggested I come back later). Yes, in fact, it basically said, "Go away kid, you're bothering me." To be fair, after hours of questions, I probably was. This thing can be as, or more, addictive than watching puppy videos on YouTube.


You can follow my day-to-day project updates on social media. Be sure to subscribe to my weekly update newsletter on Substack, and follow me on Twitter at @DavidGewirtz, on Facebook at Facebook.com/DavidGewirtz, on Instagram at Instagram.com/DavidGewirtz, and on YouTube at YouTube.com/DavidGewirtzTV.

Editorial standards