Tutorials · Beginner
How to write effective prompts for artificial intelligence
Learn how to write effective prompts for artificial intelligence with these four keys: context, format, role and iteration. A practical beginner's guide.
- Claude
- ChatGPT
In this tutorial you’ll learn how to write effective prompts for artificial intelligence: the text messages you send to tools like Claude or ChatGPT to ask for something. A well-written prompt can make the difference between a generic response and a truly useful one.
Tap each step to open and follow it.
Before you start: you only need a free account on Claude (claude.ai) or ChatGPT (chatgpt.com). No payment needed to practice the techniques in this guide.
1 Be specific: say exactly what you want
The most common mistake when writing AI prompts is being too vague. The more specific you are, the better the response.
Compare these two prompts:
| Vague | Specific |
|---|---|
| ”Write something about marketing" | "Write 3 Instagram post ideas about sports shoes, targeting women aged 25–35. Friendly, motivating tone. Maximum 150 words each.” |
The second prompt says exactly which channel, which product, which audience, what tone and what length. The AI has nothing to guess.
How to apply it:
- Before writing, ask yourself: what exactly do I want at the end?
- Include concrete details: quantity, length, channel, audience.
- Avoid words like “something”, “a bit” or “more or less”.
2 Add context: who you are and what it's for
The AI knows nothing about you unless you tell it. Adding context helps it adjust the level, tone and relevance of the response.
Examples of useful context:
- Your profile: “I’m a high school teacher preparing biology classes.”
- The audience: “I need to explain this to older adults with no tech experience.”
- The final use: “I’m going to post this on my bakery business blog.”
How to apply it:
- Start the prompt with a brief context sentence: who you are or what it’s for.
- Mention the audience if you’re not the one reading the response.
- If you have your own material (text, data), paste it directly into the prompt.
3 Define the response format
If you don’t specify how you want the response, the AI chooses for you. Sometimes it guesses right, sometimes not. Specifying the format saves editing time.
Formats you can request:
- Bulleted or numbered list
- Table with specific columns
- Short paragraphs (max X words)
- Numbered step-by-step
- Email with subject and body
- Code with comments
- Title, summary and body separately
Example:
“Summarize the key points of this article in 5 bullet points. Each bullet must be maximum 20 words.”
How to apply it:
- At the end of the prompt, add a line starting with “Format:” or “Give me this as:”.
- If you don’t want the AI to add unnecessary explanations, say: “Just give me the result, no introduction.”
4 Assign a role to the AI
Telling the AI what role to play changes the vocabulary, tone and focus of the response. This trick is one of the most effective.
How it works:
Start the prompt with a phrase like:
- “Act as a graphic designer with 10 years of branding experience.”
- “You are a math teacher explaining concepts to 12-year-old students.”
- “You are a copywriter specializing in email sales.”
Full example:
“You are a nutritionist speaking with patients who have no medical background. Explain simply why sleep affects weight. Maximum 150 words.”
The role guides the AI on what knowledge to apply and how to communicate it.
If you build with AI and want to go deeper into structuring prompts for more complex projects, check out the tutorial Prompts for building with Claude Code.
5 Iterate: refine the prompt until it's right
The first prompt you write is a draft. The best results come when you refine it with the AI’s feedback.
Ways to iterate:
- If the response is too long: “Shorten it by half without losing the main idea.”
- If the tone wasn’t what you wanted: “Make it more casual, like talking to a friend.”
- If something was missing: “Add a section about pricing before the closing.”
- If you want options: “Give me 3 different versions of this paragraph.”
- If you didn’t understand the result: “Explain step by step how you reached that conclusion.”
Iteration isn’t a sign you did it wrong: it’s how the best AI users work. Treat every conversation as a collaborative draft.
To see how this applies in practice when building real projects, the Vibe coding tutorial shows the prompt, review and adjust cycle in action.
Shortcut: the 4-part formula
When you don’t know where to start, use this formula. Just fill in the blanks:
[ROLE] + [CONTEXT] + [WHAT I WANT] + [FORMAT]
Example:
“You are a social media copywriter. I run a small online clothing store and want to attract young women. Write me 5 Instagram post ideas. Give them to me in a numbered list, with each post’s text ready to copy and paste.”
You don’t have to use all 4 parts every time. For simple tasks, being specific (step 1) is enough. The full formula is for when the result really matters or the task is complex.
If something goes wrong
| Problem | What to do |
|---|---|
| The response is too generic | Add more context and specify the audience and channel |
| The AI goes off-topic | Add at the end: “Be concise. Maximum X words.” |
| The AI refuses or gives a strange response | Rephrase without words that may seem sensitive; add more context about the legitimate use |
| The format isn’t what I asked for | Specify the format at the end of the prompt with an example of how you want it |
| I keep getting different responses each time | This is normal: the AI is creative by design. If you need consistency, add “Follow exactly this format:” and provide an example |
Frequently asked questions
What exactly is a prompt?
A prompt is the text message you write to an AI to ask it something. It can be as short as a question or as detailed as a paragraph with context, format and examples.
Is there a formula for writing prompts?
There's no single formula, but the Persona, Context, Result and Format framework is a solid starting point. The most important thing is being specific about what you want.
Do English prompts give better results?
Claude and ChatGPT work very well in Spanish. You can write in the language you need the answer in without losing quality.
How long should a good prompt be?
For simple tasks, one or two clear sentences are enough. For complex projects, a paragraph with context, role and expected format gives better results. Clarity is the key, not length.
Do prompts work the same in Claude and ChatGPT?
The techniques are the same, though each model has its own character: Claude tends toward more thoughtful responses, ChatGPT is usually more direct. The same prompt can produce different results in each.