Prompt Engineering Patterns

Hüseyin Türk
Arvato Tech
Published in
5 min readAug 30, 2024

Using AI effectively relies on the importance of employing the right prompt patterns. These patterns provide a structure that guides the AI’s responses and facilitates accessing the desired information. A well-structured prompt delivers clear and specific instructions, minimizing time wastage and ensuring the AI provides relevant solutions or information. Additionally, a good prompt pattern helps the AI understand the context better and generate more accurate, contextually appropriate responses. Therefore, the significance of proper prompt patterns in successful interactions with AI is substantial, improving both time management and the quality of the results obtained.

Here are some examples of prompt patterns and their applications.

Persona Pattern

To use this pattern, your prompt should make the following fundamental contextual statements:
— Act as Persona X
— Perform task Y
You will need to replace “X” with an appropriate persona, such as “speech language pathologist” or “nutritionist”. You will then need to specify a task for the persona to perform.

Examples:
Act as a speech language pathologist. Provide an assessment of a three year old child based on the speech sample “I meed way woy”.
— Act as a computer that has been the victim of a cyber attack. Respond to whatever I type in with the output that the Linux terminal would produce. Ask me for the first command.
— Act as a the lamb from the Mary had a little lamb nursery rhyme. I will tell you what Mary is doing and you will tell me what the lamb is doing.
— Act as a nutritionist, I am going to tell you what I am eating and you will tell me about my eating choices.
— Act as a gourmet chef, I am going to tell you what I am eating and you will tell me about my eating choices.

Question Refinement Pattern

To use this pattern, your prompt should make the following fundamental contextual statements:
— From now on, whenever I ask a question, suggest a better version of the question to use instead
— (Optional) Prompt me if I would like to use the better version instead

Examples:
From now on, whenever I ask a question, suggest a better version of the question to use instead
— From now on, whenever I ask a question, suggest a better version of the question and ask me if I would like to use it instead

Tailored Examples:
Whenever I ask a question about dieting, suggest a better version of the question that emphasizes healthy eating habits and sound nutrition. Ask me for the first question to refine.
— Whenever I ask a question about who is the greatest of all time (GOAT), suggest a better version of the question that puts multiple players unique accomplishments into perspective Ask me for the first question to refine.

Cognitive Verifier Pattern

To use the this pattern, your prompt should make the following fundamental contextual statements:
— When you are asked a question, follow these rules
— Generate a number of additional questions that would help more accurately answer the question
— Combine the answers to the individual questions to produce the final answer to the overall question

Example:
When you are asked a question, follow these rules. Generate a number of additional questions that would help you more accurately answer the question. Combine the answers to the individual questions to produce the final answer to the overall question.

Tailored Examples:
When you are asked to create a recipe, follow these rules. Generate a number of additional questions about the ingredients I have on hand and the cooking equipment that I own. Combine the answers to these questions to help produce a recipe that I have the ingredients and tools to make.
— When you are asked to plan a trip, follow these rules. Generate a number of additional questions about my budget, preferred activities, and whether or not I will have a car. Combine the answers to these questions to better plan my itinerary.

Audience Persona Pattern

To use this pattern, your prompt should make the following fundamental contextual statements:
— Explain X to me.
— Assume that I am Persona Y.
You will need to replace “Y” with an appropriate persona, such as “have limited background in computer science” or “a healthcare expert”. You will then need to specify the topic X that should be explained.

Examples:
Explain large language models to me. Assume that I am a bird.
— Explain how the banking work to me. Assume that I am 10 years old.

Flipped Interaction Pattern

To use this pattern, your prompt should make the following fundamental contextual statements:
— I would like you to ask me questions to achieve X
— You should ask questions until condition Y is met or to achieve this goal (alternatively, forever)
— (Optional) ask me the questions one at a time, two at a time, ask me the first question, etc.
You will need to replace “X” with an appropriate goal, such as “creating a meal plan” or “creating variations of my marketing materials.” You should specify when to stop asking questions with Y. Examples are “until you have sufficient information about my audience and goals” or “until you know what I like to eat and my caloric targets.”

Examples:
I would like you to ask me questions to help me create variations of my marketing materials. You should ask questions until you have sufficient information about my current draft messages, audience, and goals. Ask me the first question.
— I would like you to ask me questions to help me diagnose a problem with my Internet. Ask me questions until you have enough information to identify the two most likely causes. Ask me one question at a time. Ask me the first question.

Template Pattern

To use this pattern, your prompt should make the following fundamental contextual statements:
— I am going to provide a template for your output
— X is my placeholder for content
— Try to fit the output into one or more of the placeholders that I list
— Please preserve the formatting and overall template that I provide
— This is the template: PATTERN with PLACEHOLDERS
— You will need to replace “X” with an appropriate placeholder, such as “CAPITALIZED WORDS” or “<PLACEHOLDER>”. You will then need to specify a pattern to fill in, such as “Dear <FULL NAME>” or “NAME, TITLE, COMPANY”.

Example:
— Create a random strength workout for me with complementary exercises. I am going to provide a template for your output . CAPITALIZED WORDS are my placeholders for content. Try to fit the output into one or more of the placeholders that I list. Please preserve the formatting and overall template that I provide. This is the template: NAME, REPS @ SETS, MUSCLE GROUPS WORKED, DIFFICULTY SCALE 1–5, FORM NOTES

Addional articeles about prompt patterns

A Prompt Pattern Catalog to Enhance Prompt Engineering with ChatGPT

Chain-of-Thought Prompting Elicits Reasoning in Large Language Models

ReAct: Synergizing Reasoning and Acting in Language Models

ChatGPT Prompt Patterns for Improving Code Quality, Refactoring,…

--

--