Prompt Engineering Guide — 73K-Star Learning Hub
The most comprehensive open-source prompt engineering resource with guides, papers, notebooks, and courses covering chain-of-thought, RAG, AI agents, and 13 languages. 3M+ learners, MIT.
What it is
The Prompt Engineering Guide is an open-source educational resource covering prompt engineering techniques for large language models. It includes written guides, research paper summaries, Jupyter notebooks, and course materials on topics like chain-of-thought prompting, retrieval-augmented generation, AI agents, and multi-modal models. The content is available in 13 languages.
This resource targets developers, researchers, and AI practitioners who want to understand and apply prompt engineering systematically rather than through trial and error.
How it saves time or tokens
Understanding prompt engineering techniques directly reduces token waste. A well-structured prompt that uses chain-of-thought or few-shot examples gets better results on the first try, avoiding the iterative cycle of prompt refinement that consumes tokens.
The guide covers token-efficient patterns: when to use system prompts vs user prompts, how to structure few-shot examples for maximum effect, and when chain-of-thought helps vs hurts (simple tasks do not benefit from verbose reasoning).
How to use
- Clone the repository or read online:
git clone https://github.com/dair-ai/Prompt-Engineering-Guide.git
cd Prompt-Engineering-Guide
- Start with the fundamentals:
guides/
prompts-intro.md # Introduction to prompting
prompts-basic-usage.md # Basic techniques
prompts-advanced.md # Advanced patterns
prompts-chatgpt.md # ChatGPT-specific tips
prompts-applications.md # Real-world applications
- Explore technique-specific notebooks in the
notebooks/directory for hands-on practice.
Example
Chain-of-thought prompting pattern from the guide:
# Without CoT (often wrong on complex tasks)
Q: Roger has 5 tennis balls. He buys 2 more cans
of 3 tennis balls each. How many does he have?
A: 11
# With CoT (step-by-step reasoning)
Q: Roger has 5 tennis balls. He buys 2 more cans
of 3 tennis balls each. How many does he have?
A: Roger starts with 5 balls.
He buys 2 cans of 3 balls each = 6 balls.
5 + 6 = 11.
The answer is 11.
Explicit reasoning steps improve accuracy on math, logic, and multi-step tasks.
Related on TokRepo
- Prompt library -- Curated prompts and templates for various AI tasks
- AI tools for research -- Research tools and resources for AI practitioners
Common pitfalls
- Applying chain-of-thought to every prompt. Simple factual questions and classification tasks do not benefit from verbose reasoning. CoT adds tokens without improving accuracy on straightforward tasks.
- Ignoring model-specific prompt formats. Claude, GPT-4, and Gemini have different system prompt conventions and capabilities. Techniques that work on one model may underperform on another.
- Over-engineering prompts when a simple instruction suffices. Start with the simplest prompt that works and add complexity only when needed.
Frequently Asked Questions
The guide covers foundational techniques (zero-shot, few-shot, chain-of-thought), advanced patterns (tree-of-thought, RAG, agents), model-specific tips (GPT-4, Claude, Llama), and applications (code generation, reasoning, creative writing). It also summarizes relevant research papers.
Yes. The entire guide is open source under the MIT license. All written content, notebooks, and course materials are freely available on GitHub and the project website.
The guide is actively maintained by the DAIR.AI community. New techniques, model-specific tips, and research summaries are added regularly. Contributors submit updates via pull requests.
Yes. The MIT license permits use in educational settings, including university courses, corporate training, and workshops. Attribution to the project is appreciated but not legally required.
Yes. The guide includes sections on Claude-specific prompting techniques, including system prompts, XML tags for structured output, and Anthropic's recommended prompt engineering patterns.
Citations (3)
- Prompt Engineering Guide GitHub— The most comprehensive open-source prompt engineering resource
- Chain-of-Thought Prompting Paper— Chain-of-thought prompting improves reasoning accuracy
- Anthropic Prompt Engineering Guide— Anthropic prompt engineering best practices
Related on TokRepo
Source & Thanks
Created by DAIR.AI. Licensed under MIT.
Prompt-Engineering-Guide — ⭐ 72,900+