Nearby lessons
46 of 49Prompt Engineering - Quick Cheatsheet
Chapter 1 — Introduction to Prompt Engineering
- A prompt is an instruction given to AI; prompting is a communication skill.
- AI is a pattern follower, not a mind reader — clear instruction gives good output.
- The auto-driver example: a clear destination is half the journey.
- How AI works: type → read → understand → generate.
- Good prompt = specific + complete + tells audience and purpose.
- Bad prompt = vague + missing details → AI guesses.
Chapter 2 — Prompt Clarity Rules & the Prompt Formula
- Prompt clarity = specific + complete — missing either makes AI guess.
- Rule 1 — Be Specific: vague words like "explain this" waste a turn.
- Rule 2 — Be Complete: "Write resume" gives a generic resume; add skills and experience.
- The prompt formula has 5 parts: Role, Task, Context, Constraints, Output format.
- Role gives direction, context gives clarity, constraints give control.
- The tailor example: a structured instruction gives a perfect result.
- Apply the formula to every prompt and AI output becomes professional.
Chapter 3 — Tone, Length & Step-by-Step Control
- Tone controls how AI speaks; same topic, different style.
- Four tones: Friendly (learning), Professional (office), Funny (content), Strict (interview).
- Length control decides the size: short for revision, long for deep learning.
- Step-by-step prompting gives clear, ordered explanations.
- Combine tone + length + steps in one prompt for the best result.
- Practice daily — real prompting skill comes from doing, not reading.
Chapter 4 — Format Control & Structured Output
- Format control decides how the answer looks, not what it says.
- Five formats: bullets, table, steps, checklist, story — each with a best use.
- Structured output = fixed headings + strict tables = predictable, reusable output.
- Without "strictly", AI may quietly change the headings or add its own sections.
- "Only Output This" removes extra text and makes AI tool-ready (JSON, APIs).
- Only-output is essential for JSON, apps, and APIs — extra text breaks the data.
- The notes-generator prompt: role + task + fixed structure + rules + only-output.
- Same input → same format → easy reuse and automation.
Chapter 5 — Small Words, Constraints & Ambiguity
- AI reads prompts step by step; instruction order matters — put role first.
- Last instructions dominate, like the WhatsApp meeting example.
- Control words — only, exactly, strictly, do not, must — give word-level precision.
- One small word can change the length, tone, or format of the entire output.
- Ambiguity makes AI guess; a prompt should read like a requirement document.
- Constraints are rules that limit AI behavior — length, tone, format, and plain rules.
- An example is a sample output that guides AI's style — a visible reference.
- Constraints + examples = control + stability.
Chapter 6 — Zero-Shot, One-Shot & Few-Shot Prompting
- Zero-shot: ask directly, no example — fast but not controlled.
- One-shot: one example locks the style, format, and tone.
- Few-shot: 2–5 examples teach AI a pattern and improve accuracy.
- Few-shot works best for classification, MCQs, and email replies.
- Few-shot + structure = production-ready, reusable AI output.
- Teacher analogy: 1 example = little, 3 examples = clear, 5 examples = mastery.
Chapter 7 — Persona, Role & Tone Control
- Role = job, Persona = behaviour, Tone = voice — three different things.
- Persona control = behaviour + depth + attitude.
- Strict interviewer, mentor, analyst, HR — each persona changes the output.
- Persona + constraints + format = the stability layer for reusable AI tools.
- Domain persona makes AI think from a field's perspective.
- Safety persona refuses harmful requests and suggests safe alternatives.
Chapter 8 — Chain-of-Thought & Reasoning Foundations
- A reasoning prompt makes AI think step by step before answering.
- "Think step by step" is a small line with a big effect.
- Manual CoT: you write the thinking steps; full control.
- Auto-CoT: AI generates the reasoning examples; faster.
- Showing its working makes the answer believable — and trustworthy.
- Not every question needs step-by-step reasoning — simple questions get quick answers.
- Long prompts for simple questions waste time and tokens.
- Efficiency = depth when needed, speed when not.
Chapter 9 — Advanced Reasoning: Self-Consistency, ToT & Step-Back
- Reflection = AI reviews and improves its own answer.
- Self-consistency = solve multiple times and choose the common answer.
- Tree of Thoughts = generate options, compare, decide like a leader.
- Chain of Hindsight = learn from mistakes and improve.
- Step-Back = understand the concept before solving.
- Check twice, answer once — combine reflection + consistency for trust.
Chapter 10 — Graph of Thoughts & Reliability Engineering
- GoT thinks in a connected network — one change affects many things.
- CoT is linear, ToT is branching, GoT is a full system.
- Reliability engineering = safe + accurate + verified AI.
- Guardrails control allowed/not-allowed topics.
- Hallucination control stops AI from creating fake facts.
- Complex simulation combines CoT + ToT + Self-Consistency + Reflection.
Chapter 11 — ReAct, Tool Calling & Stop Conditions
- ReAct = Reason + Act, repeated until the goal is done.
- Every step alternates: Reason (think) then Act (do) — the loop is the foundation of AI agents.
- AI becomes an assistant that completes tasks, not just an advisor.
- Tool calling = calculator, search, database, validator — verify, don't guess.
- Use tools when accuracy matters; skip them for simple answers.
- A stop condition tells AI when to stop — without one it can loop forever.
- Stop conditions + retry limits + output limits = safe agents.
- Smart AI knows when to stop.
Chapter 12 — Planning Prompts & Mini AI Agents
- A planning prompt turns a big goal into phases, tasks, priority, timeline, milestones.
- Order matters — buy land → design → build → paint; wrong order = failure.
- A milestone is a big checkpoint that measures progress.
- An AI agent thinks + acts + verifies + improves as a full workflow.
- Mini agent = CoT + ToT + CoH + Reflection + ReAct + guardrails + stop.
- One single prompt combines every technique you learned.
- The capstone combines all your skills into one real-world system.
- Capstone = from learner to professional.
Chapter 13 — Debugging Prompts: Failures, Refactoring & the Meta-Prompt
- AI is not failing — the prompt is failing.
- Prompt failure = wrong or unclear output because the instruction was poor.
- Refactoring = same meaning, clear structure, no noise — break the prompt into role, context, constraints, output format.
- Debugging process: Diagnose → Explain → Rewrite → Test.
- A good prompt is written, a great prompt is tested — checklist: role, task, format, ambiguity, missing data, testability.
- Improvement loop: Ask → Check → Refine → Retest.
- A meta-prompt works on another prompt — analyzes, improves, and rewrites it.
- The next level is not using AI, it is building AI.
Chapter 14 — Decomposition & Linear Pipelines
- One big prompt fails for complex tasks — chain small prompts instead.
- Chaining: output of one step becomes input of the next.
- Decomposition uses Input → Process → Output for every step.
- A linear pipeline runs steps in a fixed order, each depending on the last.
- Format locking keeps the same structure across all steps.
- Notes → summary → quiz is the classic beginner pipeline.
Chapter 15 — Branching Pipelines, Controlled Chaining & Variable Injection
- A branching pipeline changes path based on an IF condition — IF → Route A, ELSE → Route B.
- Different users → different outputs → personalization.
- Classify the user first, then send them down the correct path.
- Controlled chaining keeps the same topic, format, and rules across steps.
- "Do not add new information" prevents topic drift; each step uses only the previous output.
- Variable injection uses placeholders like {{TOPIC}} to make prompts reusable.
- Identify the dynamic parts, replace them with variables, reuse the template.
- Static prompts are one-time; dynamic templates scale.
Chapter 16 — Reusable Templates, Automation & the Capstone
- Reusable templates = modules + variables + standard structure.
- Automation shifts you from prompts to systems.
- JSON passes structured data between steps automatically.
- The capstone combines chaining, pipelines, variables, and structure.
- Optimization improves speed, accuracy, cost, and stability — remove extra steps, reduce tokens, finalize the template.
- Build once, use many times — creators build systems.
Chapter 17 — Prompt Formats: System/User, Alpaca, ChatML & INST
- Prompt serialization = structuring prompts with roles.
- System message controls behaviour; user message gives the task.
- System message has higher priority.
- Alpaca = Instruction + Input + Output (model training).
- ChatML = System / User / Assistant with context memory.
- INST wraps instructions in [INST] tags for LLaMA models.
Chapter 18 — Minimalism, Tokens, Cost & Safety
- Minimalism = short + clear + complete.
- Noise removal = cut words that add no value.
- A token is a piece of text; more tokens = more cost.
- Short prompts = low tokens = low cost.
- Consistency = same style and format every time.
- Safety: ask assumptions, sources, verification; allow "Not sure".
Chapter 19 — Multimodal, Image & Video Prompting
- Multimodal AI handles text, image, video, and audio together.
- Image formula: Subject + Environment + Lighting + Camera + Style.
- Lighting controls atmosphere, camera controls perspective, mood controls emotion.
- Video formula adds Action + Camera Movement to the image formula.
- Detailed prompts give professional, cinematic output.
- Transformation videos are powerful for viral content.
Chapter 20 — Negative Prompting & PAL Prompting
- Negative prompting tells AI what NOT to generate.
- Prompt = what you want; negative prompt = what you don't want.
- Reuse the negative word list: blurry, extra fingers, watermark, text, logo...
- PAL = ask AI to write a program and solve, not to guess an answer.
- PAL formula: "Write a Python program to + [problem]".
- PAL works for finance, real estate, data, and automation — not for stories.
📝 Key Takeaways
- One section per chapter, built from the chapter summaries
- Each point is the exam-ready one-liner for that topic
- Open the matching lesson for the full explanation and prompts