Back to AI Productivity Lab
Premium Guide

The Complete AI Prompt Engineering Guide

Master the frameworks, techniques, and anti-patterns that separate mediocre AI output from production-quality results. Based on Google's AI course, real-world workflows, and battle-tested patterns.

Updated March 2026 15 min read 2,400+ words
01

The TCREI Framework: Your Foundation

Google's AI prompt engineering course distills effective prompting into five elements. Master these and you're already ahead of 80% of AI users. The framework is iterative, not linear — you'll cycle through these steps multiple times per prompt.

T — Task

Define what you want the AI to do. Be specific, not vague. The difference between "help me with marketing" and "write a 300-word landing page hero section for a SaaS product targeting remote teams" is the difference between generic slop and usable output.

Bad:

"Help me write something about our product"

Good:

"Write a 3-paragraph product description for a project management tool, emphasizing async collaboration features, targeting engineering managers at 50-200 person companies"

C — Context

The more context you provide, the better the output. Think audience, tone, constraints, prior attempts, success metrics, and what you've already tried that didn't work.

  • Audience: age, role, technical level, industry
  • Tone: professional, casual, technical, friendly, urgent
  • Constraints: word count, format, must-include keywords, avoid certain terms
  • Prior attempts: what you've tried and why it didn't work
  • Success metrics: how you'll know this worked

"My audience is engineering managers (30-45 years old) at Series A-B startups who are drowning in Slack threads. They're technical but time-starved. Tone should be direct and practical — no fluff. Previous landing page was too salesy and didn't convert."

R — References

Show, don't tell. AI is excellent at pattern matching. Give 2-3 examples of outputs you like, competitor pages you admire, or format samples. This is faster than describing your taste in words.

Example references you might provide:

  • • "Style similar to Linear.app's homepage — minimal, confident, fast"
  • • "Tone like Patrick McKenzie (patio11) — high info density, no buzzwords"
  • • "Format: 3 bullet points, each under 15 words, followed by a single CTA button"

E — Evaluate

Check the output against your criteria. Is it accurate? On-brand? Actionable? Does it solve the problem you defined in the Task step? Use a checklist approach:

  • Does it address the Task?
  • Does it respect the Context constraints?
  • Does it match the Reference style?
  • Would you ship this as-is, or does it need refinement?

I — Iterate

Never accept first output. Refine using the methods in Chapter 3. Prompting is circular, not linear. The real insight: spend 10 minutes writing the perfect prompt vs. 2 hours fixing bad output. Iteration beats perfection.

ABI: Always Be Iterating

Start with a simple task, evaluate, then add context, references, and constraints until you hit the quality bar. Most prompts need 3-5 iterations.

Remember the framework:

Tiny Crabs Ride Enormous Iguanas

Task, Context, References, Evaluate, Iterate

02

Hook Patterns That Work

How you start your prompt dramatically affects output quality. These five patterns act as "hooks" that guide the AI toward better results from the first token.

1. Specificity Wins

Exact numbers, precise dates, specific names. "13,392 users tested this" beats "thousands of users" every time. Specificity signals confidence and gives AI concrete anchors.

Before

"Write about a popular product"

After

"Write about Notion, which has 35M+ users and raised $343M at a $10B valuation"

2. Persona Framing

"Act as [expert role] who [specific constraint]" activates domain-specific patterns in the model. The constraint part is critical — it focuses the persona.

"Act as a senior backend engineer who specializes in database optimization for billion-row tables"

"Act as a conversion copywriter who writes for skeptical B2B buyers with 6-month sales cycles"

"Act as a DevOps architect who deploys to multi-region Kubernetes clusters under strict compliance requirements"

3. Format Control

Explicitly specify the output structure. AI doesn't guess formats well. Tell it: table, bullet list, JSON, code block, numbered steps, comparison matrix, etc.

Format examples:

  • "Output as a markdown table with columns: Feature, Plan A, Plan B, Winner"
  • "Output as JSON with keys: problem, solution, effort_days, risk_level"
  • "Output as a numbered list, max 5 items, each under 20 words"
  • "Output as Python code in a single function, no classes, include type hints"

4. Explicit Constraints

Narrow the solution space. Length limits, vocabulary restrictions, forbidden topics, required keywords. Constraints paradoxically increase creativity by forcing focus.

"Use only 2-syllable words, max 100 words total, avoid buzzwords like 'synergy' or 'innovative'"

"Explain for a 10-year-old, no technical jargon, use food analogies"

5. Examples First

Show 2-3 examples before asking for similar output. This is few-shot prompting — one of the most reliable patterns across all models.

Structure:

Here are 3 examples of the style I want:

[Example 1]

[Example 2]

[Example 3]

Now write a similar one for [your topic].

03

Iteration Methods: When Output Misses

Your first prompt rarely hits the mark. These four methods help you refine toward the result you need. Apply them in order — each is progressively more aggressive.

Method 1: Revisit the Framework

Add missing TCREI elements. Did you skip Context? Were your References vague? Go back and fill in the gaps.

Common fixes:

  • • Add audience details you forgot
  • • Include 2-3 reference examples
  • • Specify constraints (word count, tone, format)
  • • Clarify success criteria

Method 2: Break Into Steps

"First X, then Y, finally Z" instead of one massive prompt. Complex tasks need decomposition. Think of it like pair programming with AI — tackle one piece at a time.

Before (single prompt)

"Write a landing page with hero, features, pricing, and FAQ sections"

After (multi-step)

Step 1: "Draft 3 hero headline options"

Step 2: "Expand the second headline into a full hero section"

Step 3: "Now write 3 feature blocks..."

Method 3: Rephrase the Task

Reframe the problem using an analogy or different framing. "Write marketing copy" becomes "tell a story about how this product fits into the customer's day." Same goal, different angle.

Original:

"Write a feature list for our project management tool"

Reframed:

"Describe a typical workday for an engineering manager using our tool, highlighting how each feature solves a specific frustration"

Method 4: Add Constraints

Narrow the scope. Too much freedom creates generic output. Constraints force specificity: region, tempo, emotion, style, length, format.

Example: generating a playlist

Generic: "Create a road trip playlist"

Better: "Create a 2-hour road trip playlist: 90s indie rock, 120-140 BPM, no ballads, must include at least 3 songs about driving"

Remember the iteration methods:

Ramen Saves Tragic Idiots

Revisit, Separate, Rephrase, Introduce constraints

04

Advanced Techniques

These techniques unlock capabilities that basic prompting can't reach. Use them when you need the AI to reason deeply, explore alternatives, or handle complex multi-step workflows.

Chain of Thought (CoT)

Add "Think step-by-step" or "Show your reasoning before answering." This forces the model to break down its thinking, which dramatically improves accuracy on complex problems.

"Calculate the total cost of running 50 servers for 6 months at $0.12/hour each. Think step-by-step and show your work."

Output will include intermediate calculations, making errors easier to spot.

When to use: Math, logic puzzles, debugging, financial calculations, any problem where intermediate steps matter.

Tree of Thought (ToT)

"Generate 3 approaches, evaluate each, pick best." Forces exploration of the solution space before committing. Better decisions, more creative solutions.

"I need to reduce database query time. Generate 3 different approaches (caching, indexing, query optimization). For each, list pros, cons, and estimated effort. Then recommend the best option with reasoning."

When to use: Strategic decisions, architecture choices, comparing solutions, brainstorming with evaluation.

Prompt Chaining

Break complex tasks into steps, feed output of step N into step N+1. This is how you build workflows. Each step is simple, but the chain accomplishes sophisticated goals.

Example: Building a landing page

Prompt 1:

"Generate 5 value propositions for [product]"

Prompt 2:

"Take value prop #3 and expand it into a 150-word hero section"

Prompt 3:

"Based on that hero section, write 3 supporting feature descriptions"

Prompt 4:

"Now generate 5 social proof statements that align with the tone"

When to use: Long documents, multi-part content, workflows with dependencies, when context window is tight.

Meta-Prompting

Ask AI to design the prompt. "What questions would help you write X better?" This surfaces the information the model actually needs, which you might not have thought to provide.

"I need you to write a technical blog post about database indexing strategies. Before you start, what information do you need from me to write the best possible post? Ask me 5-7 clarifying questions."

The AI will ask about audience level, post length, specific databases, use cases, etc. Answer those, then ask it to write.

When to use: Unfamiliar domains, when you don't know what context to provide, complex projects where requirements aren't clear.

Multimodal Prompting

Combine text + images, audio, video, or code as input. Models like Claude and Gemini can analyze images, extract text from screenshots, describe diagrams, or suggest improvements to visual designs.

Example use cases:

  • • Upload wireframe → "Generate HTML/CSS for this design"
  • • Screenshot of error → "Debug this, explain what's wrong"
  • • Photo of whiteboard → "Convert this to markdown bullet points"
  • • Brand logo + colors → "Create a social media post matching this aesthetic"

When to use: Design feedback, debugging visual issues, extracting structure from images, maintaining brand consistency across generated content.

05

Anti-Patterns: What Kills Quality

Knowing what NOT to do is as important as knowing best practices. These five anti-patterns destroy output quality and waste time. Avoid them.

Anti-Pattern 1: Vague Tasks

"Help me with X" or "write something about Y" gives the AI zero constraints. You get generic, unusable output that requires complete rewriting.

Bad:

"Help me write a blog post"

Good:

"Write a 1200-word blog post for engineering managers about reducing meeting overhead, structured as: problem statement, 3 specific strategies with examples, conclusion with action items"

Anti-Pattern 2: No Examples

AI guesses your taste without references. You end up with output that's technically correct but doesn't match your style at all. Show, don't tell — always include 2-3 reference examples.

Fix: Include links to competitor pages you like, paste previous outputs, or describe a reference point ("Write in the style of [author/brand]").

Anti-Pattern 3: Word Vomit

One long paragraph = confused output. Think of AI like a person — wall-of-text communication overwhelms. Break prompts into clear, separate sentences with line breaks.

Bad (wall of text):

Write me a landing page for a SaaS product that helps teams collaborate better it should have a hero section and features and pricing table the tone should be professional but friendly and it's for engineering teams at startups...

Good (structured):

Write a landing page for a SaaS product.

Product: team collaboration tool
Audience: engineering teams at startups
Tone: professional but friendly
Sections: hero, features, pricing
Length: 300 words max

Anti-Pattern 4: Accepting First Draft

First output is rarely good enough. Iteration is mandatory — add constraints, rephrase, try a persona, break into steps. Treat AI like a junior collaborator who needs feedback, not a magic oracle.

Rule of thumb: If you wouldn't ship a human's first draft without review, don't ship AI's first draft either. Plan for 3-5 iterations on important work.

Anti-Pattern 5: Trusting Hallucinations

AI confidently generates plausible-sounding nonsense. Verify facts, check logic, maintain human-in-the-loop always. This is YOUR responsibility, not the AI's.

Verification checklist:

  • ✓ Are statistics/numbers cited accurately? Cross-check sources.
  • ✓ Does the code actually run? Test before deploying.
  • ✓ Are the recommendations logically sound? Sanity-check advice.
  • ✓ Do the references exist? Verify links and citations.
  • ✓ Is the output biased? Check for demographic assumptions.

Pro Tip

Save 10 minutes writing the perfect prompt vs. 2 hours fixing bad output. Iteration beats perfection, but don't skip the fundamentals.

06

Quick Reference Templates

Copy-paste ready prompt templates for common tasks. Fill in the brackets, adjust to your needs, iterate from there.

Research / Analysis

Act as [domain expert]. Analyze [topic/data] focusing on [specific angle].

Context:
- Audience: [who will read this]
- Use case: [why they need it]
- Constraints: [time, scope, depth]

Output format: [table/bullets/report]

Include:
- [Key metrics or data points]
- [Comparisons or benchmarks]
- [Recommendations with reasoning]

Content Writing

Write [content type] for [audience] about [topic].

Tone: [professional/casual/technical/friendly]

Constraints:
- Length: [word count]
- Keywords: [must include]
- Structure: [sections or format]

Examples of style I want:
[Paste 2-3 samples or describe references]

Format: [thread/article/post/email/landing page]

Code Review / Debug

Review this [language] code for [concern: performance/security/readability].

Context:
- App type: [web app/CLI/service/etc]
- Scale: [users, requests, data size]
- Team size: [how many devs will maintain this]

Identify:
- [Specific issues to check]
- [Edge cases]
- [Security vulnerabilities]

Suggest:
- [Alternatives with reasoning]
- [Best practices to follow]

[Paste code here]

Problem Solving

I need to [goal] but [constraint/problem].

Context:
- Resources: [budget, time, people]
- Timeline: [deadline]
- Requirements: [must-haves]

Generate 3 approaches.

For each approach:
- Pros
- Cons
- Effort estimate (days/weeks)
- Risk level (low/medium/high)

Recommend best option with reasoning.

Marketing Strategy

Act as a marketing strategist for [industry].

Product: [brief description]
Target audience: [demographics, pain points, behavior]
Competitor landscape: [who competes, how they position]

Create a content strategy:
- 3 customer journey stages
- 3 content types per stage
- Distribution channels
- Success metrics

Format as a markdown table.

Workflow / Agent Design

Design an AI agent workflow for [task].

Inputs: [data, files, APIs available]
Outputs: [desired end result]
Constraints: [time, cost, error tolerance]

Break into steps:
1. [Step name] — [what it does] — [tool/API needed]
2. ...
3. ...

For each step, specify:
- Input required
- Processing logic
- Output format
- Error handling
- Human-in-loop gates (if needed)
07

Platform-Specific Tips

Different AI models have different strengths. Here's what works best on each major platform.

Claude (Anthropic)

Strengths:

  • • Long context windows (200K+ tokens) — great for analyzing entire codebases or long documents
  • • Strong at following complex instructions with multiple constraints
  • • Excellent code generation and debugging, especially for modern web frameworks
  • • Handles nuanced tone and style requests well

Best practices:

  • • Use XML tags for structure: <context>...</context>, <examples>...</examples>
  • • Explicitly state what NOT to do — Claude respects negative constraints
  • • For code tasks, specify file structure and dependencies upfront
  • • Works great with Chain of Thought prompting

GPT (OpenAI)

Strengths:

  • • Fastest at completing common patterns (emails, summaries, rewrites)
  • • Strong at creative writing and brainstorming
  • • Best integration ecosystem (plugins, API, tools)
  • • Handles casual, conversational prompts well

Best practices:

  • • Use system messages to set behavior: "You are an expert in X who always Y"
  • • Provide examples in few-shot format (user/assistant pairs)
  • • Shorter prompts often work better — GPT is optimized for brevity
  • • Use function calling for structured outputs (JSON schemas)

Gemini (Google)

Strengths:

  • • Multimodal capabilities — best at image + text combined tasks
  • • Strong at data analysis and working with tables/structured data
  • • Fast inference and high rate limits on free tier
  • • Handles technical/scientific content well

Best practices:

  • • Use for image analysis tasks (screenshots, diagrams, charts)
  • • Explicitly specify data formats (CSV, JSON, markdown tables)
  • • Provide detailed context — Gemini benefits from verbose prompts
  • • Leverage Google Search grounding for factual queries

DeepSeek

Strengths:

  • • Strong reasoning and logic tasks — best open-source model for complex analysis
  • • Excellent cost-performance ratio
  • • Long context support (up to 128K tokens)
  • • Handles code and technical content very well

Best practices:

  • • Use for reasoning-heavy tasks where GPT/Claude are expensive
  • • Chain of Thought prompting works exceptionally well
  • • Provide clear structure — benefits from numbered steps
  • • Great for code review and debugging tasks

Platform-Agnostic Advice

  • • Test the same prompt across models — output quality varies by task type
  • • Use cheaper models (Gemini Flash, Groq Llama) for iteration, expensive models (GPT-4, Claude Opus) for final output
  • • Each platform has biases — if one fails, try rephrasing for another model
  • • Monitor your costs — chain cheap models intelligently rather than throwing expensive models at every problem

Want Weekly AI Insights Like This?

Join the AI Productivity Lab newsletter. Every week, get frameworks, techniques, and real-world examples for building with AI. No hype, no fluff — just what works.

Free forever. Unsubscribe anytime. No spam, ever.