
Basic Prompting
>>> A guide to understanding and using basic prompts in AI models.
What is Prompting?
Prompting is the art and science of communicating with AI models to get the results you want. Think of it as giving instructions to a highly capable assistant.
Why Prompting Matters
The same AI model can produce vastly different outputs based on how you prompt it. Let's see this in action:
Notice how the specific prompt yields more actionable and relevant information? That's the power of good prompting!
Key Principles
1. Clarity is King
Be explicit about what you want. AI models can't read your mind. The more specific you are about your requirements, the better the AI can tailor its response to your needs.
Write something about Python
Write a beginner's guide to Python functions with 3 examples
Notice how the good prompt specifies the target audience (beginners), the topic (Python functions), and the expected format (3 examples)? This level of detail helps the AI understand exactly what you're looking for.
2. Context Matters
Provide relevant background information to guide the AI's response. Without context, the AI has to guess what you need, which often leads to generic or unhelpful answers.
Fix this code
I'm getting a TypeError in this Python function that processes user data. Here's the code: [code]. The error occurs when...
The good prompt includes the programming language, the type of error, what the code does, and when the error occurs. This context enables the AI to provide a targeted solution rather than generic debugging advice.
3. Format Your Output
Specify how you want the information presented. Different formats serve different purposes—bullet points for quick scanning, paragraphs for detailed explanations, tables for comparisons. By explicitly stating your format preferences, you ensure the output matches your intended use case.
Explain the water cycle in:
- Simple bullet points
- Using
analogies a 10-year-old would understand
- Maximum 5 points
This example demonstrates how format specifications can be combined with other requirements (like target audience and length) to create a well-structured prompt that produces exactly the kind of output you need.
Common Pitfalls
Too Vague
If you write a prompt like "Help me with my project," you're not giving the AI enough detail to provide a meaningful or useful response. The AI doesn't know what your project is about, what kind of help you need, or what your goals are. Always specify the context, your objectives, and what you expect in the response.
Too Complex
When you try to ask for too many things at once—for example, giving a prompt that contains ten different questions or requests—the AI may only address some of them or provide shallow, incomplete answers. For best results, break up complex tasks into separate, focused prompts so each request is addressed thoroughly.
Assuming Context
The AI doesn't have memory of your previous conversations unless you explicitly include that information in your prompt. If you refer to "the document I sent earlier" or make assumptions about shared history, the AI will not know what you mean. Always restate necessary details or reference earlier parts of the conversation if you want them to be considered.
Anatomy of a Good Prompt
Understanding the components of effective prompts will help you craft better instructions every time.
The SCOPE Framework
Structure prompts using these essential components:
Situation
Establish the working environment and circumstances. This sets the stage for everything that follows, helping the AI understand the context in which it's operating.
I'm preparing a presentation for executive stakeholders about our Q4 performance...
By starting with the situation, you immediately orient the AI to your specific context—in this case, a business presentation scenario with a particular audience.
Capability
Define the expertise level and perspective needed. This helps the AI adopt the right "voice" and draw from the appropriate knowledge base for your task.
Approach this as a data analyst with experience in SaaS metrics...
Specifying the capability ensures the AI responds with the depth and perspective of someone with that expertise, rather than providing a generic answer.
Objective
State your specific goal and desired outcome. This is the "what" of your prompt—the core task you want the AI to accomplish.
Create a compelling narrative that highlights growth opportunities and addresses concerns...
A clear objective helps the AI prioritize what's most important in its response, ensuring it stays focused on your primary goal.
Parameters
Set constraints, requirements, and boundaries. These guardrails ensure the output fits within your practical limitations and meets your specific needs.
Keep it under 10 slides, focus on actionable insights, avoid technical jargon...
Parameters help prevent the AI from going off-track or producing something that doesn't fit your constraints, whether those are length, style, complexity, or other factors.
Expectation
Clarify the format, style, and delivery method. This final component ensures you receive the output in exactly the form you need to use it effectively.
Present as slide titles with bullet points, use confident but diplomatic language...
By specifying expectations upfront, you avoid the need for reformatting or style adjustments after receiving the initial response, saving time and ensuring consistency.
Complete Example
Let's put it all together:
Not every prompt needs all five SCOPE elements. Use what's relevant for your specific use case. Simple queries might only need Objective and Expectation.
Common Prompt Patterns
These battle-tested patterns will help you achieve consistent results across different use cases.
The Persona Pattern
Make the AI adopt a specific expertise or perspective. This pattern is powerful because it leverages the AI's training on diverse knowledge domains, allowing it to respond with the depth and nuance of an expert in that field.
Notice how the persona (Michelin-starred chef) combined with the situation (home cook, dinner guests) creates a prompt that balances sophistication with practicality. The AI will draw on culinary expertise while keeping the suggestions achievable for the target audience.
The Step-by-Step Pattern
Break down complex tasks into manageable steps. This pattern is especially useful when you need structured, sequential instructions that are easy to follow and implement.
Break down [TASK] into step-by-step instructions.
Requirements:
- Number each step
- Include any prerequisites
- Highlight potential
- Keep each step focused on one action pitfalls
- Keep each step focused
on one action
This pattern works great for tutorials, how-to guides, and troubleshooting. By explicitly requesting numbered steps with prerequisites and potential pitfalls, you ensure the output is actionable and anticipates common issues users might encounter.
The Comparison Pattern
Analyze multiple options to make informed decisions. This pattern helps you evaluate trade-offs and understand the relative strengths and weaknesses of different approaches, tools, or solutions.
The comparison pattern is most effective when you specify the criteria that matter to your specific use case. In this example, the criteria (learning curve, community support, performance, ecosystem) are all relevant to a startup's decision-making process, and the table format makes it easy to scan and compare options side-by-side.
The Question Refinement Pattern
Get the AI to help you ask better questions. This meta-pattern is particularly valuable when you're exploring a new domain and don't yet know what you need to know.
I want to learn about [TOPIC], but I'm not sure what questions to ask.
Generate 5 progressively deeper questions that would help someone master this topic, starting from beginner to expert level.
This pattern creates a learning roadmap by generating questions that build on each other. Starting with beginner questions and progressing to expert-level ones helps you understand both the fundamentals and the advanced concepts you'll need to master the topic.
The Template Pattern
Create reusable prompts with variables. This pattern is essential for building scalable AI applications where you need to generate similar content with different inputs.
Write a professional email template for [SITUATION].
Variables to include:
- [RECIPIENT_NAME]
- [SPECIFIC_ISSUE]
- [PROPOSED_SOLUTION]
- [TIMELINE]
Keep it under 150 words and maintain a friendly yet professional tone.
Templates allow you to define the structure and style once, then reuse it with different variable values. This ensures consistency across multiple outputs while allowing for customization. The example above shows how placeholders (in brackets) mark where dynamic content will be inserted.
These patterns can be combined! For example, use the Persona + Step-by-Step pattern to get expert-level tutorials, or combine the Comparison Pattern with the Template Pattern to create reusable comparison frameworks.
Prompt Templates & Variables
In product development, you often need to use the same prompt in multiple places. This is where prompt templates come into play. They allow you to reuse the same prompt structure across multiple places, with varying inputs.
When to Use Prompt Templates
Use prompt templates when you expect any part of your prompt to be repeated, or used again with different inputs.
-
User Input: When you have user input that needs to be inserted into the prompt.
-
Testing: Optimize your testing process by using prompt templates to test different inputs and edge cases.
-
Reusability: Reuse the same prompt structure across multiple places, with varying inputs.
Template Structure
Templates use double brackets {{variable_name}} for placeholders, making them easily identifiable and allowing for quick testing of different values. This syntax is widely recognized and works well with most templating systems and AI platforms.
You are a professional translator specializing in {{source_language}} to {{target_language}} translation.
Translate the following text while preserving:
- Original tone and style
- Technical terminology accuracy
- Cultural context where appropriate
Text to translate:
"""
{{text_to_translate}}
"""
Provide only the translation without additional commentary.
This example demonstrates a complete template with multiple variables: source_language, target_language, and text_to_translate. When you use this template, you'd replace these placeholders with actual values (e.g., "English", "Spanish", and the actual text to translate). The structure remains consistent, but the content adapts to your specific needs.
Advanced Template Patterns
As your templates become more sophisticated, you can incorporate conditional logic and loops. These advanced patterns allow you to create flexible templates that adapt based on your inputs.
<role>
You are a {{expert_type}} with {{years_experience}} years of experience.
</role>
<task>
Analyze the {{content_type}} provided below and evaluate it based on these criteria:
{{#each criteria}}
- {{this}}
{{/each}}
</task>
<content>{{ content_to_analyze }}</content>
<format>
Provide your analysis in {{output_format}} format.
{{#if include_recommendations}}
Include 3-5 actionable recommendations at the end.
{{/if}}
</format>
This template uses XML-style tags to structure different sections of the prompt, making it easy to parse and modify. The {{#each}} loop allows you to dynamically include multiple criteria, and the {{#if}} conditional means recommendations are only included when needed. This level of structure makes templates more maintainable and easier to understand.
You are analyzing multiple documents to {{analysis_goal}}.
{{#each documents}}
<document id="{{@index}}">
<source>{{source}}</source>
<type>{{type}}</type>
<content>
{{content}}
</content>
</document>
{{/each}}
<instructions>
- {{primary_instruction}}
- {{secondary_instruction}} {{#if tertiary_instruction}}
- {{tertiary_instruction}} {{/if}} </instructions>
Focus on: {{focus_areas}}
Output format: {{desired_format}}
This multi-document template shows how you can handle variable numbers of inputs. The {{#each}} loop processes each document in the array, and each document can have its own metadata (source, type) along with content. The @index variable provides a unique identifier for each document, which can be useful for referencing specific documents in the analysis.
Template Benefits in Practice
Version Control
Track changes to your prompt structure over time by keeping tabs only on the core template, separate from dynamic inputs.
Scalability
Simplify prompt management as your application grows in complexity. Templates make it easy to maintain consistency across different use cases.
Evaluation Ready
Templates work seamlessly with evaluation tools by separating the variable and fixed portions of your prompts for systematic testing.
Try Template Variables
Here's a practical example that demonstrates how template variables work in a real-world scenario. Notice how different variable values change the prompt's behavior while maintaining the same core structure.
Modern AI platforms like Claude Console heavily use prompt templates for features like prompt generators, improvers, and evaluation tools. Learning templates now sets you up for advanced AI development workflows.
Prompting Best Practices
Follow these guidelines to consistently get high-quality responses from AI models.
Golden Rules
These fundamental principles apply to nearly every prompting scenario.
1. Be Specific
Vague prompts produce vague results. The more specific you are, the better the output.
Write about climate change
Write a 300-word explanation of how rising ocean temperatures affect coral reefs, targeted at high school students
2. Provide Examples
Show the AI what you want. Examples dramatically improve output quality and consistency. When you provide examples, you're essentially training the AI on-the-fly to match your preferred style, tone, and structure.
Generate product descriptions in this style:
Example 1:
Product: Wireless Earbuds
Description: Immerse yourself in crystal-clear sound with our lightweight wireless earbuds. 30-hour battery life means your music never stops.
Example 2:
Product: Smart Watch
Description: Stay connected and healthy with our feature-packed smartwatch. Track your fitness goals while never missing a notification.
Now generate a description for: Running Shoes
By providing two examples, the AI can identify the pattern: starting with an engaging benefit statement, highlighting key features, and maintaining a concise, benefit-focused tone. This is far more effective than trying to describe the style in words alone.
3. Iterate and Refine
First attempts are rarely perfect. Use follow-up prompts to improve the output. Think of prompting as a conversation where each exchange helps you get closer to exactly what you need.
Initial: "Explain quantum computing"
Follow-up 1: "Make it more accessible for beginners"
Follow-up 2: "Add a real-world analogy"
Follow-up 3: "Include one practical application"
This iterative approach allows you to refine the output incrementally. Start broad, then narrow down based on what you receive. Each follow-up builds on the previous response, allowing you to shape the final output without having to craft the perfect prompt from the start.
Advanced Tips
Use Delimiters for Structure
Clearly separate different parts of your prompt using delimiters like triple quotes, XML tags, or markdown headers. Delimiters help the AI distinguish between instructions, input data, examples, and output requirements, reducing ambiguity and improving accuracy.
Analyze the sentiment of this customer review:
"""
{{customer_review}}
"""
Then categorize it as: Positive, Neutral, or Negative
Provide a confidence score (0-100)
Extract key themes mentioned
In this example, the triple quotes clearly mark where the customer review begins and ends, making it obvious to the AI what content needs to be analyzed versus what are the instructions for analysis.
Ask the AI to Think Step-by-Step
For complex reasoning tasks, explicitly request step-by-step thinking. This technique, sometimes called "chain-of-thought" prompting, helps the AI work through problems methodically and often leads to more accurate results, especially for mathematical or logical problems.
Solve this problem step by step:
A store offers a 25% discount on items over $100. If I buy a $120 item with a $20 coupon, what's my final price?
Show your work for each step.
By asking for step-by-step work, you not only get the correct answer but also understand the reasoning process. This is particularly valuable when you need to verify the logic or when the problem-solving approach is as important as the final answer.
Use Negative Instructions
Tell the AI what NOT to do to avoid common mistakes. Sometimes it's easier to specify what you want to avoid than to describe everything you do want. Negative instructions are particularly useful for preventing common pitfalls or unwanted behaviors.
Write a professional job rejection email.
Do NOT:- Use overly formal language
- Make false promises about future opportunities
- Include unnecessary explanations
- Exceed 100 words
Negative instructions act as guardrails, preventing the AI from including elements you specifically want to avoid. Combined with positive instructions, they create a clear boundary for what the output should and shouldn't contain.
Common Mistakes to Avoid
Overloading with Multiple Tasks: Asking the AI to do 5 different things at once often results in incomplete or shallow responses. Break complex requests into separate prompts.
Assuming Too Much Context: The AI doesn't have access to your files, previous sessions, or screen unless you explicitly provide that information.
Ignoring Output Format: Failing to specify how you want the information formatted (JSON, markdown, bullet points, etc.) leads to inconsistent results.
Not Testing Edge Cases: Always test your prompts with unusual or boundary inputs to see how they perform in real-world scenarios.
Quick Reference Checklist
Before submitting your prompt, verify:
- Is my goal clearly stated?
- Have I provided all necessary context and background?
- Did I specify the desired output format?
- Have I included examples or constraints where appropriate?
- Is the prompt focused on one main task rather than multiple?
Try It Yourself
Put all the best practices together in this comprehensive example. Notice how it combines multiple techniques: a clear persona, specific task definition, detailed parameters, and explicit format requirements. This is what a well-crafted prompt looks like in practice.
Great prompting is like great communication—it's clear, specific, and provides context. Master these practices and you'll see immediate improvements in your AI interactions.