Select an archetype or build your prompt from scratch. The prompt will update below as you make changes.
Your generated prompt will appear here as you build it...
Master the art of crafting prompts that get the best results from Large Language Models (LLMs).
Your prompt must be unambiguous. The AI should know exactly what you want. State the goal directly.
Summarize
,
Analyze
, Generate
, List
, Translate
).
LLMs don't have memory of past separate conversations (unless using specific session features). Give all necessary background in the prompt.
Tell the AI how you want its response structured. This greatly improves usability.
Provide the answer as a JSON object with keys 'name' and 'capital'.
List the steps as a numbered list.
Write a 500-word blog post with an introduction, three main points, and a conclusion.
Use Markdown for formatting.
Instructing the AI to adopt a specific persona helps tailor the tone, style, and expertise level.
You are a senior financial analyst.
Act as a travel guide for Paris, focusing on historical sites.
Respond as if you are a patient and encouraging high school science teacher.
formal
, casual
, witty
,
empathetic
) and target audience.
Asking the model to perform a task it hasn't been explicitly trained on with in-prompt examples for that specific task. Relies on generalization.
Example: Translate the following English text to French: "Hello, how are you?"
Providing a few examples (input/output pairs) within the prompt to demonstrate the desired behavior, format, or style. Highly effective.
Structure: User: [Example Input 1]
AI: [Example Ideal Output 1]
User: [Example Input 2]
AI: [Example Ideal Output 2]
User: [Actual Input for AI to process]
AI:
Guiding the AI to "think step by step" by providing examples where the reasoning process is explicitly laid out before the final answer. Significantly improves performance on tasks requiring reasoning (math, logic puzzles, complex Q&A).
Example of a CoT example pair in a few-shot prompt:
User: Roger has 5 tennis balls. He buys 2 more cans of tennis balls. Each can has 3 tennis balls. How many tennis balls does he have now?
AI: Roger started with 5 balls. He bought 2 cans, and each can has 3 balls. So, he bought 2 * 3 = 6 more balls. In total, he now has 5 + 6 = 11 balls. The final answer is 11.
You can also trigger CoT by adding phrases like "Let's think step by step."
or
"Break this down."
to your prompt. Some models respond well to instructions like
"Show your work."
For complex reasoning tasks where high accuracy is crucial, you can improve reliability by generating multiple responses to the same prompt (e.g., by increasing the model's "temperature" or randomness setting if available, or by slightly rephrasing the prompt). Then, select the most common answer or the one that appears most robust across several generations. This helps reduce the chance of an occasional flawed reasoning path.
Prompt engineering is an empirical science. Start simple and build up. Test, analyze the output, and refine your prompt. Small changes can have big impacts.
Use clear separators (e.g., triple quotes """
, XML tags like <instruction>...</instruction>
, or Markdown headings ## Input Data
) to distinguish instructions, context, examples, and input data. This is highly recommended as it significantly helps the AI parse the prompt effectively. Anthropic's Claude models, for instance, are specifically trained to pay attention to XML tags, making them particularly effective for structuring prompts for these models. Using distinct tags for different instruction types (e.g., <role>
, <user_query>
, <output_constraints>
) is a best practice.
<role_definition>
You are a helpful assistant.
</role_definition>
<user_query>
What's the capital of France?
</user_query>
<output_instructions>
Respond concisely.
</output_instructions>
Decompose very complex requests into smaller, manageable steps. The output of one prompt can become the input or context for the next (prompt chaining).
Instruct the model to generate an initial response, then critically evaluate its own response for weaknesses (e.g., accuracy, completeness, clarity), and finally refine it before presenting the final answer. This can be done in a multi-turn conversation or within a complex single prompt.
Example instruction:
"First, write a draft answer. Then, review your draft for any inaccuracies or areas that could be
explained more clearly. Finally, provide the revised and improved answer."
For complex reasoning, instruct the model to "think out loud" or use a scratchpad area (which you might
instruct it to exclude from the final output). Some models benefit from being told to put intermediate
thoughts in specific tags (e.g., <thinking>...</thinking>
or <scratchpad>...</scratchpad>
) and then explicitly tell it to exclude content within these tags from the final user-facing response.
Retrieval Augmented Generation (RAG) is a powerful technique where the LLM's knowledge is augmented by dynamically retrieving information from external sources (like a vector database of your documents, or a live API) before generating a response. While setting up a full RAG system is beyond simple prompting, you can simulate aspects of it by:
An advanced technique where the model is prompted to explore multiple reasoning paths (like branches of a tree) for a problem. It can evaluate these different paths and choose the most promising one, or even backtrack if a path seems unhelpful. This is more complex to implement in a single prompt and often involves the LLM self-critiquing different lines of thought.
This framework enables LLMs to generate both reasoning traces (like Chain-of-Thought) and task-specific actions. These actions can include using tools (like a calculator or a search engine API) and then integrating the information gathered from these tools back into its reasoning process to arrive at a final answer. To implement this, you'd define the available tools and instruct the model on how it can decide to use them.
Instead of providing highly explicit instructions for every detail, DSP involves giving the model subtle "hints" or "cues" that gently steer it towards the desired output style, content focus, or level of detail. This can be useful for creative tasks where you want to guide the model without over-constraining it. For example, including a few keywords related to a specific theme can act as a directional stimulus.
Some practitioners advocate for frameworks like CLEAR to structure their prompting approach systematically:
Design prompts to avoid generating harmful, biased, or inaccurate information. Be aware that LLMs can reflect biases present in their training data.
LLMs are constantly evolving. Strategies that work well today might need adjustment as models are updated. Stay informed about best practices for the specific model you're using.
Different models may have different strengths, weaknesses, and optimal prompting styles. What works best for GPT-4o might need slight adjustments for Claude 3.5 Sonnet or Gemini 1.5 Pro. Always refer to the latest documentation or guides provided by the AI lab for the specific model you are using.
This guide is a starting point. The best way to learn is by experimenting!