Google's latest official prompt engineering manual

Written by
Caleb Hayes
Updated on:June-22nd-2025
Recommendation

Master the art of communicating with AI and improve the quality of your AI model output.

Core content:
1. Definition and importance of prompt engineering: how to get ideal AI response through clear instructions
2. 5 core skills for writing good prompts: clarify goals, provide context, use clear instructions, etc.
3. Advanced prompt design and common mistakes: role-playing, limiting output length, iterative optimization and other skills

Yang Fangxian
Founder of 53A/Most Valuable Expert of Tencent Cloud (TVP)
Part 1: What is prompt engineering?

Prompt engineering is the art of chatting with AI! The clearer the instructions (prompts) you give to the model, the more accurate the model's answer will be. Just like ordering food: the clearer you are, the more delicious the dish the chef will serve!

  • The purpose of the prompt is to tell the model what you want (answer, code, story, etc.).

  • Characteristics of good prompts : ✅ Clear, ✅ Specific, ✅ Contextual.

  • Consequences of bad prompts : ? Vague answers, ? Off-topic, ? Wrong information.




?️ Part 2: Core Skills

Here are 5 core tips for writing good prompts to help you quickly improve the quality of your output!

1. Clearly define your goals?

Tell the model what type of response you want. For example:

  • Want to write an article? Say "write a 500-word popular science article."

  • Want to solve a problem? Say “Help me debug this Python code.”

Example :

  • Bad: Write something about AI.

  • Good: Write a 300-word article introducing the application of AI in the medical field, suitable for beginners.


2. Provide context ?

Background information can help the model better understand your needs. It includes:

  • Role : Are you a student, programmer, or writer?

  • Scenario : Who should I answer to? What is the occasion?

  • Details : Specific requirements (e.g. tone, format).

Example :

  • Bad: Explain quantum computing.

  • Good: Explain quantum computing in layman's terms at the knowledge level of a high school student and give an analogy from real life.


3. Use clear instructions?

Start with a simple verb, such as "list," "explain," and "generate." Avoid vague words (such as "get some" and "casual").

Example :

  • Bad: Give me some Python code.

  • Good: Generate a Python code to implement a function that calculates the sum of 1 to 100.


4. Step-by-step guidance?

Complex tasks can be broken down into small steps to guide the model step by step. For example:

  • First ask to "make an outline", then ask to "write the article according to the outline".

Example :

  • Bad: Write an article about environmental protection.

  • Good: 1. List an outline for an article on the topic of environmental protection (3 main parts). 2. Write a 500-word article based on the outline, with a positive tone.


5. Specify the format?

Tell the model what format you want the output to be (e.g. list, table, code block).

Example :

  • Bad: Give me tips for healthy eating.

  • Good: List five healthy eating tips in a bulleted list, each of no more than 20 words.



? Part 3: Advanced prompt design

Want to make your hints even more powerful? Try these advanced tips!

1. Role Playing?

Having the model play a specific role (such as teacher, programmer, historian) can make the answers more targeted.

Example :

  • Tip: As a professional nutritionist, I recommend 3 breakfast recipes suitable for office workers.


2. Limit output length ✂️

Be clear about the word or paragraph count to avoid answers that are too long or too short.

Example :

  • Tip: Explain what blockchain is in 100 words or less.


3. Request examples or analogies?

Let the model explain complex concepts with examples or analogies to enhance readability.

Example :

  • Hint: Explain neural networks using an analogy from everyday life in 150 words or less.


4. Iterative optimization ?

If the first answer is not ideal, adjust the prompt, add details or ask the question in a different way.

Example :

  • First time: writing an article about AI.

  • Second time: Write a 300-word article introducing the application of AI in education, including 2 specific cases.



⚠️ Part 4: Common Errors and Solutions

Here are some common mistakes beginners make, and how to avoid them!

  1. Hint too vague  ?

  • Questions: Such as “Tell me something.”

  • Solution: Make the topic, format, and length clear, such as "List 3 tips for learning Python."

  • Lack of context  ?

    • Problem: The model doesn’t know your context or needs.

    • Solution: Provide roles and scenarios, such as "Explain REST API from a programmer's perspective."

  • Too complicated  ?

    • Problem: A prompt contains multiple tasks, which the model may miss.

    • Solution: Split the tasks and guide step by step.

  • Ignore the tone  ?

    • Problem: The tone of the response was not what was expected (e.g. too serious or too casual).

    • Solution: Specify the tone, such as "with a humorous tone."



    ? Part 5: Example Tips

    Here are some quality tips for different scenarios for your reference!

    1. Study related?

    • Tips: Explain photosynthesis in language that high school students can understand, including an analogy, in 150 words or less.

    • Tip: List 5 scientific methods to improve memory in a bulleted list, with no more than 20 words per item.


    2. Programming related?

    • Tip: Generate a Python code that implements a function to calculate the area of ​​a circle, including comments.

    • Tip: Help me debug the following JavaScript code, point out errors and provide fixes.


    3. Writing related ✍️

    • Tip: Write a 200-word thank you letter to your friend for his birthday gift in a warm tone.

    • Prompt: Write a 300-word short science fiction story on the theme of "time travel".


    4. Daily life ?

    • Tip: Here are 3 recommended home cooking recipes suitable for beginners. Each dish includes ingredients and steps in a list format.

    • Tip: List 5 relaxing weekend activities that are family friendly and low-budget, each in 15 words or less.