Prompts
A prompt is the instruction sheet you hand to the model. The clearer and more structured your instructions, the better the output. Think of the difference between telling someone "make food" versus "make a grilled cheese sandwich with sourdough bread, butter the outside, and cut it diagonally." Both are valid requests, but one produces dramatically better results.
How It Works
Modern LLMs use role-based prompts with three parts, as shown in the diagram:
-
System prompt — Sets the model's behavior, personality, and constraints. It persists throughout the conversation and shapes every response. A system prompt like "You are a senior code reviewer" fundamentally changes how the model interprets and responds to everything that follows.
-
User message — The actual question, task, or input. This is what you're asking the model to do. Good user messages are specific, provide relevant context, and set expectations for the response format.
-
Assistant response — The model's output. In multi-turn conversations, previous assistant responses become part of the prompt for the next turn, giving the model memory of what it already said.
Together, these three roles form "the prompt" — the complete input the model receives. The system prompt is special because it acts as a persistent instruction layer: the model treats it with higher priority than user messages, which is why it's used for safety constraints, persona definitions, and output formatting rules.
Good prompts share common traits: they are specific about what they want, provide context the model needs, and set constraints on the output. Instead of "write a function," a solid prompt says "write a TypeScript function that validates email addresses, returns a boolean, and handles edge cases like plus-addressing."
Why It Matters
Prompt quality is the single most important lever for getting useful AI output. The same model can produce radically different results depending on how you instruct it. A vague prompt gets a generic answer; a structured prompt with clear roles, context, and constraints gets focused, actionable output.
This is why prompt engineering has become a fundamental skill for developers working with AI. Understanding prompt structure — how system prompts shape behavior, how to provide context efficiently, and how to constrain output format — transforms the model from a novelty into a reliable tool. Every concept in this section builds toward making you more effective at crafting prompts that get the results you need.