
Prompt Technique
What is Prompting and Why It Matters Today
We're in the early stages of an AI revolution. At this point, the real question isn't "Should we use AI or not?" but rather "How can we effectively leverage AI's capabilities?"
I began seriously exploring how to properly use AI a few months ago. As a non-professional prompt engineer like myself, I've discovered that there are just a few techniques you'll use daily—techniques we can quickly cover so you can reap most of the benefits.
Prompt engineering is the process of refining AI prompts to improve their accuracy and effectiveness. This blog, referencing Anthropic's (Claude) prompt engineering guide, will cover basic techniques that will quickly help you achieve 80% efficiency in prompting, while building a foundation for exploring more advanced techniques later to gain that additional 20% improvement over time. I prioritize examples over raw theory, as I believe this helps you quickly grasp the idea behind each skill.
Note: Throughout this blog, terms like "AI" and "chatbot" refer to generative intelligence models. I use these terms because they're more common in everyday conversation. Also, I won't include lengthy example outputs as they might make the blog intimidatingly long at first glance, when our goal is to quickly cover useful techniques. You can find example outputs for each technique in the Anthropic documentation (most examples come from here) and the Prompt Engineering Guide.
General Tips and Techniques
Specificity & Avoiding Vagueness
This is the foundation of all prompting techniques. When interacting with AI, think of it as a brilliant but very new employee. Imagine showing your prompt to a colleague with minimal context about the task and asking them to follow your instructions. If they might be confused, your AI chatbot likely will be too.
To be more specific about your task:
- Provide contextual information: What will the result be used for? Who is the audience?
- Clearly state what you want: If you need the AI to perform a categorized task and return only the label without explanation, say so explicitly.
- Break instructions into sequential steps: Use numbered lists or bullet points to ensure the AI completes the task exactly as you want
Example:
Unclear prompt | Clear prompt |
---|---|
Please remove all personally identifiable information from these customer feedback messages: {{FEEDBACK_DATA}} | Your task is to anonymize customer feedback for our quarterly review. Instructions: 1. Replace all customer names with “CUSTOMER_[ID]” (e.g., “Jane Doe” → “CUSTOMER_001”). 2. Replace email addresses with “EMAIL_[ID]@example.com”. 3. Redact phone numbers as “PHONE_[ID]“. 4. If a message mentions a specific product (e.g., “AcmeCloud”), leave it intact. 5. If no PII is found, copy the message verbatim. 6. Output only the processed messages, separated by ”---”. Data to process: {{FEEDBACK_DATA}} |
To Do or Not to Do?
A key tip when designing prompts is to focus on what the AI should do rather than what it shouldn't do. This encourages specificity and directs the AI toward behaviors that lead to better responses. Example:
Example:
Ineffective prompt | Effective prompt | |
---|---|---|
Prompt | The following is an agent that recommends movies to a customer. DO NOT ASK FOR INTERESTS. DO NOT ASK FOR PERSONAL INFORMATION. | The following is an agent that recommends movies to a customer. The agent is responsible to recommend a movie from the top global trending movies. It should refrain from asking users for their preferences and avoid asking for personal information. If the agent doesn't have a movie to recommend, it should respond "Sorry, couldn't find a movie to recommend today." |
Customer | Please recommend a movie based on my interests? | Please recommend a movie based on my interests? |
Output | Sure, I can recommend a movie based on your interests. What kind of movie would you like to watch? Do you prefer action, comedy, romance, or something else? | Sorry, I don't have any information about your interests. However, here's a list of the top global trending movies right now: [list of movies] . I hope you find something you like! |
Use Examples
Examples are your secret weapon for getting AI to generate exactly what you need. By providing a few well-crafted examples in your prompt, you can dramatically improve the accuracy, consistency, and quality of outputs. You can wrap your examples in <example>
tags (or nested within <examples>
tags for multiple examples).
Example:
Unclear prompt | Clear prompt |
---|---|
Analyze this customer feedback and categorize the issues. Use these categories: UI/UX, Performance, Feature Request, Integration, Pricing, and Other. Also rate the sentiment (Positive/Neutral/Negative) and priority (High/Medium/Low). Here is the feedback: {{FEEDBACK}} | Our CS team is overwhelmed with unstructured feedback. Your task is to analyze feedback and categorize issues for our product and engineering teams. Use these categories: UI/UX, Performance, Feature Request, Integration, Pricing, and Other. Also rate the sentiment (Positive/Neutral/Negative) and priority (High/Medium/Low). Here is an example:<example> Input: The new dashboard is a mess! It takes forever to load, and I can’t find the export button. Fix this ASAP! Category: UI/UX, Performance Sentiment: Negative Priority: High </example> Now, analyze this feedback: {{FEEDBACK}} |
Chain of Thought (CoT)
One of the most powerful prompting techniques is encouraging the AI to think through problems step by step, which dramatically improves performance. Chain of Thought was first introduced in Wei et al. (2022) by outlining specific steps for AI to follow in its thinking process, you increase the accuracy and coherence of results. Later, zero-shot CoT was introduced, simply adding "Let's think step by step" to prompts and letting the AI build its own thinking process.
Example:
Zero-shot CoT | Specific steps CoT |
---|---|
Draft personalized emails to donors asking for contributions to this year’s Care for Kids program. Program information: <program> {{PROGRAM_DETAILS}} </program> Donor information: <donor> {{DONOR_DETAILS}} </donor> Think step-by-step before you write the email. | Draft personalized emails to donors asking for contributions to this year’s Care for Kids program. Program information: <program> {{PROGRAM_DETAILS}} </program> Donor information: <donor> {{DONOR_DETAILS}} </donor> Think before you write the email in <thinking> tags. First, think through what messaging might appeal to this donor, given their donation history and which campaigns they’ve supported in the past. Then, think through what aspects of the Care for Kids program would appeal to them, given their history. Finally, write the personalized donor email in <email> tags, using your analysis. |
Note: XML tags (<thinking>
) work well with Claude, but ChatGPT and some other models perform better when guided to think with markdown formatting like ###Think###
.
Use XML Tags
When your prompts involve multiple components like context, instructions, and examples, XML tags can be a game-changer. They help the AI parse your prompts more accurately, leading to higher-quality outputs.
For hierarchical content, use nested tags: <outer><inner></inner></outer>
.
Example:
No XML tags | XML tags |
---|---|
You’re a financial analyst at AcmeCorp. Generate a Q2 financial report for our investors. Include sections on Revenue Growth, Profit Margins, and Cash Flow, like with this example from last year: {{Q1_REPORT}} . Use data points from this spreadsheet: {{SPREADSHEET_DATA}} . The report should be extremely concise, to the point, professional, and in list format. It should and highlight both strengths and areas for improvement. | You’re a financial analyst at AcmeCorp. Generate a Q2 financial report for our investors. AcmeCorp is a B2B SaaS company. Our investors value transparency and actionable insights. Use this data for your report <data> {{SPREADSHEET_DATA}} </data> <instructions> 1. Include sections: Revenue Growth, Profit Margins, Cash Flow. 2. Highlight strengths and areas for improvement. </instructions> Make your tone concise and professional. Follow this structure: <formatting_example> {{Q1_REPORT}} </formatting_example> |
Giving AI a Role
In complex scenarios like legal analysis or financial modeling, role prompting can dramatically improve performance.
Example:
Without a role | With a role |
---|---|
Analyze this software licensing agreement for potential risks:<contract> {{CONTRACT}} </contract> Focus on indemnification, liability, and IP ownership. | You are the General Counsel of a Fortune 500 tech company. We’re considering this software licensing agreement for our core data infrastructure:<contract> {{CONTRACT}} </contract> Analyze it for potential risks, focusing on indemnification, liability, and IP ownership. Give your professional opinion. |
Chain Complex Prompts
When working with complex tasks, AI can sometimes struggle if you try to handle everything in a single prompt. Breaking down complex tasks into smaller, manageable subtasks improves accuracy, clarity, and traceability (making it easier to identify which part of the prompt caused problems). This approach also guides the AI to double-check, give feedback, and improve the result.
Example:
Prompt 1 | As a senior solutions architect, review and analyze this multitenancy strategy for our new enterprise SaaS product.<strategy> {{STRATEGY}} </strategy> Focus on scalability, security, and cost-effectiveness. |
Prompt 2 | Draft a strategy review document for engineering leadership based on this analysis of a multitenancy strategy.<strategy> {{STRATEGY}} </strategy> <analysis> {{ANALYSIS}} </analysis> Include an executive summary, detailed analysis, and recommendations. |
Prompt 3 | Grade this strategy review document for clarity, actionability, and alignment with enterprise priorities.<priorities> {{PRIORITIES}} </priorities> <strategy_doc> {{STRATEGY_DOC}} </strategy_doc> |
Conclusion
After exploring these techniques, I hope you'll apply them to your daily interactions with generative AI models. Personally, I find Chain of Thought (CoT) and XML tags most useful for my daily tasks. Always remember to be crystal clear about both the context and the specific task you want the AI to perform. This is why these models are particularly powerful for senior-level users who can provide specific guidance on what they need.
If you'd like to discuss any of these techniques further or share additional tips you use daily with generative AI, please comment below so we can continue learning from each other.