NirDiamant/Prompt_Engineering
An open-source entry in TopGit's GitHub warehouse: NirDiamant/Prompt_Engineering, 7.8k stars, Jupyter Notebook. 22 prompt engineering techniques with hands-on Jupyter Notebook tutorials, from fundamental concepts to advanced strategies for leveraging LLMs.
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
Snapshot
Top contributors
Show top contributors
Prompt Engineering Techniques: Comprehensive Repository for Development and Implementation 🖋️
Welcome to one of the most extensive and dynamic collections of Prompt Engineering tutorials and implementations available today. This repository serves as a comprehensive resource for learning, building, and sharing prompt engineering techniques, ranging from basic concepts to advanced strategies for leveraging large language models.
22 hands-on tutorials covering everything from basic prompt templates to advanced techniques like chain-of-thought, self-consistency, and tree-of-thought prompting.
🎓 From prompts to production
Prompt to Production - my full course on building software with AI the way professionals do: the methods and paradigms behind reliable, efficient, modular production systems, taught systematically. 17 modules, each pairing a video lecture with a hands-on lab, from your first structured prompt to a working production system.
🎁 Try a full module, free
| 🎬 7-minute video lecture | 🛠️ Hands-on tutorial | 🤖 AI assistant inside Claude Code |
One npm install adds the module's AI assistant to your Claude Code, and it guides you through the tutorial as you build.
🎯 Sponsors
📫 Stay Updated!
| 🚀 Cutting-edge Updates | 💡 Expert Insights | 🎯 Top 0.1% Content |
Join over 50,000 AI enthusiasts getting unique cutting-edge insights and free tutorials! Plus, subscribers get exclusive early access and special discounts to our upcoming RAG Techniques course!

🎬 Prefer video?
I break these ideas down into short, one-idea-per-episode explainers on YouTube.
How LLMs Actually Work (and Why AI Makes Things Up) recalling a fact and inventing one are literally the same move |
Context Is the New Code the shift from writing the code to shaping what the model sees |
Stop Thinking Claude Code Is Magic. Here's How It Works what the agent loop is actually doing on every turn |
Browse every episode →
Introduction
Prompt engineering is at the forefront of artificial intelligence, revolutionizing the way we interact with and leverage AI technologies. This repository is designed to guide you through the development journey, from basic prompt structures to advanced, cutting-edge techniques.
Our goal is to provide a valuable resource for everyone - from beginners taking their first steps in AI to seasoned practitioners pushing the boundaries of what's possible. By offering a range of examples from foundational to complex, we aim to facilitate learning, experimentation, and innovation in the rapidly evolving field of prompt engineering.
Furthermore, this repository serves as a platform for showcasing innovative prompt engineering techniques. Whether you've developed a novel approach or found an innovative application for existing techniques, we encourage you to share your work with the community.
📖 The book version of this repo
Prompt Engineering from Zero to Hero - all 22 techniques from this repo, fully explained with step-by-step breakdowns and hands-on exercises.
Amazon Kindle - $9.99 · Paperback · Gumroad PDF
Related Projects
🔍 RAG Techniques - 40+ notebooks on retrieval-augmented generation.
🤖 GenAI Agents - implementations and tutorials for building AI agent systems.
🚀 Agents Towards Production - code-first tutorials for shipping production-grade agents.
🧠 Agent Memory Techniques - 30 notebooks on agent memory: vector stores, graphs, Mem0, Zep.
Join the community
Contributions make this better - propose ideas, share techniques, or give feedback via CONTRIBUTING.md.
r/EducationalAI · Discord · LinkedIn
Key Features
- 🎓 Learn prompt engineering techniques from beginner to advanced levels
- 🧠 Explore a wide range of prompt structures and applications
- 📚 Step-by-step tutorials and comprehensive documentation
- 🛠️ Practical, ready-to-use prompt implementations
- 🌟 Regular updates with the latest advancements in prompt engineering
- 🤝 Share your own prompt engineering creations with the community
Prompt Engineering Techniques
Explore our extensive list of prompt engineering techniques, ranging from basic to advanced:
| # | Category | Technique | Description |
|---|---|---|---|
| 1 | 🎓 Fundamental Concepts | Introduction to Prompt Engineering | Comprehensive introduction to fundamental concepts of prompt engineering |
| 2 | 🎓 Fundamental Concepts | Basic Prompt Structures | Exploration of single-turn and multi-turn prompt structures |
| 3 | 🎓 Fundamental Concepts | Prompt Templates and Variables | Creating and using prompt templates with variables |
| 4 | 🔧 Core Techniques | Zero-Shot Prompting | Performing tasks without specific examples |
| 5 | 🔧 Core Techniques | Few-Shot Learning | Learning from a small number of examples |
| 6 | 🔧 Core Techniques | Chain of Thought (CoT) | Step-by-step reasoning processes |
| 7 | 🎯 Advanced Strategies | Self-Consistency | Multiple reasoning paths and result aggregation |
| 8 | 🎯 Advanced Strategies | Constrained Generation | Setting up output constraints |
| 9 | 🎯 Advanced Strategies | Role Prompting | Assigning specific roles to AI models |
| 10 | 🚀 Advanced Implementations | Task Decomposition | Breaking down complex tasks |
| 11 | 🚀 Advanced Implementations | Prompt Chaining | Connecting multiple prompts |
| 12 | 🚀 Advanced Implementations | Instruction Engineering | Crafting clear instructions |
| 13 | ⚡ Optimization | Prompt Optimization | A/B testing and refinement |
| 14 | ⚡ Optimization | Handling Ambiguity | Resolving ambiguous prompts |
| 15 | ⚡ Optimization | Length Management | Managing prompt complexity |
| 16 | 🛠️ Specialized Applications | Negative Prompting | Avoiding undesired outputs |
| 17 | 🛠️ Specialized Applications | Prompt Formatting | Various prompt formats |
| 18 | 🛠️ Specialized Applications | Task-Specific Prompts | Prompts for specific tasks |
| 19 | 🌍 Advanced Applications | Multilingual Prompting | Cross-lingual techniques |
| 20 | 🌍 Advanced Applications | Ethical Considerations | Bias avoidance and inclusivity |
| 21 | 🌍 Advanced Applications | Prompt Security | Preventing injections |
| 22 | 🌍 Advanced Applications | Effectiveness Evaluation | Evaluating prompt performance |
🌱 Fundamental Concepts
-
Introduction to Prompt Engineering
Overview 🔎
A comprehensive introduction to the fundamental concepts of prompt engineering in the context of AI and language models.
Implementation 🛠️
Combines theoretical explanations with practical demonstrations, covering basic concepts, structured prompts, comparative analysis, and problem-solving applications.
-
Basic Prompt Structures
Overview 🔎
Explores two fundamental types of prompt structures: single-turn prompts and multi-turn prompts (conversations).
Implementation 🛠️
Uses OpenAI's GPT model and LangChain to demonstrate single-turn and multi-turn prompts, prompt templates, and conversation chains.
-
Prompt Templates and Variables
Overview 🔎
Introduces creating and using prompt templates with variables, focusing on Python and the Jinja2 templating engine.
Implementation 🛠️
Covers template creation, variable insertion, conditional content, list processing, and integration with the OpenAI API.
🔧 Core Techniques
-
Zero-Shot Prompting
Overview 🔎
Explores zero-shot prompting, allowing language models to perform tasks without specific examples or prior training.
Implementation 🛠️
Demonstrates direct task specification, role-based prompting, format specification, and multi-step reasoning using OpenAI and LangChain.
-
Few-Shot Learning and In-Context Learning
Overview 🔎
Covers Few-Shot Learning and In-Context Learning techniques using OpenAI's GPT models and the LangChain library.
Implementation 🛠️
Implements basic and advanced few-shot learning, in-context learning, and best practices for example selection and evaluation.
-
Chain of Thought (CoT) Prompting
Overview 🔎
Introduces Chain of Thought (CoT) prompting, encouraging AI models to break down complex problems into step-by-step reasoning processes.
Implementation 🛠️
Covers basic and advanced CoT techniques, applying them to various problem-solving scenarios and comparing results with standard prompts.
🔍 Advanced Strategies
-
Self-Consistency and Multiple Paths of Reasoning
Overview 🔎
Explores techniques for generating diverse reasoning paths and aggregating results to improve AI-generated answers.
Implementation 🛠️
Demonstrates designing diverse reasoning prompts, generating multiple responses, implementing aggregation methods, and applying self-consistency checks.
-
Constrained and Guided Generation
Overview 🔎
Focuses on techniques to set up constraints for model outputs and implement rule-based generation.
Implementation 🛠️
Uses LangChain's PromptTemplate for structured prompts, implements constraints, and explores rule-based generation techniques.
-
Role Prompting
Overview 🔎
Explores assigning specific roles to AI models and crafting effective role descriptions.
Implementation 🛠️
Demonstrates creating role-based prompts, assigning roles to AI models, and refining role descriptions for various scenarios.
🚀 Advanced Implementations
-
Task Decomposition in Prompts
Overview 🔎
Explores techniques for breaking down complex tasks and chaining subtasks in prompts.
Implementation 🛠️
Covers problem analysis, subtask definition, targeted prompt engineering, sequential execution, and result synthesis.
-
Prompt Chaining and Sequencing
Overview 🔎
Demonstrates how to connect multiple prompts and build logical flows for complex AI-driven tasks.
Implementation 🛠️
Explores basic prompt chaining, sequential prompting, dynamic prompt generation, and error handling within prompt chains.
-
Instruction Engineering
Overview 🔎
Focuses on crafting clear and effective instructions for language models, balancing specificity and generality.
Implementation 🛠️
Covers creating and refining instructions, experimenting with different structures, and implementing iterative improvement based on model responses.
🎨 Optimization and Refinement
-
Prompt Optimization Techniques
Overview 🔎
Explores advanced techniques for optimizing prompts, focusing on A/B testing and iterative refinement.
Implementation 🛠️
Demonstrates A/B testing of prompts, iterative refinement processes, and performance evaluation using relevant metrics.
-
Handling Ambiguity and Improving Clarity
Overview 🔎
Focuses on identifying and resolving ambiguous prompts and techniques for writing clearer prompts.
Implementation 🛠️
Covers analyzing ambiguous prompts, implementing strategies to resolve ambiguity, and exploring techniques for writing clearer prompts.
-
Prompt Length and Complexity Management
Overview 🔎
Explores techniques for managing prompt length and complexity when working with large language models.
Implementation 🛠️
Demonstrates techniques for balancing detail and conciseness, and strategies for handling long contexts including chunking, summarization, and iterative processing.
🛠️ Specialized Applications
-
Negative Prompting and Avoiding Undesired Outputs
Overview 🔎
Explores negative prompting and techniques for avoiding undesired outputs from large language models.
Implementation 🛠️
Covers basic negative examples, explicit exclusions, constraint implementation using LangChain, and methods for evaluating and refining negative prompts.
-
Prompt Formatting and Structure
Overview 🔎
Explores various prompt formats and structural elements, demonstrating their impact on AI model responses.
Implementation 🛠️
Demonstrates creating various prompt formats, incorporating structural elements, and comparing responses from different prompt structures.
-
Prompts for Specific Tasks
Overview 🔎
Explores the creation and use of prompts for specific tasks: text summarization, question-answering, code generation, and creative writing.
Implementation 🛠️
Covers designing task-specific prompt templates, implementing them using LangChain, executing with sample inputs, and analyzing outputs for each task type.
🌍 Advanced Applications
-
Multilingual and Cross-lingual Prompting
Overview 🔎
Explores techniques for designing prompts that work effectively across multiple languages and for language translation tasks.
Implementation 🛠️
Covers creating multilingual prompts, implementing language detection and adaptation, designing cross-lingual translation prompts, and handling various writing systems and scripts.
-
Ethical Considerations in Prompt Engineering
Overview 🔎
Explores the ethical dimensions of prompt engineering, focusing on avoiding biases and creating inclusive and fair prompts.
Implementation 🛠️
Covers identifying biases in prompts, implementing strategies to create inclusive prompts, and methods to evaluate and improve the ethical quality of AI outputs.
-
Prompt Security and Safety
Overview 🔎
Focuses on preventing prompt injections and implementing content filters in prompts for safe and secure AI applications.
Implementation 🛠️
Covers techniques for prompt injection prevention, content filtering implementation, and testing the effectiveness of security and safety measures.
-
Evaluating Prompt Effectiveness
Overview 🔎
Explores methods and techniques for evaluating the effectiveness of prompts in AI language models.
Implementation 🛠️
Covers setting up evaluation metrics, implementing manual and automated evaluation techniques, and providing practical examples using OpenAI and LangChain.
Getting Started
To begin exploring and implementing prompt engineering techniques:
- Clone this repository:
git clone https://github.com/NirDiamant/Prompt_Engineering.git - Navigate to the technique you're interested in:
cd all_prompt_engineering_techniques - Follow the detailed implementation guide in each technique's notebook.
📚 Recommended reading
This list contains Amazon affiliate links. As an Amazon Associate I earn from qualifying purchases. Every book below is one I've read and genuinely recommend to engineers working in this space. The companion book to this repo is featured separately at the top of this README.
- Build a Large Language Model (From Scratch) by Sebastian Raschka. Build a GPT-style model end to end in PyTorch.
- AI Engineering: Building Applications with Foundation Models by Chip Huyen. Canonical reference for productionizing foundation-model apps.
- Hands-On Large Language Models by Jay Alammar and Maarten Grootendorst. Visual, practical LLM walkthroughs.
- Natural Language Processing with Transformers by Lewis Tunstall, Leandro von Werra, and Thomas Wolf. From the Hugging Face team.
- Designing Machine Learning Systems by Chip Huyen. ML systems in production, still the standard reference.
📚 More from the same author
RAG Made Simple - the 400-page visual guide to RAG, the retrieval layer behind advanced agents. 33% off with code RAGKING.
Run a course, newsletter, or dev community? You can earn 25% recommending the books to your audience.
Contributing
We welcome contributions from the community! If you have a new technique or improvement to suggest:
- Fork the repository
- Create your feature branch:
git checkout -b feature/AmazingFeature - Commit your changes:
git commit -m 'Add some AmazingFeature' - Push to the branch:
git push origin feature/AmazingFeature - Open a pull request
License
This project is licensed under a custom non-commercial license - see the LICENSE file for details.
⭐️ If you find this repository helpful, please consider giving it a star!
Keywords: Prompt Engineering, AI, Machine Learning, Natural Language Processing, LLM, Language Models, NLP, Conversational AI, Zero-Shot Learning, Few-Shot Learning, Chain of Thought
Related repositories
AutoGPT is an open-source platform designed for building, deploying, and running AI agents that can carry out complete workflows. Users can define tasks in plain English or use a visual builder to shape each step. The project offers two primary paths: a managed, hosted AutoGPT Platform that handles infrastructure and model access for a fee, and a self-hosting option that is free but requires users to provide their own infrastructure and model API keys. Agents can run on demand, on schedules, or from triggers, connecting to over 45 platforms and hundreds of AI models. It's presented as a tool to automate various functions, from executive operations and sales research to marketing campaign drafts and incident triage in engineering.
Hermes Agent (NousResearch/hermes-agent) is an open-source, self-improving AI agent from Nous Research, written in Python and released under the MIT license. The README describes a closed learning loop, a terminal UI, and a messaging gateway spanning Telegram, Discord, Slack, WhatsApp, and Signal, plus support for running the agent on a VPS, a GPU cluster, or serverless infrastructure.
ECC is an MIT-licensed system from affaan-m/ECC that installs into AI coding agent harnesses such as Claude Code, Codex, and several others, adding skills, specialized agents, persistent memory, and AgentShield security scanning around whatever large language model the harness already runs. The README positions it as developer productivity tooling for LLM agent development and agent performance tuning rather than a code generation tool itself, composing around whichever model the harness already calls.
The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Quick answers
How active is development on NirDiamant/Prompt_Engineering?
The most recent commit recorded on NirDiamant/Prompt_Engineering was 17 days ago, based on the GitHub push timestamp. The repository has 1.0k forks — one of the better signals of community interest.
How many stars does NirDiamant/Prompt_Engineering have?
NirDiamant/Prompt_Engineering has 7.8k GitHub stars — refresh the page for the live number, or check github.com/NirDiamant/Prompt_Engineering. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
What is NirDiamant/Prompt_Engineering?
NirDiamant/Prompt_Engineering (NirDiamant/Prompt_Engineering) is a Jupyter Notebook project on GitHub. From the project's own README: 22 prompt engineering techniques with hands-on Jupyter Notebook tutorials, from fundamental concepts to advanced strategies for leveraging LLMs.
What language is NirDiamant/Prompt_Engineering written in?
NirDiamant/Prompt_Engineering is written primarily in Jupyter Notebook. GitHub's language field is based on the largest share of bytes in the default branch.
What topics is NirDiamant/Prompt_Engineering associated with?
GitHub's repository topics for NirDiamant/Prompt_Engineering: "ai", "chain-of-thought", "chatgpt", "claude", "few-shot-learning", "genai", "generative-ai", "gpt", "in-context-learning", "langchain", "llm", "llms", "machine-learning", "openai", "prompt-engineering", "prompting", "python", "tutorials". TopGit's editorial category is open-source.
Read full README in the tab above.
Curious whether Prompt_Engineering is right for you?
Let ChatGPT, Claude, or Perplexity look into it — click below and see what AI actually says about Prompt_Engineering.