🎯 How to Write Prompts That Actually Work
You’ve built an amazing chat system, but here’s the secret: the difference between a basic AI app and a million-dollar business often comes down to how well you talk to the AI.
Think about it - Jasper.ai, Copy.ai, and other successful AI companies don’t have special access to better AI models. They just know how to instruct AI really, really well.
Good news: this is a learnable skill. Let me show you exactly how to do it.
🎯 The 5 Questions You Need to Ask Before You Prompt
Section titled “🎯 The 5 Questions You Need to Ask Before You Prompt”Before you write anything, ask yourself these five simple questions.
1. What exactly do I want?
Section titled “1. What exactly do I want?”Don’t say “help me with marketing.” Say “write three Facebook posts that get parents to sign up for my kids’ soccer camp.”
See the difference? The first one could mean anything. The second gives AI a clear goal to aim for.
2. Who is this for?
Section titled “2. Who is this for?”AI needs to know who’s going to read or use what it creates.
A report for your boss should sound different from an email to your customers. Tell the AI: “This is for busy parents who scroll Facebook during lunch” or “This is for engineers who hate marketing speak.”
3. What should it look like?
Section titled “3. What should it look like?”Do you want bullet points? A paragraph? A table? A step-by-step list?
AI can create almost any format, but you have to tell it what you want. Otherwise, you’ll get whatever it thinks is best (which might not be what you need).
4. What background info is missing?
Section titled “4. What background info is missing?”AI doesn’t know your company, your customers, or your situation. Give it context.
Instead of “write a product description,” try “write a product description for busy moms who want healthy snacks but don’t have time to read long ingredient lists.”
5. What kind of expert do I need?
Section titled “5. What kind of expert do I need?”Should AI think like a teacher? A salesperson? A friendly neighbor? A technical expert?
Tell it: “Act like a patient teacher explaining this to someone who’s never heard of it before” or “Write like a friend giving advice over coffee.”
🧠 Why This Works
Section titled “🧠 Why This Works”Here’s the thing about AI: it’s incredibly smart but completely literal.
If you say “make this better,” it has to guess what “better” means. Professional? Shorter? More exciting? It doesn’t know.
But if you say “make this email more professional and under 100 words,” now it knows exactly what to do.
Bad prompt: “Help me write something” Good prompt: “You are a friendly social media manager. Write an Instagram post for a coffee shop’s new fall menu. Make it exciting and include 3 relevant hashtags. Keep it under 50 words.”
The second one works because it answers all 5 questions.
🎯 The RICE Framework: Your Simple Template
Section titled “🎯 The RICE Framework: Your Simple Template”Here’s a simple formula that works every time. Think of it like a recipe - follow these 4 ingredients and you’ll get consistent results.
RICE = Role + Instruction + Context + Example
R: Role - Who should the AI be?
Section titled “R: Role - Who should the AI be?”Give the AI a job title and personality.
Examples:
- “You are a friendly cooking teacher”
- “You are a professional email writer”
- “You are an expert social media manager”
- “You are a patient math tutor”
Why this works: AI has learned from millions of examples of how teachers teach, how marketers write, how doctors explain things. When you give it a role, it taps into all that knowledge.
I: Instruction - What should they do?
Section titled “I: Instruction - What should they do?”Be specific about the task. Use action words.
Good instruction words:
- Write, Create, Make
- Explain, Teach, Show
- Analyze, Review, Check
- Plan, Design, Organize
Examples:
- “Write a follow-up email”
- “Create three social media posts”
- “Explain how to make pasta”
- “Plan a week of meals”
C: Context - What do they need to know?
Section titled “C: Context - What do they need to know?”Give background information. What’s the situation?
Include:
- Who is this for?
- What’s the goal?
- Any important details or limits?
- What’s the situation or background?
Example: “This is for busy parents who want quick dinner ideas. They have 30 minutes max and prefer healthy options their kids will actually eat.”
E: Example - Show what good looks like
Section titled “E: Example - Show what good looks like”This is the secret weapon. Show an example of what you want.
Template:
Here's the style I want:
[Your example here]
Now create something similar for my situation.
Why examples work: AI is amazing at recognizing patterns. Show it once, and it can recreate that style perfectly.
💡 Putting RICE Together
Section titled “💡 Putting RICE Together”Let’s build a complete prompt step by step:
Example: Social Media Manager App
Section titled “Example: Social Media Manager App”Step 1 - Role: “You are an expert social media manager”
Step 2 - Instruction: “Create an Instagram post”
Step 3 - Context: “For a small bakery announcing their new weekend hours. The audience is local families and coffee lovers.”
Step 4 - Example: Show the tone and style you want
Complete prompt:
You are an expert social media manager with 5 years of experience helping small businesses grow their following.
Create an Instagram post for a small family bakery announcing their new weekend hours (now open Saturdays 7am-4pm).
The audience is local families and coffee lovers who follow the bakery for fresh pastries and community updates.
Keep it:- Warm and welcoming tone- Under 50 words- Include 2-3 relevant hashtags- End with a call to action
Example style: "☀️ Something exciting is brewing! We're thrilled to announce... Come celebrate with us this weekend! #LocalBakery #WeekendTreats"
Compare this to: “Write a social media post about new hours”
See the difference?
🚀 From Playground to Production
Section titled “🚀 From Playground to Production”When building prompts for a real application, your goals shift from one-off creativity to reliability, consistency, and safety.
1. Use Prompt Templates
Section titled “1. Use Prompt Templates”Hard-coding prompts is fragile. Use templates that allow you to dynamically insert user data.
// Example in JavaScriptfunction createCodeReviewPrompt(codeSnippet) { return `You are a Senior Staff Engineer acting as a code reviewer. Analyze the following code snippet for potential security vulnerabilities, performance bottlenecks, and violations of best practices.
Code: \`\`\` ${codeSnippet} \`\`\`
Format your response as a JSON array of issues, where each issue has 'line', 'severity' ('high' | 'medium' | 'low'), and 'comment' fields.`;}
2. Implement System Prompts
Section titled “2. Implement System Prompts”A system prompt is a high-level instruction that governs the AI’s behavior across an entire conversation. It sets the ground rules before the user’s first prompt.
// System Prompt for a customer service bot"You are 'SupportBot,' a friendly and helpful AI assistant for Acme Inc.Your goal is to resolve user issues politely and efficiently.- Never make up information. If you don't know the answer, say so and offer to escalate to a human agent.- Do not engage in conversations unrelated to Acme Inc. products.- Keep your responses concise and easy to understand."
3. Version and A/B Test Your Prompts
Section titled “3. Version and A/B Test Your Prompts”Treat your prompts like code. Store them in version control (e.g., Git) and track changes.
const PROMPT_V1 = "Summarize this article...";
// prompts/v2_summary.jsconst PROMPT_V2 = "You are an expert editor. Create a 3-bullet summary...";
// In your application, you can run an A/B test to see which prompt// leads to higher user satisfaction or better metrics.
🤖 Use AI to Improve Your Prompts
Section titled “🤖 Use AI to Improve Your Prompts”Here’s the meta-technique: use AI to help you write better prompts. Think of it as having a prompt engineering coach.
The Prompt Optimizer
Section titled “The Prompt Optimizer”"I want to improve this prompt to get better, more consistent results:
[Your current prompt]
Please analyze it and suggest improvements. Consider:- Is the role specific and appropriate?- Are the instructions clear and actionable?- What context might be missing?- Would examples help clarify expectations?- Are there constraints that would improve focus?
Rewrite the prompt to be more effective."
The Template Generator
Section titled “The Template Generator”"Help me create a reusable prompt template for [specific use case].
Requirements:- Should work for [describe variations]- Output format needs to be [specify format]- Target audience is [describe users]- Must include these variables: [list them]
Create a template with clear placeholders that I can customize for different scenarios."
The Multi-Variant Creator
Section titled “The Multi-Variant Creator”"Create 3 different versions of this prompt for A/B testing:
Original: [your prompt]
Generate variations that:1. Use a different role/persona approach2. Change the instruction style (more/less detailed)3. Modify the output format or structure
Keep the core goal the same but experiment with different approaches."
🔍 Common Mistakes and How to Fix Them
Section titled “🔍 Common Mistakes and How to Fix Them”Mistake | Why It’s Bad | How to Fix |
---|---|---|
Ambiguity | ”Make this better” gives the AI no direction. It has to guess what you mean by “better.” | Be Explicit: “Improve the clarity of this paragraph, reduce the word count by 20%, and use a more professional tone.” |
Prompt Overloading | Asking the AI to do too many distinct tasks at once (e.g., write, test, and document code) degrades the quality of all tasks. | Chain Your Prompts: Break down complex workflows into a sequence of simpler prompts. The output of one becomes the input for the next. |
Assuming Knowledge | The AI doesn’t know your company’s internal jargon, project history, or specific goals. | Provide Rich Context: Include all relevant data, definitions, and desired outcomes directly in the prompt or in a document the AI can reference. |
Ignoring the Model | Different models have different strengths (e.g., reasoning, creativity, coding). A generic prompt won’t leverage these. | Tailor to the Model: Use CoT for reasoning tasks with GPT-4, leverage Claude for code reviews, use Gemini for creative brainstorming. |
No Quality Control | Accepting the first output without validation can lead to inconsistent results. | Add Review Steps: “After completing the task, review your work for accuracy, completeness, and alignment with the requirements.” |
📋 Quick Reference: Production-Ready Prompt Patterns
Section titled “📋 Quick Reference: Production-Ready Prompt Patterns”Code Generation Template
Section titled “Code Generation Template”const CODE_PROMPT = `You are a ${language} expert with ${experience} years of experience.
Task: ${task}Requirements:- Follow ${framework} best practices- Include error handling- Add comprehensive comments- Make it production-ready- Include unit tests
Code context: ${context}
Format: Provide the code, then explain your design decisions.`;
Content Analysis Template
Section titled “Content Analysis Template”const ANALYSIS_PROMPT = `You are a ${domain} expert analyzing ${contentType}.
Goal: ${analysisGoal}Input: ${content}
Analyze and provide:1. Key insights (top 3)2. Potential issues or concerns3. Recommendations for improvement4. Confidence level (high/medium/low) for each point
Format as structured JSON.`;
Decision Support Template
Section titled “Decision Support Template”const DECISION_PROMPT = `You are a ${role} helping with a ${decisionType} decision.
Context: ${background}Options: ${options}Constraints: ${constraints}Success criteria: ${criteria}
Evaluate each option using:- Pros and cons- Risk assessment- Implementation difficulty- Expected outcome
Recommend the best option with reasoning.`;
🎯 Testing Your Prompt Engineering Skills
Section titled “🎯 Testing Your Prompt Engineering Skills”Challenge: Take a basic prompt you use regularly and transform it using RICE:
- Start simple: “Help me write a function”
- Add Role: “You’re a senior Python developer…”
- Clarify Instruction: “Write a function that validates email addresses…”
- Provide Context: “For a user registration system that handles 10k+ users…”
- Show Example: “Like this:
is_valid_email('user@domain.com') → True
”
Advanced Challenge: Create a prompt template for your most common AI task, then use AI to optimize it.
💡 Key Takeaways
Section titled “💡 Key Takeaways”Remember:
- Prompting is programming — treat it with the same rigor as code
- RICE covers 80% of use cases — Role, Instruction, Context, Example
- Advanced techniques solve complex problems — CoT, persona stacking, constraints
- Production requires templates — don’t hard-code prompts
- Use AI to improve your prompts — meta-prompting is incredibly powerful
- Test and iterate — A/B test your prompts like any other feature
The best prompt engineers don’t just ask better questions — they systematically design communication protocols that consistently produce the results they need.
Master these techniques, and you’ll build AI features that actually work in production. 🚀