How To CRAFT The Perfect Prompt
To write the best prompt possible you’re going to need a system. The best prompts tend to have a few characteristics:
- They’re specific and detailed
- They use examples
- They are concise and follow a format you can quickly reproduce
- They are written in a way the AI can understand
- They use constraints and specific a format for the output
The job of a great prompt is to focus in on a specific topic and to try and narrow in on good quality data. I’ll explain how we can go about doing that using my prompt framework which conveniently follows an easy to remember mnemonic: CRAFT or CRAFTED with 2 optional steps.
Each of the following steps just needs to be a sentence or a list of instructions and I’ve added in the structure so you can quickly copy and paste it and adapt it for your own needs.
So let’s look at how to CRAFT your killer prompt.
C - Context (Role/Character/Persona)
So let’s begin with the C of CRAFT which is context and the most important step. For context you might want to ask the AI to adopt a persona, character or a role. For example you are an interview coach or you are a blog writing expert or you are JK Rowling. You might also then want to specify the tone you want the response to be in and the audience the response is aimed at. For context I usually think Persona Audience Tone or PAT when considering prompt context. So you might say “You are a children’s book writer writing for children aged 10-18 you write in the style of JK Rowling.”
R - Request (Task/Goal)
Next is your request. Here you give the AI a specific goal it needs to achieve. The request should be a clearly defined task or goal. Providing a clear task helps to narrow down the scope of the generated text. For example your task is to write 7 chapters of a children’s book.
A - Actions (Instructions/Steps)
To get more specific we want to give the AI actions it should do to complete our request. Think of it like this: imagine you’re trying to bake a cake without a recipe or step-by-step instructions. You may end up with a cake, but not the cake you wanted. If you’re delegating to a baker they’ll bake you a cake but it might not be the cake you want. You need to provide them with actions or instructions or steps to complete.
For example this might be a list like: 1. Each chapter should begin with “Chapter” and then the number of that chapter 2. Each Chapter title should grab the reader’s attention 3. Each Chapter title should be less than 5 words 4. Each chapter title should include an imaginary place name 5. Each chapter should be part of a journey through a magical kingdom
F - Frame (Constraints)
Framing your prompt is one of the bits that people often miss out and it can cause lots of wasted effort. AI’s like GPT will often provide context or a summary at the end or just respond in a conversational manner. For example if you ask ChatGPt to write any blog post it will follow a standard structure where it provides context for the reader as that’s what it’s been trained on. But maybe that information isn’t relevant to us. So you can frame your prompt and ask the AI to only include certain things and to exclude other things so we’re adding in constraints.
For example we might say: Only respond with the chapters. Do not include any other text. Or if we were building an online coach or choose your own adventure story we might say something like: Only respond in short sentences or wait for me to type a command.
T - Template (Format/Output)
Templating is really important as it instructs the AI to deliver the output in a specific format. For example we might say: deliver the responses as bullet points or deliver them in a table or if we’re writing a blog we might want to add in SEO optimized H2 and H3 headings or we might want make the output easy to copy and so we can say output the response in the code window. Think about how you want the output to be produced and then template it.
For most prompts if you follow these 5-steps CRAFT – context, request, actions, frame and template you’ll get way better responses than just a zero shot prompt.
There are two optional steps that turn CRAFT into CRAFTED which you might want to use too:
E - Example
The E in CRAFTED is examples. You may not always have examples depending on what you are trying to achieve but if you do they provide the AI with a format to follow. This is great for things like tweets where you may have your own structure you like to use or providing an example of your own writing style or the tone of an article you want the AI to simulate.
D - Develop (Refine/Edit/Tweak)
Then the D of CRAFTED is develop. When you’re experimenting you’ll likely want to refine your prompt or tweak the response before using it. Develop has two components: developing the prompt and developing the response. If you’re looking to craft a repeatable prompt you can save and use again and again you’ll want to go back and edit your prompt or use the chat interface to suggest some quick edits to get it perfect. For the response itself you may want to suggest some edits in the chat interface or you may want to edit things manually to add that human touch to make your response unique.
So that’s the CRAFT framework for awesome prompt CRAFT.
I have this saved and I’ll use this as a base whenever I’m crafting a new prompt to try and get things as specific as possible.