beginnerChapter 1 of 12
Basic Prompt Structure
Messages API formatting · User/assistant roles · System prompts
How Claude Reads Your Prompts
Every interaction with Claude happens through the Messages API. You send a list of messages, each with a role (user or assistant) and content.
{
"messages": [
{ "role": "user", "content": "Count to three." }
]
}
System Prompts
A system prompt sits outside the message list and sets the overall context, personality, or rules for the conversation. Think of it as stage directions for Claude before the curtain goes up.
{
"system": "You are a concise assistant. Reply in as few words as possible.",
"messages": [
{ "role": "user", "content": "What is the capital of France?" }
]
}
Key Takeaways
- Claude's behavior is shaped by the system prompt plus the sequence of user and assistant messages.
- Being explicit about what you want in the very first message sets the tone for the rest of the conversation.
- The system prompt is the right place for persistent rules, tone, or persona — not the user message.
Practice What You Learned
0/2 completed12
Counting to Three
Next upWrite a prompt that makes Claude count to three. The response should contain the numbers 1, 2, and 3 in sequence.
Start exercise
System Prompt Basics
Use a system prompt to change how Claude responds. Write both a system prompt and a user message to see the difference a system prompt makes.
Open exercise