├── tutorials ├── README.md └── beginner_tutorial.md ├── examples ├── education.md ├── customer_service.md ├── README.md ├── code_generation.md └── content_creation.md ├── LICENSE ├── tools └── README.md ├── resources └── README.md ├── CONTRIBUTING.md ├── docs ├── introduction.md ├── domain_specific_applications.md ├── advanced_methodologies.md ├── best_practices.md └── core_techniques.md └── README.md /tutorials/README.md: -------------------------------------------------------------------------------- 1 | # Hands-On Tutorials 2 | 3 | This directory contains a collection of hands-on tutorials that will walk you through the process of creating and using effective prompts. 4 | 5 | ## Available Tutorials 6 | 7 | - **[Beginner Tutorial: Creating Your First Prompt](./beginner_tutorial.md)** 8 | 9 | We will be adding more tutorials over time. If you have an idea for a tutorial, please see our [Contributing Guidelines](../CONTRIBUTING.md). 10 | -------------------------------------------------------------------------------- /examples/education.md: -------------------------------------------------------------------------------- 1 | # Education Prompts 2 | 3 | This file contains a collection of prompts for educational applications. 4 | 5 | ## Virtual Tutors 6 | 7 | ### Explaining a difficult concept 8 | 9 | ``` 10 | You are a knowledgeable and patient physics tutor. A student is struggling with Newton's laws of motion. Please explain the three laws of motion in a simple and easy-to-understand way, using real-world examples. 11 | ``` 12 | 13 | ### Generating practice questions 14 | 15 | ``` 16 | I am a high school student studying for a biology exam. The exam will cover the topics of cell structure and function. Please generate 5 multiple-choice questions to help me test my knowledge. 17 | ``` 18 | -------------------------------------------------------------------------------- /examples/customer_service.md: -------------------------------------------------------------------------------- 1 | # Customer Service Prompts 2 | 3 | This file contains a collection of prompts for customer service applications. 4 | 5 | ## Chatbots 6 | 7 | ### Answering frequently asked questions 8 | 9 | ``` 10 | You are a friendly and helpful chatbot for a clothing store. A customer is asking about your return policy. Please provide them with the return policy in a clear and concise way. 11 | ``` 12 | 13 | ### Handling customer complaints 14 | 15 | ``` 16 | You are a calm and empathetic chatbot for a telecommunications company. A customer is complaining about a recent service outage. Please apologize for the inconvenience and assure them that you are working to resolve the issue. 17 | ``` 18 | -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | # Prompt Library 2 | 3 | This directory contains a collection of high-quality prompt templates for various tasks and use cases. You can use these prompts as a starting point for your own projects, or as a source of inspiration for creating new prompts. 4 | 5 | ## Categories 6 | 7 | The prompts are organized into the following categories: 8 | 9 | - **[Code Generation](./code_generation.md)** 10 | - **[Content Creation](./content_creation.md)** 11 | - **[Customer Service](./customer_service.md)** 12 | - **[Education](./education.md)** 13 | 14 | We will be adding more categories and prompts over time. If you have a prompt that you would like to share, please see our [Contributing Guidelines](../CONTRIBUTING.md). 15 | -------------------------------------------------------------------------------- /examples/code_generation.md: -------------------------------------------------------------------------------- 1 | # Code Generation Prompts 2 | 3 | This file contains a collection of prompts for generating code. 4 | 5 | ## Python 6 | 7 | ### Function to calculate the factorial of a number 8 | 9 | ``` 10 | Write a Python function that takes a non-negative integer as input and returns its factorial. 11 | ``` 12 | 13 | ### Web scraper to get the headlines from a news website 14 | 15 | ``` 16 | Write a Python script that uses the BeautifulSoup library to scrape the headlines from the front page of the New York Times (https://www.nytimes.com/). 17 | ``` 18 | 19 | ## JavaScript 20 | 21 | ### Function to check if a string is a palindrome 22 | 23 | ``` 24 | Write a JavaScript function that takes a string as input and returns true if the string is a palindrome, and false otherwise. 25 | ``` 26 | -------------------------------------------------------------------------------- /examples/content_creation.md: -------------------------------------------------------------------------------- 1 | # Content Creation Prompts 2 | 3 | This file contains a collection of prompts for generating content. 4 | 5 | ## Blog Posts 6 | 7 | ### Brainstorming blog post ideas 8 | 9 | ``` 10 | I am a travel blogger and I am looking for ideas for my next blog post. My target audience is young adults who are interested in budget travel. Please give me 5 creative and engaging blog post titles. 11 | ``` 12 | 13 | ### Writing a blog post introduction 14 | 15 | ``` 16 | Write a captivating introduction for a blog post about the benefits of meditation. The introduction should be around 100 words and should grab the reader's attention. 17 | ``` 18 | 19 | ## Social Media 20 | 21 | ### Writing a tweet to promote a new product 22 | 23 | ``` 24 | I am launching a new line of eco-friendly cleaning products. Write a tweet to promote the new product line. The tweet should be engaging and include a relevant hashtag. 25 | ``` 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 MiniMax Agent 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /tools/README.md: -------------------------------------------------------------------------------- 1 | # Tools for Prompt Engineering 2 | 3 | This directory contains a curated list of tools that can help you with your prompt engineering workflow. 4 | 5 | ## Prompt Development and Testing 6 | 7 | - **[PromptPerfect](https://promptperfect.jina.ai/prompts):** A tool for testing and improving prompts. 8 | - **[Scale Spellbook](https://scale.com/spellbook):** A product for building, comparing, and shipping language model apps. 9 | - **[Weights & Biases](https://wandb.ai/site/solutions/llmops):** A product for tracking model training and prompt engineering experiments. 10 | 11 | ## Prompting Libraries & Tools 12 | 13 | - **[LangChain](https://github.com/hwchase17/langchain):** A popular Python/JavaScript library for chaining sequences of language model prompts. 14 | - **[LlamaIndex](https://github.com/jerryjliu/llama_index):** A Python library for augmenting LLM apps with data. 15 | - **[Semantic Kernel](https://github.com/microsoft/semantic-kernel):** A Python/C#/Java library from Microsoft that supports prompt templating, function chaining, vectorized memory, and intelligent planning. 16 | 17 | We will be adding more tools to this list over time. If you have a tool that you would like to recommend, please see our [Contributing Guidelines](../CONTRIBUTING.md). 18 | -------------------------------------------------------------------------------- /resources/README.md: -------------------------------------------------------------------------------- 1 | # Resources for Prompt Engineering 2 | 3 | This directory contains a curated list of resources to help you learn more about prompt engineering. 4 | 5 | ## Papers 6 | 7 | - **[Chain-of-Thought Prompting Elicits Reasoning in Large Language Models (2022)](https://arxiv.org/abs/2201.11903):** A seminal paper on Chain-of-Thought prompting. 8 | - **[Self-Consistency Improves Chain of Thought Reasoning in Language Models (2022)](https://arxiv.org/abs/2203.11171):** A follow-up paper on self-consistency. 9 | - **[Tree of Thoughts: Deliberate Problem Solving with Large Language Models (2023)](https://arxiv.org/abs/2305.10601):** A paper on the Tree of Thoughts technique. 10 | 11 | ## Guides and Courses 12 | 13 | - **[learnprompting.org](https://learnprompting.org/):** An introductory course to prompt engineering. 14 | - **[promptingguide.ai](https://www.promptingguide.ai/):** A prompt engineering guide that demonstrates many techniques. 15 | - **[Andrew Ng's DeepLearning.AI](https://www.deeplearning.ai/short-courses/chatgpt-prompt-engineering-for-developers/):** A short course on prompt engineering for developers. 16 | 17 | ## Communities 18 | 19 | - **[OpenAI Discord](https://discord.com/invite/openai):** The official Discord server for OpenAI. 20 | - **[Learn Prompting](https://discord.com/invite/learn-prompting-1046228027434086460):** A Discord community for prompt engineering enthusiasts. 21 | 22 | We will be adding more resources to this list over time. If you have a resource that you would like to recommend, please see our [Contributing Guidelines](../CONTRIBUTING.md). 23 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to The Ultimate Prompt Engineering Guide 2 | 3 | First off, thank you for considering contributing! This project is made possible by the community, and we appreciate all contributions, from fixing a typo to adding a new tutorial. 4 | 5 | ## How to Contribute 6 | 7 | We welcome contributions in various forms: 8 | 9 | - **Content:** Add new sections to the guide, create new tutorials, or expand on existing content. 10 | - **Prompts:** Add new prompts to our library, or improve existing ones. 11 | - **Code:** Contribute new code examples, or improve existing ones. 12 | - **Corrections:** Fix typos, grammatical errors, or factual inaccuracies. 13 | - **Feedback:** Provide feedback on the guide, tutorials, or the repository in general. 14 | 15 | ### Getting Started 16 | 17 | 1. **Fork the repository:** Click the "Fork" button at the top right of this page to create your own copy of this repository. 18 | 2. **Clone your fork:** 19 | ```bash 20 | git clone https://github.com/your-username/your-repo-name.git 21 | ``` 22 | 3. **Create a new branch:** 23 | ```bash 24 | git checkout -b your-branch-name 25 | ``` 26 | 4. **Make your changes:** Make your changes to the files. 27 | 5. **Commit your changes:** 28 | ```bash 29 | git commit -m "Your commit message" 30 | ``` 31 | 6. **Push your changes:** 32 | ```bash 33 | git push origin your-branch-name 34 | ``` 35 | 7. **Create a pull request:** Open a pull request from your fork to this repository. 36 | 37 | ## Style Guide 38 | 39 | - **Content:** Write in clear, concise, and professional English. Use Markdown for formatting. 40 | - **Code:** Follow the existing code style. Add comments to your code where necessary. 41 | - **Prompts:** Provide a clear title and description for each prompt. Include the prompt itself and an example of the expected output. 42 | 43 | ## Questions? 44 | 45 | If you have any questions, feel free to open an issue or join our Discord community (link coming soon!). 46 | -------------------------------------------------------------------------------- /docs/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction to Prompt Engineering 2 | 3 | Welcome to the exciting world of prompt engineering! This guide will take you from the very basics to advanced techniques, empowering you to effectively communicate with and harness the power of large language models (LLMs). 4 | 5 | ## What is a Large Language Model (LLM)? 6 | 7 | A Large Language Model (LLM) is a type of artificial intelligence (AI) that has been trained on a massive amount of text data. This training allows it to understand and generate human-like text. Think of it as a very advanced autocomplete, but instead of just suggesting the next word, it can write entire paragraphs, translate languages, answer your questions, and much more. 8 | 9 | ## What is Prompt Engineering? 10 | 11 | Prompt engineering is the art and science of crafting effective inputs (prompts) to get the desired outputs from an LLM. It's about learning how to "talk" to the AI in a way that it understands and can respond to accurately and creatively. 12 | 13 | A well-crafted prompt can be the difference between a generic, unhelpful response and a detailed, insightful one. As you progress through this guide, you will learn the techniques to craft such prompts. 14 | 15 | ## Why is Prompt Engineering Important? 16 | 17 | As LLMs become more integrated into our daily lives and various industries, the ability to effectively communicate with them is becoming an essential skill. By mastering prompt engineering, you can: 18 | 19 | - **Improve the accuracy and relevance of LLM responses.** 20 | - **Unlock the creative potential of LLMs.** 21 | - **Build innovative applications powered by LLMs.** 22 | - **Better understand the capabilities and limitations of LLMs.** 23 | 24 | ## Key Concepts 25 | 26 | Before we dive into the techniques, let's familiarize ourselves with some key concepts: 27 | 28 | - **Prompt:** The input you provide to the LLM. 29 | - **Response (or Completion):** The output generated by the LLM. 30 | - **Model:** The specific LLM you are interacting with (e.g., GPT-4, Claude, Llama). 31 | - **Parameters:** Settings that control the behavior of the model, such as temperature (randomness) and max tokens (length of the response). 32 | 33 | ## Let's Get Started! 34 | 35 | Now that you have a basic understanding of what prompt engineering is and why it's important, let's move on to the **[Core Techniques](./core_techniques.md)** to start crafting your own effective prompts. 36 | -------------------------------------------------------------------------------- /docs/domain_specific_applications.md: -------------------------------------------------------------------------------- 1 | # Domain-Specific Applications of Prompt Engineering 2 | 3 | Prompt engineering is not a one-size-fits-all solution. The best prompts will vary depending on the specific domain and task. In this section, we will explore how to apply prompt engineering techniques to various domains. 4 | 5 | ## 1. Software Development 6 | 7 | Language models can be powerful tools for software developers. They can be used to generate code, debug errors, and write documentation. 8 | 9 | **Example Prompt (Code Generation):** 10 | 11 | ``` 12 | Prompt: 13 | Write a Python function that takes a list of integers as input and returns the sum of all the even numbers in the list. 14 | ``` 15 | 16 | **Example Prompt (Debugging):** 17 | 18 | ``` 19 | Prompt: 20 | I am getting a `TypeError: unsupported operand type(s) for +: 'int' and 'str'` in my Python code. Here is the code: 21 | 22 | ```python 23 | my_list = [1, 2, 3, '4', 5] 24 | sum = 0 25 | for item in my_list: 26 | sum += item 27 | print(sum) 28 | ``` 29 | 30 | Please explain what is wrong with the code and how to fix it. 31 | ``` 32 | 33 | ## 2. Content Creation 34 | 35 | Language models can be used to generate a wide variety of content, from blog posts and articles to social media posts and creative writing. 36 | 37 | **Example Prompt (Blog Post Idea):** 38 | 39 | ``` 40 | Prompt: 41 | I am a food blogger and I want to write a blog post about the benefits of a plant-based diet. Please give me 5 creative and engaging blog post titles. 42 | ``` 43 | 44 | **Example Prompt (Creative Writing):** 45 | 46 | ``` 47 | Prompt: 48 | Write a short story about a robot who discovers music for the first time. 49 | ``` 50 | 51 | ## 3. Customer Service 52 | 53 | Language models can be used to power chatbots and other customer service applications. They can be used to answer frequently asked questions, provide product information, and even resolve customer issues. 54 | 55 | **Example Prompt (Chatbot):** 56 | 57 | ``` 58 | Prompt: 59 | You are a friendly and helpful chatbot for an e-commerce store. A customer is asking about the status of their order. Please ask for their order number and then provide them with the tracking information. 60 | ``` 61 | 62 | ## 4. Education 63 | 64 | Language models can be used to create personalized learning experiences for students. They can be used to generate practice questions, provide feedback on assignments, and even act as a virtual tutor. 65 | 66 | **Example Prompt (Virtual Tutor):** 67 | 68 | ``` 69 | Prompt: 70 | You are a friendly and encouraging math tutor. A student is struggling with the concept of fractions. Please explain what fractions are in a simple and easy-to-understand way. 71 | ``` 72 | 73 | These are just a few examples of how prompt engineering can be applied to different domains. The possibilities are endless! 74 | 75 | In the next section, we will cover some **[Best Practices & Guidelines](./best_practices.md)** to help you write effective prompts. 76 | -------------------------------------------------------------------------------- /docs/advanced_methodologies.md: -------------------------------------------------------------------------------- 1 | # Advanced Prompting Methodologies 2 | 3 | Once you have mastered the core techniques, you can move on to more advanced methodologies. These techniques can help you to tackle more complex tasks and achieve even better results from your language models. 4 | 5 | ## 1. Self-Consistency 6 | 7 | Self-consistency is a technique that involves generating multiple responses to a prompt and then selecting the most consistent answer. This can help to improve the accuracy of the model's responses, especially for tasks that have a single correct answer. 8 | 9 | **How it works:** 10 | 11 | 1. **Generate multiple responses:** Use a high temperature setting to generate a diverse set of responses to the same prompt. 12 | 2. **Select the most consistent answer:** Choose the answer that appears most frequently in the generated responses. 13 | 14 | ## 2. Generate Knowledge Prompting 15 | 16 | Generate knowledge prompting is a technique that involves asking the model to generate some knowledge about a topic before answering the actual question. This can help the model to provide a more informed and accurate response. 17 | 18 | **Example:** 19 | 20 | ``` 21 | Prompt: 22 | Q: What is the capital of France? 23 | 24 | First, provide some information about France. 25 | 26 | Response: 27 | France is a country in Western Europe. It is known for its culture, cuisine, and landmarks such as the Eiffel Tower. 28 | 29 | The capital of France is Paris. 30 | ``` 31 | 32 | ## 3. Tree of Thoughts (ToT) 33 | 34 | Tree of Thoughts (ToT) is a more advanced technique that allows the model to explore multiple reasoning paths. It involves generating a tree of possible thoughts and then using a search algorithm to find the most promising path. 35 | 36 | ToT is particularly useful for complex tasks that require planning and problem-solving. 37 | 38 | ## 4. Retrieval Augmented Generation (RAG) 39 | 40 | Retrieval Augmented Generation (RAG) is a technique that combines the power of a large language model with the ability to retrieve information from an external knowledge base. This allows the model to access up-to-date information and provide more accurate and factual responses. 41 | 42 | **How it works:** 43 | 44 | 1. **Retrieve relevant information:** When a prompt is given, the RAG system first retrieves relevant information from a knowledge base (e.g., a collection of documents). 45 | 2. **Augment the prompt:** The retrieved information is then added to the original prompt. 46 | 3. **Generate a response:** The augmented prompt is then fed to the language model to generate a response. 47 | 48 | These are just a few of the advanced prompting methodologies that are being explored by researchers and practitioners. As the field of prompt engineering continues to evolve, we can expect to see even more powerful and sophisticated techniques emerge. 49 | 50 | In the next section, we will look at how to apply these techniques to **[Domain-Specific Applications](./domain_specific_applications.md)**. 51 | -------------------------------------------------------------------------------- /docs/best_practices.md: -------------------------------------------------------------------------------- 1 | # Best Practices & Guidelines for Prompt Engineering 2 | 3 | Now that you have a good understanding of the various prompt engineering techniques and their applications, let's review some best practices and guidelines to help you write the most effective prompts. 4 | 5 | ## 1. Be Clear and Specific 6 | 7 | The more specific you are in your prompt, the better the model will be able to understand your request and generate a relevant response. Avoid vague or ambiguous language. 8 | 9 | **Weak Prompt:** 10 | 11 | ``` 12 | Write something about cars. 13 | ``` 14 | 15 | **Strong Prompt:** 16 | 17 | ``` 18 | Write a short blog post (around 300 words) comparing the pros and cons of electric cars vs. gasoline-powered cars, focusing on cost, performance, and environmental impact. 19 | ``` 20 | 21 | ## 2. Provide Context 22 | 23 | Providing context can help the model to better understand the task and generate a more accurate response. This is especially important for tasks that require domain-specific knowledge. 24 | 25 | **Weak Prompt:** 26 | 27 | ``` 28 | What is the best way to learn a new language? 29 | ``` 30 | 31 | **Strong Prompt:** 32 | 33 | ``` 34 | I am a busy professional who wants to learn Spanish for an upcoming trip to Mexico. I have about 30 minutes to study each day. What is the most effective and efficient way for me to learn the basics of Spanish? 35 | ``` 36 | 37 | ## 3. Use a Persona 38 | 39 | Assigning a persona to the model can help to guide its tone and style. This is particularly useful for tasks that require a specific type of writing, such as creative writing or customer service. 40 | 41 | **Example:** 42 | 43 | ``` 44 | Prompt: 45 | You are a witty and sarcastic comedian. Tell me a joke about airplanes. 46 | ``` 47 | 48 | ## 4. Use Delimiters 49 | 50 | Delimiters, such as triple backticks (\`\`\`) or XML tags (``), can be used to separate different parts of your prompt, such as instructions, context, and examples. This can help the model to better understand the structure of your prompt and avoid confusion. 51 | 52 | **Example:** 53 | 54 | ``` 55 | Prompt: 56 | Translate the following text from English to French. 57 | 58 | English Text: 59 | ``` 60 | Hello, how are you? 61 | ``` 62 | ``` 63 | 64 | ## 5. Iterate and Refine 65 | 66 | Don't expect to get the perfect response on your first try. Prompt engineering is an iterative process. Experiment with different prompts, analyze the responses, and refine your prompts based on the results. 67 | 68 | ## 6. Test with Different Models 69 | 70 | Different models have different strengths and weaknesses. What works well with one model may not work as well with another. It's always a good idea to test your prompts with different models to see which one gives you the best results. 71 | 72 | By following these best practices, you can significantly improve the quality of your prompts and get the most out of your interactions with large language models. 73 | 74 | This concludes the core guide. We encourage you to explore the **[Tutorials](./tutorials)** and **[Prompt Library](./examples)** to further your learning and practice your new skills. 75 | -------------------------------------------------------------------------------- /tutorials/beginner_tutorial.md: -------------------------------------------------------------------------------- 1 | # Beginner Tutorial: Creating Your First Prompt 2 | 3 | Welcome to your first hands-on tutorial! In this tutorial, we will walk you through the process of creating a simple prompt to generate a product description. 4 | 5 | ## The Goal 6 | 7 | Our goal is to generate a short, engaging, and informative product description for a new type of a reusable coffee cup. 8 | 9 | ## Step 1: Identify the Key Information 10 | 11 | Before we can write our prompt, we need to identify the key information that we want to include in the product description. For our reusable coffee cup, let's say the key features are: 12 | 13 | - Made from sustainable bamboo fiber 14 | - Leak-proof lid 15 | - Insulated to keep drinks hot for up to 2 hours 16 | - Available in 3 colors: green, blue, and pink 17 | 18 | ## Step 2: Write a Basic Prompt 19 | 20 | Now, let's start with a basic prompt that includes the key information we identified. 21 | 22 | ``` 23 | Prompt: 24 | Write a product description for a new reusable coffee cup. It is made from sustainable bamboo fiber, has a leak-proof lid, is insulated to keep drinks hot for up to 2 hours, and comes in 3 colors: green, blue, and pink. 25 | ``` 26 | 27 | ## Step 3: Add a Persona 28 | 29 | To make the product description more engaging, let's add a persona to our prompt. Let's say we want the tone to be friendly and enthusiastic. 30 | 31 | ``` 32 | Prompt: 33 | You are a friendly and enthusiastic copywriter. Write a product description for a new reusable coffee cup. It is made from sustainable bamboo fiber, has a leak-proof lid, is insulated to keep drinks hot for up to 2 hours, and comes in 3 colors: green, blue, and pink. 34 | ``` 35 | 36 | ## Step 4: Specify the Desired Length 37 | 38 | To ensure the product description is concise, let's specify the desired length. 39 | 40 | ``` 41 | Prompt: 42 | You are a friendly and enthusiastic copywriter. Write a short product description (around 50 words) for a new reusable coffee cup. It is made from sustainable bamboo fiber, has a leak-proof lid, is insulated to keep drinks hot for up to 2 hours, and comes in 3 colors: green, blue, and pink. 43 | ``` 44 | 45 | ## Step 5: Iterate and Refine 46 | 47 | Now, let's try running our prompt through a language model. Here is a possible response: 48 | 49 | > Say hello to your new favorite coffee cup! Made from sustainable bamboo fiber, this stylish cup is perfect for your daily caffeine fix. The leak-proof lid means no more spills, and the insulation will keep your coffee hot for up to 2 hours. Choose from 3 beautiful colors: green, blue, or pink. Get yours today! 50 | 51 | This is a pretty good response! But we can always try to improve it. For example, we could try adding a call to action, or highlighting a specific benefit. 52 | 53 | **Revised Prompt:** 54 | 55 | ``` 56 | Prompt: 57 | You are a friendly and enthusiastic copywriter. Write a short and catchy product description (around 50 words) for a new reusable coffee cup. The product description should highlight the eco-friendly aspect of the cup and have a strong call to action. It is made from sustainable bamboo fiber, has a leak-proof lid, is insulated to keep drinks hot for up to 2 hours, and comes in 3 colors: green, blue, and pink. 58 | ``` 59 | 60 | ## Conclusion 61 | 62 | Congratulations! You have successfully created your first prompt. As you can see, prompt engineering is an iterative process. By following these steps, you can create effective prompts that will help you to get the most out of your interactions with language models. 63 | -------------------------------------------------------------------------------- /docs/core_techniques.md: -------------------------------------------------------------------------------- 1 | # Core Prompting Techniques 2 | 3 | Now that you understand the basics of prompt engineering, let's explore some of the most effective core techniques. These techniques are the building blocks of more advanced prompting strategies. 4 | 5 | ## 1. Zero-Shot Prompting 6 | 7 | Zero-shot prompting is the simplest form of prompting. It involves asking the model to perform a task without providing any examples. The model is expected to understand the task and generate a response based on its existing knowledge. 8 | 9 | **Example:** 10 | 11 | ``` 12 | Prompt: 13 | Translate the following English text to French: 14 | "Hello, how are you?" 15 | 16 | Response: 17 | "Bonjour, comment ça va ?" 18 | ``` 19 | 20 | Zero-shot prompting works well for simple tasks and when you want to see the model's baseline performance. 21 | 22 | ## 2. Few-Shot Prompting 23 | 24 | Few-shot prompting involves providing the model with a few examples of the task you want it to perform. This helps the model to better understand the context and generate a more accurate response. 25 | 26 | **Example:** 27 | 28 | ``` 29 | Prompt: 30 | Translate the following English text to French: 31 | 32 | English: "Hello, how are you?" 33 | French: "Bonjour, comment ça va ?" 34 | 35 | English: "I am doing well, thank you." 36 | French: "Je vais bien, merci." 37 | 38 | English: "What is your name?" 39 | French: 40 | 41 | Response: 42 | "Quel est votre nom ?" 43 | ``` 44 | 45 | Few-shot prompting is particularly useful for tasks that require a specific format or style. 46 | 47 | ## 3. Chain-of-Thought (CoT) Prompting 48 | 49 | Chain-of-Thought (CoT) prompting is a technique that encourages the model to think step-by-step. It involves asking the model to explain its reasoning process before giving the final answer. This can significantly improve the accuracy of the model's responses, especially for complex reasoning tasks. 50 | 51 | **Example:** 52 | 53 | ``` 54 | Prompt: 55 | Q: The cafeteria had 23 apples. If they used 20 to make lunch and bought 6 more, how many apples do they have? 56 | 57 | A: Let's think step by step. First, they started with 23 apples. Then they used 20 apples for lunch, so they had 23 - 20 = 3 apples left. After that, they bought 6 more apples, so they now have 3 + 6 = 9 apples. So the answer is 9. 58 | 59 | Q: 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? 60 | 61 | A: 62 | 63 | Response: 64 | Let's think step by step. Roger started with 5 tennis balls. He bought 2 cans of tennis balls, and each can has 3 tennis balls, so he bought 2 * 3 = 6 more tennis balls. Now he has 5 + 6 = 11 tennis balls. So the answer is 11. 65 | ``` 66 | 67 | ## 4. Role Prompting 68 | 69 | Role prompting involves assigning a specific role to the AI model. This can help to guide the model's responses and make them more relevant to the task at hand. 70 | 71 | **Example:** 72 | 73 | ``` 74 | Prompt: 75 | You are a helpful and friendly customer service representative. A customer is asking for a refund for a product they are not satisfied with. Please write a polite and helpful response. 76 | 77 | Response: 78 | Of course! I understand that you're not satisfied with your recent purchase, and I'd be happy to help you with a refund. Could you please provide me with your order number so I can process the refund for you? 79 | ``` 80 | 81 | These core techniques are essential for effective prompt engineering. In the next section, we will explore some **[Advanced Methodologies](./advanced_methodologies.md)** that build upon these fundamentals. 82 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 🧠 The Ultimate Prompt Engineering Guide 2 | 3 |
4 | 5 | [![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](https://choosealicense.com/licenses/mit/) 6 | [![GitHub stars](https://img.shields.io/github/stars/oxbshw/Prompt-Engineering-Guide.svg?style=social&label=Star)](https://github.com/oxbshw/Prompt-Engineering-Guide) 7 | [![GitHub forks](https://img.shields.io/github/forks/oxbshw/Prompt-Engineering-Guide.svg?style=social&label=Fork)](https://github.com/oxbshw/Prompt-Engineering-Guide/fork) 8 | [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) 9 | [![Awesome](https://awesome.re/badge.svg)](https://awesome.re) 10 | 11 | **A comprehensive, community-driven guide to mastering prompt engineering** 12 | 13 | *Transform your AI interactions with expert techniques, proven strategies, and hands-on tutorials* 14 | 15 | [🚀 Get Started](#-quick-start) • 16 | [📖 Documentation](#-documentation) • 17 | [💡 Examples](#-prompt-library) • 18 | [🛠️ Tools](#-tools--resources) • 19 | [🤝 Contribute](#-contributing) 20 | 21 |
22 | 23 | --- 24 | 25 | ## 🌟 Overview 26 | 27 | This repository is your **one-stop resource** for mastering the art and science of prompt engineering. Whether you're a beginner exploring language models or an experienced developer enhancing your AI workflow, this guide provides practical, actionable insights to elevate your prompt crafting skills. 28 | 29 | ### ✨ What Makes This Guide Special 30 | 31 | - 🎯 **Comprehensive Coverage**: From fundamentals to advanced techniques 32 | - 🔬 **Research-Backed**: Based on latest academic findings and industry best practices 33 | - 🛠️ **Practical Focus**: Real-world examples and hands-on tutorials 34 | - 🌍 **Community-Driven**: Continuously updated by practitioners worldwide 35 | - 📊 **Multi-Model Support**: Techniques for ChatGPT, Claude, GPT-4, and more 36 | 37 | --- 38 | 39 | ## 🚀 Quick Start 40 | 41 | ### For Beginners 42 | 1. **Start Here**: [Introduction to Prompt Engineering](docs/introduction.md) 43 | 2. **Learn Basics**: [Core Techniques](docs/core_techniques.md) 44 | 3. **Practice**: [Beginner Tutorial](tutorials/beginner_tutorial.md) 45 | 46 | ### For Experienced Users 47 | 1. **Advanced Methods**: [Advanced Methodologies](docs/advanced_methodologies.md) 48 | 2. **Specialized Applications**: [Domain-Specific Applications](docs/domain_specific_applications.md) 49 | 3. **Best Practices**: [Guidelines & Standards](docs/best_practices.md) 50 | 51 | ### 🎯 Learning Path 52 | 53 | ```mermaid 54 | graph LR 55 | A[📚 Introduction] --> B[🔧 Core Techniques] 56 | B --> C[🎓 Hands-on Tutorial] 57 | C --> D[🚀 Advanced Methods] 58 | D --> E[🏭 Domain Applications] 59 | E --> F[✅ Best Practices] 60 | ``` 61 | 62 | --- 63 | 64 | ## 📖 Documentation 65 | 66 | ### 📋 Table of Contents 67 | 68 | | Section | Description | Level | 69 | |---------|-------------|-------| 70 | | [🌱 Introduction](docs/introduction.md) | Fundamentals and key concepts | Beginner | 71 | | [🔧 Core Techniques](docs/core_techniques.md) | Essential prompting strategies | Beginner-Intermediate | 72 | | [🚀 Advanced Methodologies](docs/advanced_methodologies.md) | Complex techniques and patterns | Advanced | 73 | | [🏭 Domain Applications](docs/domain_specific_applications.md) | Industry-specific use cases | Intermediate-Advanced | 74 | | [✅ Best Practices](docs/best_practices.md) | Guidelines and optimization | All Levels | 75 | 76 | ### 🎓 Interactive Learning 77 | 78 | | Tutorial | Focus Area | Duration | 79 | |----------|------------|----------| 80 | | [Beginner's Guide](tutorials/beginner_tutorial.md) | Getting started with prompts | 30 min | 81 | | [Advanced Patterns](tutorials/README.md) | Complex prompt structures | 45 min | 82 | 83 | --- 84 | 85 | ## 💡 Prompt Library 86 | 87 | Explore our curated collection of high-quality prompts organized by use case: 88 | 89 | ### 📁 Categories 90 | 91 | | Category | Examples | Use Cases | 92 | |----------|----------|-----------| 93 | | [✍️ Content Creation](examples/content_creation.md) | 15+ prompts | Writing, blogs, marketing copy | 94 | | [💻 Code Generation](examples/code_generation.md) | 20+ prompts | Programming, debugging, documentation | 95 | | [🎓 Education](examples/education.md) | 12+ prompts | Learning, tutoring, explanations | 96 | | [🤝 Customer Service](examples/customer_service.md) | 10+ prompts | Support, communication, problem-solving | 97 | 98 | ### 🔥 Popular Prompts 99 | 100 |
101 | 📝 Content Writing Assistant 102 | 103 | ``` 104 | Act as a professional content writer. Create engaging, SEO-optimized content about [TOPIC]. 105 | Structure: compelling headline, introduction with hook, main points with subheadings, conclusion with CTA. 106 | Tone: [professional/casual/friendly], Target audience: [specify], Word count: [number]. 107 | ``` 108 | 109 |
110 | 111 |
112 | 🐛 Code Debugging Expert 113 | 114 | ``` 115 | As an expert programmer, analyze this code for bugs and optimization opportunities: 116 | 117 | [CODE] 118 | 119 | Please provide: 120 | 1. Identified issues with explanations 121 | 2. Corrected code with improvements 122 | 3. Best practice recommendations 123 | 4. Performance optimization suggestions 124 | ``` 125 | 126 |
127 | 128 | --- 129 | 130 | ## 🛠️ Tools & Resources 131 | 132 | ### 🔧 Recommended Tools 133 | 134 | | Tool | Category | Description | Free Tier | 135 | |------|----------|-------------|-----------| 136 | | [ChatGPT](https://chat.openai.com) | General AI | Versatile conversational AI | ✅ Yes | 137 | | [Claude](https://claude.ai) | AI Assistant | Advanced reasoning and analysis | ✅ Yes | 138 | | [Prompt Base](https://promptbase.com) | Marketplace | Buy/sell quality prompts | ❌ Paid | 139 | | [LangChain](https://langchain.com) | Framework | Prompt engineering toolkit | ✅ Open Source | 140 | 141 | ### 📚 Learning Resources 142 | 143 | - **📖 Books**: [Essential reading list](resources/README.md#books) 144 | - **🎥 Videos**: [Curated tutorial videos](resources/README.md#videos) 145 | - **📰 Articles**: [Latest research papers](resources/README.md#research) 146 | - **🌐 Communities**: [Active discussion forums](resources/README.md#communities) 147 | 148 | --- 149 | 150 | ## 📊 Repository Statistics 151 | 152 |
153 | 154 | ![GitHub stars](https://img.shields.io/github/stars/oxbshw/Prompt-Engineering-Guide?style=for-the-badge) 155 | ![GitHub forks](https://img.shields.io/github/forks/oxbshw/Prompt-Engineering-Guide?style=for-the-badge) 156 | ![GitHub issues](https://img.shields.io/github/issues/oxbshw/Prompt-Engineering-Guide?style=for-the-badge) 157 | ![GitHub pull requests](https://img.shields.io/github/issues-pr/oxbshw/Prompt-Engineering-Guide?style=for-the-badge) 158 | 159 |
160 | 161 | --- 162 | 163 | ## 🤝 Contributing 164 | 165 | We welcome contributions from the community! Here's how you can help: 166 | 167 | ### 🎯 Ways to Contribute 168 | 169 | - 📝 **Add Content**: Share your prompt engineering techniques and examples 170 | - 🐛 **Report Issues**: Help us identify and fix problems 171 | - 💡 **Suggest Features**: Propose new sections or improvements 172 | - 🔍 **Review**: Help review pull requests and provide feedback 173 | - 🌍 **Translate**: Help make this guide accessible globally 174 | 175 | ### 📋 Contribution Process 176 | 177 | 1. **Fork** the repository 178 | 2. **Create** a feature branch (`git checkout -b feature/amazing-prompts`) 179 | 3. **Commit** your changes (`git commit -m 'Add amazing prompts'`) 180 | 4. **Push** to the branch (`git push origin feature/amazing-prompts`) 181 | 5. **Open** a Pull Request 182 | 183 | **Read our full [Contributing Guidelines](CONTRIBUTING.md) for detailed instructions.** 184 | 185 | ### 🏆 Contributors 186 | 187 | Thanks to all our amazing contributors! 🙏 188 | 189 |
190 | 191 | 192 | 193 |
194 | 195 | --- 196 | 197 | ## 🗺️ Roadmap 198 | 199 | ### 🎯 Current Focus (2025 Q2) 200 | - [ ] Interactive web tutorials 201 | - [ ] Video content series 202 | - [ ] Multi-language support 203 | - [ ] Community discussion forum 204 | 205 | ### 🔮 Future Plans 206 | - [ ] Mobile app companion 207 | - [ ] AI-powered prompt optimizer 208 | - [ ] Integration with popular IDEs 209 | - [ ] Certification program 210 | 211 | --- 212 | 213 | ## 📞 Support & Community 214 | 215 | ### 💬 Get Help 216 | 217 | - **📚 Documentation**: Check our [comprehensive guides](docs/) 218 | - **❓ Issues**: [Create an issue](https://github.com/oxbshw/Prompt-Engineering-Guide/issues) for bugs or questions 219 | - **💡 Discussions**: Join [GitHub Discussions](https://github.com/oxbshw/Prompt-Engineering-Guide/discussions) for community support 220 | 221 | ### 🌐 Connect With Us 222 | 223 | - **🐦 Twitter**: Follow for updates and tips 224 | - **💼 LinkedIn**: Connect with the community 225 | - **📧 Email**: Contact the maintainers 226 | 227 | --- 228 | 229 | ## 📄 License 230 | 231 | This project is licensed under the **MIT License** - see the [LICENSE](LICENSE) file for details. 232 | 233 | ### 📝 Citation 234 | 235 | If you use this guide in your research or projects, please cite: 236 | 237 | ```bibtex 238 | @misc{prompt_engineering_guide_2025, 239 | title={The Ultimate Prompt Engineering Guide}, 240 | author={oxbshw and contributors}, 241 | year={2025}, 242 | url={https://github.com/oxbshw/Prompt-Engineering-Guide} 243 | } 244 | ``` 245 | 246 | --- 247 | 248 | ## 🙏 Acknowledgments 249 | 250 | This guide builds upon the excellent work of the prompt engineering community, including: 251 | 252 | - [DAIR.AI Prompt Engineering Guide](https://github.com/dair-ai/Prompt-Engineering-Guide) 253 | - [NirDiamant's Prompt Engineering](https://github.com/NirDiamant/Prompt_Engineering) 254 | - [Awesome Prompt Engineering](https://github.com/promptslab/Awesome-Prompt-Engineering) 255 | - [Anthropic's Interactive Tutorial](https://github.com/anthropics/prompt-eng-interactive-tutorial) 256 | - [Learn Prompting](https://github.com/trigaten/Learn_Prompting) 257 | 258 | --- 259 | 260 |
261 | 262 | **⭐ Star this repository if you find it helpful!** 263 | 264 | *Made with ❤️ by the prompt engineering community* 265 | 266 | [⬆️ Back to Top](#-the-ultimate-prompt-engineering-guide) 267 | 268 |
269 | --------------------------------------------------------------------------------