Have you ever wondered what a pickle, ChatGPT, and revisiting an old job have in common? 

Believe it or not, they can teach us a thing or two about prompt engineering and make it as simple as 1, 2, 3. 

I want to share a proven method I learned as a product manager that helped me crack the code in writing great prompts and get even better answers from language learning models. Now, you might think, “Oh, great, here’s one more person selling a line of bunk that they learned from the first page of Google.” You’re right, but not in this article. This technique is what I used as a consultant teaching Fortune 1000 clients that has had years of success.

What is Prompt Engineering? 

Before we get too far, let’s talk about prompt engineering. In a nutshell, it’s the process of designing, refining, and optimizing prompts to guide AI models to generate the outputs you want. This can be as simple as asking the AI model to regenerate an answer, change the tone, include or exclude certain words, or write in a specific style. However, one of the best ways to engineer your prompts is to be specific in your ask. 

As a product manager, this was similar to writing user stories for the Design and Engineering teams. User stories were how we communicated our requests and broke down large chunks of a project into smaller, easier-to-understand pieces. Cue the light bulb, and I started to make the connection between the two. I discovered that the system we used – Gherkin (that’s the pickle) – can be applied to prompt engineering.

Wait, Gherkin? Like a pickle? 

You might be wondering, “What the heck is Gherkin?” Gherkin is a plain-text language used in behavior-driven development (BDD) to describe software features and scenarios in a structured format. Simply, it’s a framework for writing features and user stories. 

It follows a specific pattern: 

  1. As a… (the actor)
  2. I want to… (the action) 
  3. So that (the result) 

In writing user stories, Gherkin defines who is asking for the story, what they want, and what the acceptance criteria are. Here’s an example:

As a logged-in user, 

I want to click the “Add to Cart” button,

So that the item can be added to my shopping cart.

It’s pretty straightforward, right? It also makes it more specific than the request to “create an ‘Add to Cart’ button.” You have context and purpose. 

Let’s take it to an AI Prompt. 

Now, let’s see how we can use Gherkin to write prompts for AI models. We can structure our prompts using the same three key components of Gherkin: actor (who), action (what), and result (why). Here’s an example:  

1. Actor (As a…): 

   – Gherkin: As a user…

   – Prompt: As a social media manager working for a soft drink client…

2. Action (I want to…):

   – Gherkin: I want to search for products…

   – Prompt: I want to write three Instagram posts about this soft drink’s benefits…

3. Result (So that…):

   – Gherkin: So that I can find the items I need.

   – Prompt: So that I can engage our audience and increase brand awareness.

Let’s put it all together and create a prompt using the Gherkin format:

“As a social media manager working for a soft drink client, I want to write three Instagram posts about the benefits of this soft drink so that I can engage our audience and increase brand awareness.”

See how much more targeted and specific that is compared to just asking to “write three Instagram posts”? By thinking about prompts in terms of actor, action, and result, you can create clear and effective prompts that guide the AI model to give you the output you’re looking for.

A Programming Note about Prompt Engineering

Now that you have gotten a much better response by applying Gherkin principles to prompt engineering keep these tips in mind:

1. Don’t just copy and paste the response you get.  AI language models are helper tools, not replacements for your workflow. Use their output as a first draft, then edit and refine it to match your voice and needs.

2. Always fact-check and check for plagiarism in AI-generated content. The AI model doesn’t always give correct answers, so it’s your responsibility to ensure the accuracy and originality of the final output.

So, there you have it, folks! The surprising connection between pickles, AI models, and prompt engineering. Who would’ve thought these seemingly unrelated things could teach us much about writing better prompts?

The next time you’re working on a prompt for an AI model, remember the pickle and the lessons it can teach us about prompt engineering. Embrace your inner pickle, and start crafting awesome prompts today!