Ir para o conteúdo

Lição 4 · Prompting Gemini

Prompting Gemini: The Basics

Write clear Gemini prompts with a goal, context, audience, constraints and format. Learn where to place instructions and how to handle long background.

A prompt is everything you send to the model: your question, any background, files and instructions. Gemini cannot read your mind. It fills every gap with a guess, usually a very average one. Clear prompts leave fewer gaps.

This lesson gives you a structure that works in the app, in Workspace and in the API. For a wider treatment, see Prompt Engineering.

Five parts of a useful prompt

Part Question it answers Example
Goal What do you want? "Write a reply to a late-delivery complaint."
Context What does Gemini need to know? "The parcel is 4 days late because of a storm."
Audience Who will read it? "A long-time customer who is upset."
Constraints What are the limits? "Under 120 words. No promises about refunds."
Format What should it look like? "Subject line, then three short paragraphs."

You will not need all five every time. For "What is the capital of Kenya?" the question is enough. For anything you will send or rely on, add the others.

Before and after

TEXT
Weak:
Write an email about the delay.

Better:
Write an email to a customer whose order is 4 days late because of a storm.
The customer has bought from us for years and is annoyed.
Apologize once, explain the cause in one sentence and give the new date, 14 March.
Do not mention refunds or discounts. Keep it under 120 words.
Format: subject line, then three short paragraphs.

The second prompt is longer, but you save the time you would spend fixing a generic answer.

Be direct, not dramatic

Google's prompting guide for its recent models advises precise, direct instructions without unnecessary or overly persuasive language. You do not need threats, flattery or capital letters. Define words that could mean two things. If you say "make it short", say how short.

The same guide notes that recent Gemini models tend to give direct, efficient answers. If you want a warm tone or a detailed explanation, ask for it.

Where to put things

For long background, such as a pasted report, put the material first and your question at the end. A short bridge such as "Based on the document above, ..." tells the model where the task starts. Put rules that must always apply, such as the role and output format, near the start or in your standing instructions.

Use clear separators so data and instructions are not mixed. Markdown headings or simple tags both work. Pick one style and keep it within a prompt.

TEXT
You are helping me prepare a team update.

<notes>
...paste your raw notes here...
</notes>

Based on the notes above, write a status update with these headings:
Done, In progress, Blocked. Use only facts found in the notes.
If something is unclear, list it under "Questions" instead of guessing.

The last two lines matter. Telling Gemini what to do when information is missing gives it a safe option other than inventing details.

Check a prompt before you send it

This helper looks for common parts using simple keyword clues. It is a memory aid, not a judge of quality.

Python A prompt checklist helper

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Notice that the first prompt passes "goal" only. Keyword checks can be fooled, so read your prompt as if you were a new colleague.

Ask Gemini to ask you

When you do not know what to include, let the model interview you:

TEXT
I want to plan a 3-day trip. Before you suggest anything, ask me up to five
questions about the things that would change your plan. Wait for my answers.

This is useful for planning, writing and design tasks, where your preferences matter more than general knowledge.

Break big jobs into steps

One giant prompt that says "research, outline, write and proofread" gives you little control. Split it:

  1. Ask for an outline and edit it.
  2. Ask for one section at a time.
  3. Ask for a review against your own checklist.

Each step gives you a chance to correct the direction early, when correction is cheap.

Prompts do not create knowledge

A better prompt cannot give Gemini facts it does not have. If you need recent or private information, provide it as a file or text, or use a feature with sources. Then ask Gemini to answer only from that material and to say when the material does not cover the question. Check the result anyway.

A worked improvement

Suppose you need a note to your neighbors about building work. The first attempt is "Write a note about construction." The reply will be generic, because almost everything is missing.

Walk through the five parts. The goal is to warn neighbors and avoid complaints. The context is that you are replacing a roof from Monday to Wednesday, with noise from 8:00. The audience is people in the same street, some of whom work at night. The constraints are no technical terms and under 90 words. The format is a greeting, three short sentences and your first name.

TEXT
Write a note to my neighbors to warn them about roof work.
Work runs Monday to Wednesday, and noise starts at 8:00.
Some neighbors work nights, so apologize once and offer a way to contact me.
Use everyday words, under 90 words.
Format: greeting, three short sentences, then "Sam".
Leave the contact detail as [PHONE] so I can add it myself.

Notice the last line. The prompt asks for a blank instead of letting the model invent a number, and your real phone number never leaves your device.

Common mistake: asking two unrelated questions in one prompt. One part often gets a thin answer. Send them separately, or number them and ask for a numbered reply.

Check your understanding

Quick check · 3 questions

of 3 answered You scored / 3 · perfect!

  1. 1. You paste a long report and have one question. Where should the question usually go?

    Google's guidance for long context is to give the material first and the question at the end.
  2. 2. Which line best reduces invented details?

    A concrete rule for missing information gives the model a safe alternative to guessing.
  3. 3. What should you do with a big writing task?

    Steps let you correct course early.

Summary

  • Give a goal, context, audience, constraints and format when the result matters.
  • Be direct and define vague words.
  • With long material, put it first and your question last.
  • Say what to do when information is missing, and split large tasks.

Next: Examples, Output Formats and Iteration

Seu progresso fica salvo neste navegador. Não precisa de conta.