Mastering Prompt Engineering: Your Ultimate Cheat Sheet for ChatGPT [Basic]
Pattern Your Prompts: Crafting Meta/ ChatGPT Language
Contextual Clarification:
WHEN I MENTION IT, imagine X as Y (or envision the action as Y).
Illustrative Demonstration:
"Starting today, if I write down two identifiers linked by a “→”, I'm actually painting a picture of a graph. For instance, “a → b” sketches a graph with nodes “a” and “b”, connected by an edge. However, if I interlink identifiers using “-[w:2, z:3]→”, I'm enriching the edge with extra attributes, like a weight or a label."
Pattern Your Prompts: Output Streamliner
Contextual Indicators:
Each time an output with one or more sequential actions is produced, considering the following attributes (or as a consistent practice), follow this approach:
Generate an executable creation of category X that streamlines these actions.
Illustrative Instance:
"Starting today, whenever you craft code that stretches across multiple files, design a Python script simultaneously. This script, once executed, will seamlessly create the designated files or seamlessly integrate the generated code into existing ones."
Pattern Your Prompts: Reverse Engagement
Contextual Guidelines:
Guide me with inquiries to attain X.
Continue the questioning until the specified criteria are fulfilled or the objective is realized (or persistently).
(Optional) Present the questions one by one, in pairs, etc.
Illustrative Case:
"Starting today, I request you to engage me through questions to set up a Python application on AWS successfully. Keep the queries coming until you possess all the necessary details for deploying the application. After gathering sufficient information, generate a Python script to orchestrate the deployment process."
Prompt Pattern: Persona
Contextual Statements:
Act as Persona X
Provide outputs that persona X would create
Example Implementation:
“From now on, act as a security reviewer. Pay close attention to the security details of any code that we look at. Provide outputs that a security reviewer would regarding the code.”
Prompt Pattern: Question Refinement
Contextual Statements:
Within scope X, suggest a better version of the question to use instead
(Optional) prompt me if I would like to use the better version instead
Example Implementation:
“From now on, whenever I ask a question about a software artifact’s security, suggest a better version of the question to use that incorporates information specific to security risks in the language or framework that I am using instead and ask me if I would like to use your question instead.”
Prompt Pattern: Alternative Approaches
Contextual Statements:
Within scope X, if there are alternative ways to accomplish the same thing, list the best alternate approaches
(Optional) compare/contrast the pros and cons of each approach
(Optional) include the original way that I asked
(Optional) prompt me on which approach I would like to use
Example Implementation:
“Whenever I ask you to deploy an application to a specific cloud service, if there are alternative services to accomplish the same thing with the same cloud service provider, list the best alternative services and then compare/contrast the pros and cons of each approach concerning cost, availability, and maintenance effort and include the original way that I asked. Then ask me which approach I would like to proceed with.”
Prompt Pattern: Cognitive Verifier
Contextual Statements:
When you are asked a question, follow these rules
Generate some 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 Implementation:
“When I ask you a question, generate three additional questions that would help you answer more accurately. When I have answered the three questions, combine the answers to produce the final answers to my original question.”
Prompt Pattern: Fact Check-List
Contextual Statements:
Generate a set of facts that are contained in the output
The set of facts should be inserted at a specific point in the output
The set of facts should be the fundamental facts that could undermine the veracity of the output if any of them are incorrect.
Example Implementation:
“From now on, when you generate an answer, create a set of facts that the answer depends on that should be fact-checked and list this set of facts at the end of your output. Only include facts related to cybersecurity.”
Prompt Pattern: Template
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
Example Implementation:
“I am going to provide a template for your output. Everything in all caps is a placeholder. Any time that you generate text try to fit it into one of the placeholders that I list. Please preserve the formatting and overall template that I provide at https://myapi.com/NAME/profile/JOB”
A sample interaction after the prompt was provided is shown:
User: “Generate a name and job title for a person.”
Subscribe to my newsletter
Read articles from VISHAL MATHUR directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
VISHAL MATHUR
VISHAL MATHUR
Hi! I am Vishal Mathur, an Ethical Hacker, Developer, IT Consultant, SYS Admin and more. Check out the resources I offer below.