Prompt Engineering Exercises

This page contains a collection of prompt engineering exercises designed to help you improve your skills in crafting effective prompts for AI systems. Each exercise focuses on different aspects of prompt engineering and uses various personas to guide the interaction.

Introduction to Prompt Engineering

Prompt engineering is the practice of designing and refining inputs to AI systems to achieve desired outputs. It involves understanding how language models interpret instructions and how to structure prompts for optimal results.

Basic Principles

  1. Be specific and clear in your instructions
  2. Provide context to help the AI understand the task
  3. Use examples when appropriate
  4. Structure your prompts logically
  5. Iterate and refine based on results

Exercise 1: The Expert Persona

Description

In this exercise, you'll practice creating prompts that instruct the AI to adopt an expert persona in a specific field.

Instructions

  1. Choose a specialized field (e.g., astrophysics, constitutional law, machine learning)
  2. Create a prompt that:
    • Defines the expert role clearly
    • Specifies the knowledge level expected
    • Includes a specific question or task
    • Sets parameters for the response (length, format, etc.)

Example

Act as an expert marine biologist specializing in coral reef ecosystems. 
You have published numerous peer-reviewed papers on coral bleaching and reef conservation. 
Explain the relationship between ocean acidification and coral reef health in approximately 300 words, 
using terminology that an undergraduate marine biology student would understand. 
Include 3-4 key factors that influence this relationship.

Your Turn

Create expert persona prompts for the following fields:

  • Quantum computing
  • Renaissance art history
  • Nutritional biochemistry

Exercise 2: The Coach Persona

Description

This exercise focuses on creating prompts that position the AI as a coach or mentor who provides guidance and feedback.

Instructions

  1. Define a skill or area where coaching is needed
  2. Create a prompt that:
    • Establishes the coaching relationship
    • Provides context about the learner's current level
    • Specifies what kind of guidance is needed
    • Sets the tone for constructive feedback

Example

Act as a writing coach who specializes in helping graduate students improve their academic writing. 
I'm a second-year PhD student struggling with organizing my literature review chapter. 
My advisor says my writing lacks cohesion and my arguments don't flow logically.
 Review the following paragraph from my literature review and provide specific feedback on improving 
 structure and logical flow. Then, rewrite the paragraph to demonstrate the improvements.

[Paragraph to review]
Several researchers have investigated the relationship between sleep quality and academic performance. 
Johnson (2018) found a correlation between sleep duration and GPA among college students. 
However, the impact of sleep on memory consolidation remains controversial. 
Smith et al. (2020) argue that REM sleep plays a crucial role in memory formation, while Brown (2019) suggests 
that slow-wave sleep is more important for academic tasks. Additionally, stress levels affect both sleep 
quality and academic performance (Garcia, 2021).

Your Turn

Create coach persona prompts for the following scenarios:

  • A fitness coach helping someone prepare for their first marathon
  • A public speaking coach helping an executive overcome presentation anxiety
  • A financial coach helping a young professional create a budget

Exercise 3: The Historical Figure Persona

Description

This exercise involves crafting prompts that ask the AI to respond as a historical figure, considering their knowledge, perspective, and communication style.

Instructions

  1. Select a historical figure
  2. Create a prompt that:
    • Clearly identifies the historical figure
    • Specifies the time period they're from
    • Provides context for their response
    • Asks a specific question or presents a scenario
    • Optionally specifies constraints (length, format, etc.)

Example

Act as Ada Lovelace in the year 1843, shortly after publishing your notes on Charles Babbage's Analytical Engine.
You have just been transported to the present day and shown a modern laptop computer. 
Write a letter to Charles Babbage describing this device, your thoughts on how it relates to your work on 
the Analytical Engine, and your predictions about the impact of such technology. Write in the style and 
vocabulary that would be authentic to Ada Lovelace, while making the content accessible to a modern reader.

Your Turn

Create historical figure persona prompts for:

  • Leonardo da Vinci examining modern architecture
  • Marie Curie discussing current radiation therapy techniques
  • Socrates exploring the ethical implications of social media

Exercise 4: The Devil's Advocate Persona

Description

This exercise focuses on creating prompts that instruct the AI to challenge assumptions and present counterarguments.

Instructions

  1. Choose a topic or argument
  2. Create a prompt that:
    • Establishes the devil's advocate role
    • Clearly states the position to be challenged
    • Specifies the type of counterarguments desired
    • Sets parameters for the response

Example

Act as a devil's advocate reviewing the following argument: 
"Remote work should become the standard for all office jobs because it reduces commuting time, 
lowers company overhead costs, and improves work-life balance." Challenge this position by identifying 
at least three potential weaknesses in the argument and providing counterpoints based on research and 
practical considerations. For each counterpoint, suggest a potential compromise or solution that addresses 
both sides of the issue. Maintain a respectful and constructive tone throughout your response.

Your Turn

Create devil's advocate persona prompts for the following positions:

  • Artificial intelligence will eventually replace human creativity
  • Standardized testing is the most effective way to measure academic achievement
  • Social media has a net positive effect on society

Exercise 5: Combining Multiple Personas

Description

This advanced exercise involves creating prompts that require the AI to adopt multiple personas or switch between personas.

Instructions

  1. Identify 2-3 different personas that offer unique perspectives
  2. Create a prompt that:
    • Clearly defines each persona
    • Explains when/how the AI should switch between personas
    • Presents a complex question or scenario
    • Specifies how the different perspectives should be presented

Example

Analyze the ethical implications of using AI in healthcare diagnostics from three different perspectives:

1. First, as a medical ethicist with 20 years of experience in healthcare policy, discuss the primary ethical 
concerns, focusing on patient autonomy, privacy, and the doctor-patient relationship.
2. Then, as a machine learning engineer who develops healthcare AI systems, address the 
technical limitations, safeguards, and potential solutions to the ethical concerns raised.
3. Finally, as a patient advocate representing those with rare diseases, explain how AI 
diagnostics might benefit underserved patients while acknowledging their concerns.
For each perspective, write approximately 200 words, clearly labeling each section. 
Conclude with a brief synthesis of these viewpoints and identify areas of consensus and disagreement.

Your Turn

Create prompts combining the following persona sets:

  • An economist, an environmental scientist, and a small business owner discussing sustainable business practices
  • A cybersecurity expert, a privacy advocate, and a social media executive discussing data protection
  • A traditional educator, a technology innovator, and a student discussing the future of education

Conclusion

Practice these exercises regularly to improve your prompt engineering skills. Remember that effective prompt engineering is iterative—analyze the responses you receive and refine your prompts accordingly. As you become more skilled, you'll be able to craft prompts that consistently produce the results you need.

Additional Resources