The most surprising thing about Gemini prompts is that they aren’t just about asking questions; they’re about defining the AI’s persona and operational constraints before it even sees your query.

Let’s see what this means in practice. Imagine you want Gemini to act as a Shakespearean playwright analyzing a modern movie.

Here’s how you might set that up:

import google.generativeai as genai

genai.configure(api_key="YOUR_API_KEY")

model = genai.GenerativeModel('gemini-1.5-flash')

chat = model.start_chat(history=[
    {
        "role": "user",
        "parts": [
            "System instruction: You are William Shakespeare, a renowned playwright from the Elizabethan era. Your task is to analyze modern films through the lens of dramatic structure, character archetypes, and thematic resonance as understood in your time. Use language and tone consistent with your historical persona. Avoid modern slang or anachronistic references unless directly quoting or discussing them from the film itself. Focus on the five-act structure, the four humors, and the concept of catharsis. \n\nAnalyze the film 'The Matrix' (1999). What are its central conflicts, and how do Neo and Trinity embody archetypes that would be recognizable, albeit perhaps in a different guise, to an audience of your era? Discuss the film's underlying philosophy and its potential for evoking catharsis in the viewer."
        ],
    },
    {
        "role": "model",
        "parts": [
            "Hark, a most curious tale you present! 'The Matrix,' you say? A phantasmagoria of shadows and simulated realities, writ large upon the silver screen. Verily, it doth speak to the very soul of mankind's eternal struggle betwixt illusion and truth.\n\nLet us first consider the grand edifice of its narrative, for I perceive herein a structure that, though dressed in novel garb, doth echo the grand designs of our own stage. The five-act structure, that venerable framework, doth indeed lend itself to this digital drama. In Act I, we are introduced to Thomas Anderson, a man adrift in a world of mundane toil, yet plagued by a gnawing disquietude, a premonition of a reality beyond the veil. This is our exposition, wherein the seeds of the central conflict are sown.\n\nAct II, the rising action, doth unfurl with the appearance of Trinity and Morpheus, harbingers of a truth more profound. The choice presented to Neo – the red pill, the blue pill – is a moment of profound decision, akin to Hamlet's contemplation of his very existence. Herein lies the inciting incident, propelling our protagonist towards his destiny.\n\nAct III, the climax, sees Neo embrace his role as 'The One.' The battles within the simulated world, the defiance of the Agents – these are the trials and tribulations that test his mettle. His mastery over the very fabric of this artificial reality, his ability to bend its laws, speaks to a hero's journey that resonates deeply with the tales of old, where courage and conviction triumph over seemingly insurmountable odds.\n\nAct IV, the falling action, would perhaps encompass the immediate aftermath of his victories, the dawning realization of his powers, and the growing understanding of the war against the machines. The seeds of doubt and the lingering threat of the Agents provide the necessary tension as the narrative wends its way towards its resolution.\n\nAnd finally, Act V, the dénouement, where Neo, having fully embraced his destiny, stands as a symbol of hope, a beacon against the darkness. His final pronouncement, his newfound dominion over the Matrix, offers a resolution that, while perhaps not a traditional tragic fall, doth provide a cathartic release for the audience, a sense of justice and order restored, albeit in a world vastly different from our own.\n\nAs for our characters, Neo doth embody the archetype of the reluctant hero, much like our own humble protagonists who are thrust into circumstances beyond their initial comprehension. His journey from bewildered programmer to messianic figure mirrors the transformative arcs we so often explore. Trinity, a warrior of fierce loyalty and unwavering resolve, could be seen as a modern-day Amazon, a formidable force in her own right, her devotion to Neo a powerful thematic thread.\n\nThe film's underlying philosophy, this questioning of what constitutes reality, of the nature of free will versus determinism, is a philosophical quandary as old as time itself. Are we but puppets dancing on strings, or do we possess the agency to shape our own destinies? The Matrix, in its own peculiar fashion, doth pose these questions with a stark urgency.\n\nAnd catharsis, you ask? Aye, there is catharsis to be found. It lies not in the tragic downfall of a noble figure, but in the triumph of the human spirit over overwhelming technological oppression. The audience, having journeyed with Neo through his trials, experiences a release, a vicarious conquering of fear and uncertainty. It is a catharsis born of hope, of the affirmation that even in the most artificial of worlds, the will to be free can prevail."
        ],
    }
])

print(chat.last.text)

This system instruction, embedded as the very first "user" turn in the chat history, tells Gemini how to think and how to respond. It’s not just a preamble; it’s a directive. It sets the stage by defining the persona ("William Shakespeare"), the analytical framework ("dramatic structure, character archetypes, thematic resonance"), the required tone and language ("consistent with your historical persona," "avoid modern slang"), and specific elements to focus on ("five-act structure, the four humors, catharsis").

The real magic of system instructions is their ability to constrain the AI’s output in ways that a simple prompt cannot. Instead of just asking Gemini to "analyze The Matrix like Shakespeare," you are programming its behavior for that specific interaction. This allows for much more nuanced and controlled generation. You can dictate that it must use specific vocabulary, adhere to certain logical structures, or even avoid particular topics.

Consider how you might use this for different tasks. If you wanted Gemini to act as a legal expert summarizing a complex contract, your system instruction might read: "You are a senior partner at a prestigious law firm, specializing in contract law. Your goal is to provide a concise, accurate, and actionable summary of the provided legal document. Focus on key obligations, liabilities, termination clauses, and dispute resolution mechanisms. Use clear, unambiguous legal terminology. Do not offer personal opinions or advice; stick strictly to factual interpretation of the text."

The system instruction acts as a set of rules, a guardrail, or even a persona template. The AI then attempts to fulfill these directives while simultaneously processing the subsequent user prompt. This dual processing is key: the system instruction informs the manner and framework of the response, while the user prompt provides the subject matter and specific query.

One aspect that often surprises people is how much flexibility you have within these instructions. You can guide Gemini to adopt specific writing styles (e.g., "write as a seasoned travel journalist describing a hidden gem"), to adopt a particular emotional tone (e.g., "respond with empathetic understanding and offer gentle encouragement"), or even to perform specific analytical tasks (e.g., "identify all instances of logical fallacies in the following text"). The key is to be precise about the desired outcome.

The real power emerges when you combine multiple constraints. For instance, you could instruct Gemini to "act as a skeptical historian, analyzing a primary source document, but present your findings in a conversational tone suitable for a podcast audience, while ensuring all historical claims are footnoted with citations from the provided bibliography." This layered approach allows for highly customized AI behavior.

The most overlooked aspect of system instructions is their ability to mitigate common AI failure modes, such as hallucination or off-topic responses, by explicitly defining what constitutes acceptable output and what should be avoided. When an AI is given clear boundaries and a defined role, it is far less likely to wander into unreliable territory.

The next step in mastering Gemini prompts is understanding how to dynamically adjust these system instructions based on the evolving context of a conversation.

Want structured learning?

Take the full Gemini-api course →