Skip to content

🎯 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.

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.

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.”

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).

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.”

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.”


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

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.

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”

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.”

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.


Let’s build a complete prompt step by step:

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?


When building prompts for a real application, your goals shift from one-off creativity to reliability, consistency, and safety.

Hard-coding prompts is fragile. Use templates that allow you to dynamically insert user data.

// Example in JavaScript
function 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.`;
}

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."

Treat your prompts like code. Store them in version control (e.g., Git) and track changes.

prompts/v1_summary.js
const PROMPT_V1 = "Summarize this article...";
// prompts/v2_summary.js
const 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.

Here’s the meta-technique: use AI to help you write better prompts. Think of it as having a prompt engineering coach.

"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."
"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."
"Create 3 different versions of this prompt for A/B testing:
Original: [your prompt]
Generate variations that:
1. Use a different role/persona approach
2. 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."

MistakeWhy It’s BadHow 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 OverloadingAsking 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 KnowledgeThe 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 ModelDifferent 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 ControlAccepting 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”
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.`;
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 concerns
3. Recommendations for improvement
4. Confidence level (high/medium/low) for each point
Format as structured JSON.`;
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:

  1. Start simple: “Help me write a function”
  2. Add Role: “You’re a senior Python developer…”
  3. Clarify Instruction: “Write a function that validates email addresses…”
  4. Provide Context: “For a user registration system that handles 10k+ users…”
  5. 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.


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. 🚀