Prompt Engineering Playbook

A structured reference covering 20 prompt engineering techniques — each documented with original before-and-after examples, real Google Gemini API outputs, personal verdicts, and common failure modes.

Browse Foundational Techniques Browse Advanced Techniques


What Is This?

The Prompt Engineering Playbook is a practitioner-first reference that treats prompt engineering as a craft — something learned through empirical testing, not memorising technique names.

Every page follows a consistent seven-section template:

Section Content
Definition Plain-English explanation of the technique
Use Cases Three practical scenarios where the technique applies
Weak Prompt An example prompt that underperforms, and why
Improved Prompt The same task rewritten using the technique
LLM Outputs Actual Gemini API responses — side by side
Verdict Honest two-sentence assessment based on testing
Pitfalls Common mistakes and how to avoid them

Foundational Techniques

The ten foundational techniques every AI practitioner should know.

# Technique Best For
1 Zero-Shot Prompting Quick tasks, general queries
2 Few-Shot Prompting Pattern-matching, formatting tasks
3 Chain-of-Thought Reasoning, maths, multi-step problems
4 Role-Play / Persona Expert tone, domain framing
5 Structured Output JSON, tables, parseable responses
6 Negative Constraints Scoping, avoiding unwanted content
7 Context Injection Grounding LLM in specific facts
8 Audience Specification Calibrating reading level & depth
9 Tone Control Formal, casual, persuasive writing
10 Instruction Clarity Reducing ambiguity in any task

Advanced Techniques

Ten advanced techniques for complex, multi-step, and high-stakes tasks.

# Technique Best For
11 Self-Consistency Improving accuracy on reasoning tasks
12 ReAct Prompting Agentic tasks, tool-use framing
13 Step-Back Prompting Abstract reasoning, first principles
14 Prompt Chaining Long, multi-stage workflows
15 Least-to-Most Decomposition Complex problems, sub-task breakdown
16 Generated Knowledge Factual accuracy, context priming
17 Calibration Prompts Uncertainty, confidence estimation
18 Directional Stimulus Steering creative or analytical tone
19 Meta-Prompting Prompt generation, self-improvement
20 Evaluation Prompts LLM-as-judge, quality assessment

Findings Summary

After testing all 20 techniques across four task types (summarisation, factual Q&A, creative writing, and reasoning), key patterns emerged.

Read the Findings Summary →


Tech Stack

  • Site: GitHub Pages with Just the Docs Jekyll theme
  • LLM Testing: Google Gemini API (gemini-1.5-flash)
  • Scripts: Python 3.11+ with google-generativeai SDK
  • Prompts: 40+ original weak/improved pairs across 4 task types

Note: All LLM outputs shown in this playbook were generated during hands-on testing. Results may vary with different models, temperatures, or dates. Treat verdicts as empirically-grounded opinions, not universal truths.


Back to top

Built by [nihalshx](https://github.com/nihalshx). Techniques tested with the Google Gemini API.

This site uses Just the Docs, a documentation theme for Jekyll.