The Complete Gemini Prompting Guide
Everything from Google's Gemini prompting docs. Four input types, few-shot patterns, multimodal handling, parameter tuning, and agentic workflow strategies.
Official Google docs →Four types of prompt input
Google identifies four input categories, and understanding which one you're using changes how you write the prompt. Question Input: direct questions ('What is photosynthesis?'). Task Input: specific actions ('Summarize this article'). Entity Input: items for classification ('Classify this email as spam or not'). Completion Input: partial content for the model to finish ('The capital of France is...'). Completion input is underrated. Giving the model a pattern to continue is often more precise than explicit instructions.
Clear and specific instructions
Specify constraints on everything: length ('one sentence'), structure ('as a table with columns for X, Y, Z'), and depth ('system instructions emphasizing comprehensiveness vs conciseness significantly change the output'). A one-sentence summary constraint produces concise, accurate explanations. Without it, Gemini will give you paragraphs.
Few-shot examples are essential
Google's own recommendation: 'Always include few-shot examples in your prompts.' Zero-shot (no examples) works for simple tasks, but few-shot dramatically improves consistency. Identical questions with different examples produce different results, proving that examples steer the model more than instructions alone. Use specific, varied examples. Show positive patterns, not anti-patterns. Keep formatting consistent across all examples.
Context and prefixes
Contextual information helps models understand constraints. Including reference materials significantly improves accuracy. Prefixes are a powerful and underused technique that serves three purposes: Input prefixes mark semantic parts ('English:' vs 'French:'), Output prefixes signal the expected format ('JSON:'), and Example prefixes label components for easier parsing. These small labels dramatically improve the model's understanding of your prompt structure.
Breaking down complex prompts
For complex tasks, three strategies: 1) Break down instructions into separate prompts for each step, 2) Chain prompts where one output feeds into the next, 3) Aggregate responses by running parallel operations on different data portions. Chaining is the most powerful. Each step gets the model's full attention, and you can inspect intermediate results to catch errors early.
Model parameters that matter
Max output tokens controls response length (100 tokens is roughly 60-80 words). Temperature controls randomness: 0 is deterministic, higher is creative. Critical for Gemini 3: keep the default 1.0 temperature. Deviating, especially lowering it, can cause looping and degraded performance on reasoning tasks. topK selects from the K most probable tokens. topP selects until cumulative probability hits a threshold (default 0.95). stop_sequences halts generation at specified text.
Agentic workflow strategies
For complex AI agents built on Gemini, steer three behavioral dimensions: Reasoning (how deep it decomposes problems, how it diagnoses issues, how exhaustively it gathers information), Execution (adaptability to new data, persistence in error recovery, risk assessment), and Interaction (when to ask for permission, how verbose to be, output precision). Use methodical planning before action, comprehensive constraint analysis, and persistent problem-solving.