PromptsApr 1, 2026·2 min read

Prompt Engineering Techniques — 20+ Methods

Comprehensive prompt engineering collection with 20+ techniques. 7.3K+ stars. Chain-of-Thought, ReAct, Tree-of-Thought, runnable notebooks.

PR
Prompt Lab · Community
Quick Use

Use it first, then decide how deep to go

This block should tell both the user and the agent what to copy, install, and apply first.

Pick a technique, copy the template, adapt to your task:

Chain-of-Thought (CoT):

Solve this step by step:
1. First, identify the key variables
2. Then, set up the equation
3. Finally, solve and verify

Problem: [your problem here]

ReAct (Reasoning + Acting):

Answer the following question by alternating between Thought, Action, and Observation steps.

Question: [your question]

Thought 1: I need to...
Action 1: Search for...
Observation 1: [result]
Thought 2: Based on this, I should...

Self-Consistency:

Generate 5 different solutions to this problem, then select the most common answer:

Problem: [your problem]

Solution 1: ...
Solution 2: ...
[Let the model generate multiple paths, then pick the majority]
Intro

This is a curated collection of 20+ prompt engineering techniques, each with explanations, templates, and runnable Jupyter notebooks. Covers:

Foundational:

  • Zero-Shot Prompting — No examples needed, just clear instructions
  • Few-Shot Prompting — Provide examples for the model to follow
  • Chain-of-Thought (CoT) — Step-by-step reasoning
  • Role Prompting — Assign an expert persona

Intermediate:

  • ReAct — Combine reasoning with tool use
  • Self-Consistency — Multiple reasoning paths, majority vote
  • Tree-of-Thought — Explore multiple solution branches
  • Least-to-Most — Break complex problems into sub-problems

Advanced:

  • Constitutional AI Prompting — Self-critique and revision
  • Meta-Prompting — Prompts that generate prompts
  • Automatic Prompt Engineering (APE) — Let the model optimize its own prompts
  • Prompt Chaining — Sequential prompts where output feeds input
  • Skeleton-of-Thought — Generate outline first, then fill in details

Each technique includes: concept explanation, when to use it, template, Python notebook, and real-world examples.

FAQ

Q: Which technique should I start with? A: Chain-of-Thought for reasoning tasks, Few-Shot for format-sensitive tasks, ReAct for tasks requiring external tool use.

Q: Do these work with all LLMs? A: Yes. These are model-agnostic techniques. They work with GPT-4, Claude, Gemini, Llama, Mistral, and any instruction-following LLM.

Q: Can I use these in production? A: Absolutely. Each technique is production-tested. The notebooks include evaluation metrics so you can measure effectiveness.

Works With

  • Any LLM: Claude, GPT-4, Gemini, Llama, Mistral
  • Claude Code, Cursor, Codex (for coding-specific prompts)
  • LangChain, LlamaIndex (for chained prompts)
  • Jupyter Notebook (runnable examples)
🙏

Source & Thanks

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets