2-Minute Hack to High-Quality Prompts

Simplest Guide to 'Prompt Engineering'

If you're new to ChatGPT, creating high-quality prompts might seem scary.

But, it doesn't have to be!

The trick is to use ChatGPT as your personal prompt engineer.

For technical or advanced users, there are additional tools and workflows to refine your prompts, but Iā€™ll start with the basics.

The inspiration for this guide came from a TikTok video I posted last night, asking people what ChatGPT prompts they want.

I received dozens of requests overnight, including:

  • Prompts for academic writing

  • Prompts to write a detail business plan

  • Prompts to create a standard operating procedure

  • Prompts for project management focused on civil or construction

And, many more!

But, one thing stood out:

Many people already know what they wantā€¦ they just need a little guidance on how to create effective ChatGPT prompts to get going.

So, Iā€™m going to show you how to make high-quality prompts using ChatGPT.

You wonā€™t have to pay for $10k prompt engineering courses ā€” ripoff!

You wonā€™t have to pay $200 for a bundle of premade prompts ā€” ripoff!

Instead, make your own personalized optimized prompts for freešŸ˜

Hereā€™s the Youtube version of this post:

What type of content do you like best?

Your vote helps me prioritize what content I should make next!

Login or Subscribe to participate in polls.

Let's dive into a real example.

I chose one of the prompt requests I received:

TikTok @sabrina_ramonov

Our objective is to make an effective ChatGPT prompt that takes a software specification (aka ā€œspecā€) and creates software test cases from the spec.

Step 1: Let ChatGPT Think About the Problem and Tasks

First, I give ChatGPT a relevant identity:

ā€œYou are a senior software engineer.ā€

Next, I tell ChatGPT what I want it to do:

ā€œYouā€™ve been tasked with understanding a software spec, writing test cases based on the spec, and writing code for each test case.ā€

Then, I ask ChatGPT to explain in detail how it would approach these tasks.

ā€œList out step-by-step how you would approach this problem.ā€œ

At the end of the prompt, I add a technique called Chain-of-Thought, which helps ChatGPT produce better answers:

ā€œTake a deep breath and think through it step-by-stepā€.

Hereā€™s the full ChatGPT prompt:

You are a senior software engineer. You've been tasked with understanding a software spec, writing test cases based on the spec, and writing code for each test case. List out step-by-step how you would approach this problem. Take a deep breath and think through it step-by-step.

All Iā€™m doing is giving ChatGPT a little context, explaining what tasks I want ChatGPT to do, and asking ChatGPT how it would approach the tasks.

Step 2: Review ChatGPTā€™s Answer

ChatGPT will provide a detailed explanation of the steps involved in writing test cases, including preconditions, actual results, and different types of testing like unit tests and integration tests.

The initial output may include steps we donā€™t need, or it may be missing steps that are important.

But, that's okay!

You can always trim, edit, add.

Thatā€™s the fun part - experimenting with prompts to get better answers.

Here is ChatGPTā€™s detailed breakdown of how itā€™d approach the problem of writing test cases from a given software spec:

Sabrina Ramonov @ sabrina.dev

Sabrina Ramonov @ sabrina.dev

Great answer, thanks ChatGPT!

The screenshots above show the most useful parts of ChatGPTā€™s answer.

I truncated the rest. You can view the full answer in my Youtube video.

Next, weā€™re going to take ChatGPTā€™s answer, and weā€™re going to ask ChatGPT to generate a high-quality effective prompt for us.

Step 3: Use Custom GPT to Make Prompts

First, letā€™s install a custom GPT for prompt engineering:

  • go to ChatGPTā€™s GPT store

  • type ā€œpromptā€

  • select one of the options

I like the first option, Prompt Engineer, because itā€™s free and has many users.

Start a new chat with the Prompt Engineer GPT.

Iā€™m going to ask the GPT to write a prompt that takes a software spec and writes test cases.

And, Iā€™m going to paste the output from the previous step.

This ensures the final prompt incorporates ChatGPTā€™s step-by-step plan to approach the problem of writing tests cases from a spec.

Hereā€™s the prompt we feed into Prompt Engineer GPT:

Build a new prompt from scratch that takes a software spec, a programming language, and writes test cases. The prompt should cover all these steps and best practices for writing test cases given a spec:

{{PASTE OUTPUT FROM PREVIOUS STEP}}

Important: remember to paste the output from the previous step!

And, hereā€™s the prompt generated by Prompt Engineer GPT:

You are provided with a software specification document and a programming language to use. Follow these steps to create detailed test cases and implement them in the given programming language:

1. Understand the Software Specification:
   - Read the spec thoroughly.
   - Identify main features, functionalities, and requirements.
   - Highlight input/output requirements, constraints, edge cases, and expected behaviors.
   - Create a glossary of technical terms.
   - Identify and clarify any ambiguities.
   - Break down the requirements into manageable components.

2. Write Test Cases:
   - Identify test scenarios, including normal and edge cases.
   - Create a test plan covering all scenarios.
   - Write detailed test cases including ID, description, pre-conditions, steps, expected results, and priority.
   - Use test case management tools to document the test cases.
   - Review and refine the test cases with peers.

3. Write Code for Each Test Case:
   - Set up the development environment with necessary tools and version control.
   - Follow coding standards.
   - Start with simple test cases and implement basic functionality.
   - Implement and test incrementally, using a TDD approach.
   - Write unit tests using appropriate frameworks.
   - Perform integration testing.
   - Refactor and optimize the code.
   - Document the code thoroughly.
   - Conduct peer reviews and additional testing to ensure quality.

Step 4: Test and Iterate

Before testing the prompt, I tweak it.

I remove steps ChatGPT cannot accomplish, such as:

  • Review and refine the test cases with peers

  • Use test case management tools to document the test cases.

  • Conduct peer reviews and additional testing to ensure quality.

  • Set up the development environment with necessary tools and version control.

Now, take the prompt generated by the Prompt Engineer GPT and test it with a sample software spec.

Hereā€™s a sample software spec I found online.

Feed the sample software spec into ChatGPT along with our updated prompt.

INPUT

And now, letā€™s see what ChatGPT generates! šŸ‘‡ļø

Yay, nice work, ChatGPT! šŸ„³

ChatGPT successfully analyzed a software spec and produced test cases, including the description, pre-conditions, steps, expected results, and priority for each test case. It also made a ā€œskeleton code outlineā€ for the test suite.

Certainly, the test suite needs more work, but keep in mind ChatGPT did not have access to any code. It created the test cases purely from the given software spec and input programming language (e.g. python).

Closing the loop, we have:

  • used ChatGPT to create a detailed plan to solve a specific task

  • used Prompt Engineer GPT to create a high-quality prompt, incorporating the detailed plan from the previous step

  • tested our ChatGPT-generated prompt on a realistic software spec

  • confirmed our prompt works well!

Now, the fun continues ā€” how would you improve this prompt further?

What would you add, remove, or edit?

[ADVANCED] Anthropic & Fabric

For technical or advanced users, hereā€™s my personal prompt creation workflow.

Itā€™s simple.

I use Anthropic's Prompt Generator and describe the following:

  • prompt inputs

  • prompt outputs

  • task details (include as much info as possible)

Anthropic's Prompt Generator automatically breaks down the task into detailed steps and formats the input variables clearly via XML tags, making it easier for ChatGPT to understand and execute the task.

Then, I feed in the Anthropic-generated prompt into Fabricā€™s improve_prompt pattern, which applies numerous ā€œtacticsā€ (i.e. prompt engineering techniques) to further enhance the prompt.

Last Thoughts

Creating awesome prompts with ChatGPT is straightforward once you get the hang of it.

Start by letting ChatGPT think through your desired task, refine its output, then feed it into a custom prompt engineering GPT to write your prompt. Test the prompt with real examples and iterate until youā€™re happy!

For non-technical users, sticking to ChatGPT is sufficient. As you gain experience, you'll get better at writing prompts to get better answers.

For advanced users, tools like Anthropic's Prompt Generator and open-source frameworks like Fabric will take your prompting to the next level.

Most importantly ā€”

Enjoy the process!

In my humble opinion, the right attitude is to ā€œPlay with AIā€.

Did I miss anything?

Have ideas or suggestions?

Message me on LinkedInšŸ‘‹

Sabrina Ramonov

P.S. If youā€™re enjoying my free newsletter, itā€™d mean the world to me if you share it with others. My newsletter just launched, every single referral helps. Thank you!