Lesson 6: Writing The Best Gemini Prompts
Why Prompt Writing Matters
The key to unlocking Gemini's full potential lies not in the technology itself, but in how you communicate with it. Just as asking the right question leads to better answers from a human expert, a well-crafted prompt guides Gemini to produce more accurate, relevant, and useful outputs.
As we discussed in Lesson 4, effective prompting is the difference between receiving a generic, unhelpful response and getting a tailored solution that precisely meets your needs. Whether you're using Gemini for market research, creative writing, code development, or educational explanations, the clarity and detail of your prompt directly impacts the quality of the output.
In this chapter, we'll build off of the foundation established in Lesson 4 to fully demystify the art and science of prompt writing. You'll learn core principles that apply across all Gemini versions and use cases, from general applications like summarizing information to specialized tasks like coding and content creation. By the end, you'll have the skills to craft advanced prompts that consistently yield high-quality results.
Learning Outcomes
By the end of this lesson, you will:
- Understand the core components that make prompts effective
- Master a step-by-step approach to prompt creation
- Learn specialized prompting techniques for different tasks
- Recognize and avoid common prompting mistakes
- Apply best practices across general, creative, and technical use cases
Understanding Prompts: The Bridge Between You and AI
At its simplest, a prompt is the input you provide to Gemini: typically a request or question in natural language.
A prompt can take many forms:
- A single question ("What causes rainbows?")
- A set of instructions ("Write a cover letter for a marketing position")
- Data or context, followed by a request ("Based on this customer feedback, what themes emerge?")
- A combination of these elements
Think of prompt writing (or "prompt engineering") as the deliberate crafting of these inputs to elicit the best possible result. Good prompts give clear direction and context, so Gemini doesn't have to guess what you want. Remember, the strength of LLMs like Gemini is the ability to communicate with it like a person using natural language; consider how giving precise instructions to a colleague ensures better outcomes than vague requests, and you'll understand why it's important to write good Gemini prompts.
Core Components of an Effective Prompt
A strong prompt provides Gemini with everything it needs to generate a relevant, high-quality response.
We covered this briefly in Lesson 4, but now it's time to go into more detail. Let's refresh our memory of the key components that make prompts effective:
1. Clear Instructions
The foundation of every good prompt is a clear statement of what you want Gemini to do. Ambiguous or vague instructions are among the most common pitfalls in prompt writing.
Always include a specific action verb or request. Compare these examples:
❌ Vague: "Tell me about solar panels."
✅ Clear: "Explain how solar panels generate electricity in simple terms for a 5th-grade science presentation."
The clear prompt specifies the context (solar energy), the task (explain the process), and the audience/tone (5th-grade level). This precision guides Gemini toward a much more useful answer tailored to your exact needs.
But what does it mean to provide clear instructions? That's what the next three steps will cover:
2. Necessary Context
Provide any background information Gemini needs to fulfill your request. As we mentioned in Lesson 2, the AI doesn't inherently know the context of your specific situation unless you include it.
For instance, if you want a summary of a report, include the report text or key points from it. If you're asking about a topic with a particular angle in mind, mention that angle.
❌ Missing context: "Draft an FAQ about California climate."
✅ With context: "Using the facts below about climate in California, draft a short FAQ. Only use the provided information: [insert climate data]."
The improved prompt ensures Gemini's answer is grounded in specific information rather than generating a generic answer that might miss your intended focus.
Context can also mean giving instructions about how the AI should behave or setting boundaries for the answer, which is what the next step is all about:
3. Format Guidance
Are you looking for a specific kind of answer to your question? As we discussed in Lesson 2 and Lesson 5, Gemini is multimodal and therefore capable of generating different output formats. Hence, you can get the best results by telling Gemini how you want the answer structured. This includes the format (bullet points, paragraphs, code snippets, etc.), length limits, and/or style guidelines.
❌ No format specified: "Give me marketing slogans for our cafe."
✅ Format specified: "List 3 marketing slogans for our cafe in a single bullet-point list (no explanations, just slogans)."
If you need brevity or a particular tone, include that too: "In one sentence, define what a recession is."
Providing these constraints helps Gemini understand the expected output structure. Without them, you might get a different format or length than you had in mind, requiring additional back-and-forth.
4. Tone or Style
You can guide the voice of Gemini's response by specifying a tone or even assigning a role. When instructed, Gemini can adopt various writing styles: formal, casual, enthusiastic, technical, empathetic, and more.
For example:
- "Explain the theory of relativity in a friendly, conversational tone."
- "You are an expert personal trainer. Describe a workout plan for a beginner."
This approach helps shape how the answer is delivered. Even a short phrase like "You are a helpful tutor" or "Act as a financial advisor" can significantly influence the nuance of the response, making it more appropriate for your intended audience or use case.
Try It Yourself: Prompt Component Exercise
Practice identifying and improving prompt components with this exercise:
Original Prompt:
"Help me with marketing."
Improved Version:
- Add clear task: "Help me create a social media marketing plan..."
- Add context: "...for my new online bakery business that specializes in gluten-free treats. My target audience is health-conscious consumers ages 25-45 in urban areas."
- Add format guidance: "Provide this plan as a bulleted list with 5 key action items, each with a brief explanation."
- Add tone/persona: "Write this as if you're a seasoned digital marketing consultant with experience in the food industry."
Final Improved Prompt:
"Help me create a social media marketing plan for my new online bakery business that specializes in gluten-free treats. My target audience is health-conscious consumers ages 25-45 in urban areas. Provide this plan as a bulleted list with 5 key action items, each with a brief explanation. Write this as if you're a seasoned digital marketing consultant with experience in the food industry."
Now try improving these prompts by adding the missing components:
- "Tell me about climate change."
- "Write a cover letter."
- "How do I learn programming?"
Step-by-Step Guide to Crafting a Prompt
Follow these steps when writing your prompt, especially for new tasks or when you're unsure where to start:
1. Identify Your Goal
Clearly define what output you want from Gemini. Are you looking for:
- An answer to a question?
- A summary of information?
- A piece of code?
- A creative story?
- A translation?
Knowing your goal shapes everything else. For example: "I need a summary of this article for an executive who only has 1 minute to read it."
2. Decide on the Context to Provide
Ask yourself what information Gemini would need to produce that output:
- For general questions, the context might just be clarifying details in the question itself.
- For tasks on provided data (like analyzing text or code), that data is your context.
- If domain knowledge is required (e.g., medical or legal information), you might need to supply background information since the AI's training data may not cover recent or specific details.
Example: If prompting for a summary, the context is the article text (or key points from it) that you include in the prompt. If asking Gemini to answer a question about your company's sales figures, the context would be the actual sales data you provide.
3. Be Clear and Specific in Your Ask
Formulate the main instruction or question using explicit verbs like summarize, translate, list, explain, draft, compare, etc., so it's obvious what action Gemini should take.
Include any specifics about scope or focus:
❌ Too general: "Summarize this article."
✅ Well focused: "Summarize the following article focusing only on the new policy changes, in 3-4 sentences."
Here you've specified what to focus on (policy changes) and the length (3-4 sentences). This specificity upfront prevents irrelevant or overly broad answers.
4. Specify Format, Style, or Constraints
If you have preferences for how the answer should be delivered, add those to the prompt. This can be part of the instruction or a separate sentence:
- "Respond in bullet points"
- "Output Python code only, no explanations"
- "Keep the explanation under 100 words"
- "Use a formal tone and technical terminology"
- "Provide the answer and then a brief example"
These act as guidelines for Gemini, increasing the chance the output meets your expectations. For instance, telling Gemini "Give your answer in one sentence" versus "Explain in detail with examples" will lead to very different outputs from the same question.
5. Set the Tone or Persona (Optional)
Consider if the situation calls for a certain voice or role. You can start the prompt with something like:
- "You are an AI tutor..."
- "Act as a historian from the 18th century and answer..."
- Or simply weave it in: "Explain in a friendly, simple manner..."
While not always necessary, this can be especially useful for educational dialogues or creative content where voice matters. In general business use, a simple tone specification (formal vs. casual) usually suffices.
6. Double-Check for Ambiguity
Before sending your prompt, quickly read it from the perspective of the AI:
- Is it clear what you're asking?
- Could any word be interpreted in different ways?
- Are there pronouns or references without clear subjects? (e.g., when asking "explain their significance," who or what does "their" refer to?)
- Have you accidentally asked multiple things that could confuse the model?
If you find any possible confusion, refine the wording. It often helps to assume the AI has no additional context or clarification beyond what you wrote (because it doesn't, except its trained knowledge).
7. Use Iteration and Refinement
Once you get a response from Gemini, evaluate it. Does it fully answer your request? If not, think about what was missing or off-target, then adjust your prompt or ask a follow-up.
For example, if the answer was too generic, maybe your prompt was too broad; try adding more context or specifics. If the tone wasn't what you wanted, explicitly state the tone next time.
You can also give feedback in the next prompt:
- "That's a good start, but please make it more concise."
- "Can you explain that again, but for a beginner who's never heard of this concept?"
Gemini will take that feedback into account in the next response. Recall that in Lesson 2 we discussed how Gemini is trained through RLHF; this is why there's a thumbs-up and thumbs-down option after each response. Iteratively refining your prompt (or giving additional instructions in a multi-turn chat) is a normal part of the process. Remember that prompt writing is interactive: treat it like a dialogue where you and the AI work together toward the best result.
Examples: Prompting for Different Use Cases
Now let's look at concrete examples of good prompts across various applications:
General Q&A (Factual Answer)
❌ Basic prompt: "What causes rainbows?"
✅ Effective prompt: "In simple terms, what causes rainbows to form in the sky? Explain it to a middle school science class."
This revised prompt is clear about the task (explain what causes rainbows), gives context about the audience (middle school level), and sets the tone (educational, age-appropriate). The expected output would be a concise explanation of light refraction, appropriate for that age level.
Summarization
❌ Basic prompt: "Summarize this."
✅ Effective prompt: "Summarize the following article in 2-3 sentences, focusing on the proposed solutions to the problem. {{Then include the article text or excerpt here.}}"
This prompt tells Gemini exactly what to do: make a summary of specified length, highlighting the solutions discussed. The context is the article text itself that you include. By stating "focusing on the proposed solutions," you guide Gemini to filter out other details and zero in on that aspect.
Creative/Chat (Open-Ended Conversation)
❌ Basic prompt: "What should I do in Rome?"
✅ Effective prompt: "You are a friendly travel guide. A user asks: 'I only have one day in Rome. What should I do?' Respond with a brief, enthusiastic itinerary."
Here, we've defined the role ("friendly travel guide"), provided the user's question as context, and instructed the style of response (brief, enthusiastic itinerary). This gives Gemini a persona to adopt and context to work with, plus it knows to keep the answer short and upbeat.
Coding Help
❌ Basic prompt: "Write a Python function to generate Fibonacci numbers."
✅ Effective prompt: "Write a Python function fib(n) that returns the first n Fibonacci numbers as a list. If n is 0 or negative, the function should return an empty list. Include comments explaining each step."
In this prompt, the task is explicit (a Python function named fib), the output format is implied (Python code), and additional constraints (behavior for invalid input and inclusion of comments) are given. This reduces ambiguity (e.g., whether to handle edge cases) and guides the style (comments for clarity).
For more complex coding tasks, you might provide context like an excerpt of code to be fixed or a description of an algorithm. Always indicate the programming language and any specific requirements, and specify whether you want just code or also an explanation.
Common Mistakes and How to Avoid Them
Even experienced users can fall into these prompt-writing traps. Some of the most common culprits were briefly addressed in Lesson 4, but here's a more detailed guide on how to recognize and avoid them:
Being Too Vague
❌ Problem: A very short or generic prompt like "Explain quantum physics" will yield a very general answer that might not address what you actually want to know.
✅ Solution: Add specifics. Specify what aspect you're curious about or at what level the explanation should be. Instead of "Explain quantum physics," ask "Explain the concept of quantum entanglement in one paragraph as if I have basic physics knowledge."
Overloading or Asking Multiple Questions at Once
❌ Problem: Cramming too many queries or tasks into one prompt (e.g., "Tell me about renewable energy, why it's important, give examples, compare solar vs. wind power, and write it as a poem.") confuses the model.
✅ Solution: Tackle one main task at a time, or clearly separate subtasks. You can always ask follow-up questions in a new prompt. If you genuinely need a multi-part answer, consider formatting the prompt to guide structure (like bullet points or numbered parts for each sub-question).
Lack of Context / Assuming the AI "Knows" Your Situation
❌ Problem: Asking "What do you think about this proposal?" without showing the proposal forces the model to guess or respond generically.
✅ Solution: Always include relevant context. If you're continuing a conversation, remember to either refer back explicitly or include the needed details again. Don't assume the AI remembers things you haven't mentioned in the current prompt or conversation.
Using Overly Complex Language or Jargon in the Prompt
❌ Problem: While Gemini understands technical terms, overly convoluted phrasing increases the risk of misunderstanding.
✅ Solution: Write as clearly and naturally as possible. You're not trying to trick the AI; you're instructing it. Use plain language and only use technical terms if you specifically want a technical answer.
Not Specifying the Desired Format
❌ Problem: If you need the answer in a particular form and don't mention it, you might get a completely different format than expected.
✅ Solution: Always state the format or style if it matters to you. Words like "List...", "Outline...", "In a table, provide...", "Give a brief definition:" are cues to the AI. If formatting is critical (e.g., you want a JSON object or an HTML snippet), be extremely explicit about it.
Ignoring the Need to Review and Refine
❌ Problem: Treating the AI's first answer as final, even if it's not what you wanted.
✅ Solution: Look at the output and think: did the prompt miss something or allow some ambiguity? Then adjust the prompt and try again (or ask the AI to fix it). Always review the content for accuracy, especially factual or numerical answers.
Try It Yourself: Prompt Building Workshop
Let's practice building effective prompts for real-world scenarios:
Scenario 1: Job Application Help
You need to create a cover letter for a marketing position at a tech company.
Build Your Prompt:
- Task: [What specifically do you want Gemini to help with?]
- Context: [What relevant information should you include?]
- Format: [How should the response be structured?]
- Tone: [What voice or style is appropriate?]
Example Completed Prompt:
"Draft a cover letter for a Digital Marketing Manager position at a tech startup. I have 5 years of experience in social media marketing and content creation, with expertise in SEO and analytics. The job posting emphasizes creativity, analytical skills, and experience with B2B marketing. Format this as a professional one-page letter with a compelling introduction, 2-3 paragraphs highlighting relevant experience, and a strong closing paragraph. Use a confident but not arrogant tone."
Scenario 2: Technical Explanation
Goal: You need to understand how blockchain technology works for a presentation using a single Gemini prompt.
Your Turn: Build a complete prompt following the steps we've covered.
Having trouble getting started? Here's a hint; look at the advanced prompting techniques we discussed in Lesson 4:
- What would your ideal output look like? Write a succinct and easy-to-understand explanation of a topic you deeply understand; add this to your prompt to make a few-shot prompt.
- Blockchain technology is pretty intricate, so it might help to ask Gemini to explain it step-by-step.
- If you weren't asking Gemini, who would be the ideal person to ask for information about blockchain technology? Tell Gemini to play the role of that person and answer from his or her perspective.
Key Learnings & Takeaways
Let's consolidate the most important concepts from this chapter:
- Clarity is key: Always state clearly what you want. A specific, well-defined prompt yields more precise answers than a vague question. Include action verbs, avoid using a lot of unclear pronouns, and pinpoint the exact task or question.
- Context matters: Gemini only knows what you tell it in the prompt (plus its pre-training). Give necessary background information or data so the model isn't guessing or assuming incorrectly. Ground the AI in the context you care about.
- Format and constraints guide the output: Tell the model how to answer, whether it's the tone (formal/informal), format (list, paragraph, code, etc.), length limit, or style. These act like guidelines for Gemini and help align the output with your expectations.
- Personas and roles shape responses: You can instruct Gemini to respond from a certain perspective or in a certain voice (e.g., as a friendly tutor or as a Python coding assistant). This can make outputs more relevant to your audience or use case and maintain consistency in style.
- Examples enhance understanding: When appropriate, include brief examples of what you're looking for (few-shot prompting). Demonstrating the desired format or solution style in the prompt can guide Gemini to follow that pattern.
- Iteration improves results: Treat prompt writing as an interactive process. If the first answer isn't perfect, refine your prompt or ask follow-up instructions. Even experts tweak prompts multiple times to get the best result.
- Balance simplicity and detail: Provide enough information to guide Gemini effectively, but avoid overloading your prompt with unnecessary complexity or you run the risk of hallucination. Focus on what's truly important for the task at hand.
What's Next?
Now that you understand the fundamentals of crafting effective prompts, the next chapter will explore "Personalizing Your Gemini Experience." You'll learn how to:
- Create custom AI assistants (Gems) for specific tasks
- Teach Gemini your preferences with the Memory feature
- Set custom instructions for consistently personalized responses
These techniques will build on your prompt writing skills to create an even more tailored and efficient experience with Gemini.