Skip to content
Learning Lab · 11 min read

Prompts That Work Across Claude, GPT, and Gemini

Claude, GPT-4o, and Gemini respond differently to the same prompts. This guide covers the universal techniques that work across all three, model-specific strategies you can't ignore, and a testing approach to find what actually works for your use case.

Prompt Techniques for Claude, GPT, Gemini

I spent three weeks last month rewriting the same prompt six different ways. The first version worked perfectly in Claude. Moved it to GPT-4o and got mediocre outputs. Switched to Gemini 2.0 and it hallucinated phone numbers. Same instructions. Three different results.

The problem wasn’t the prompts — it was that I was writing to the model, not to the task. Each LLM has different training data, different reasoning patterns, and wildly different default behaviors. Once I stopped thinking about “a good prompt” and started thinking about “a prompt that works for this specific model and this specific task,” things changed.

This isn’t about learning three different prompt languages. It’s about understanding where these models diverge, what techniques work universally, and exactly which tweaks move the needle on each one.

Why the Same Prompt Fails Across Models

Claude (especially Claude Sonnet 3.5 and 4), GPT-4o, and Gemini 2.0 were trained on different data, optimized for different objectives, and built with different architectural choices. That matters for prompting in specific, measurable ways.

Claude was trained with Constitutional AI — a method that emphasizes thoughtfulness and explicit reasoning. You’ll notice it tends to show its work, even when you don’t ask. It’s also more resistant to jailbreaks and edge-case exploitation, which means it sometimes refuses reasonable requests if they’re phrased in ways that trigger its safety training.

GPT-4o was trained to be extremely general-purpose and confident. It excels at following complex, multi-step instructions. It’s also more prone to hallucination in scenarios where it lacks training data — it will invent plausible-sounding information rather than say “I don’t know.” Token efficiency is better than Claude on many tasks.

Gemini 2.0 (released in December 2024) has multimodal capabilities baked in from the ground up, and it’s trained on more recent data than both Claude and GPT-4o. It’s aggressive on context window — supports up to 2 million tokens in some configurations — but sometimes it under-delivers on reasoning-heavy tasks compared to Claude Sonnet 3.5.

These aren’t design flaws. They’re tradeoffs. And they require different prompt strategies.

Universal Techniques That Work on All Three

Not everything needs to be model-specific. A few patterns hold across Claude, GPT, and Gemini — they just require the right setup.

Structured Output with Clear Delimiters

Every LLM responds better when you define the exact format you want. Not “summarize this” — “return a JSON object with keys: summary (string), confidence (0-1), missing_context (array).”

Here’s what this looks like in practice:

## Bad prompt (too open-ended)
Summarize this research paper about LLM hallucinations.

## Improved prompt (structured output)
Read the research paper below. Return your response as valid JSON with these exact keys:
{
  "title": "exact paper title",
  "core_finding": "1–2 sentences describing the main result",
  "methodology": "how they measured hallucinations",
  "confidence": "0.0 to 1.0 — your confidence in this summary",
  "cited_benchmarks": ["list of specific benchmarks mentioned"]
}

Paper:
[paper content]

Why this works everywhere: structured output reduces ambiguity. Claude will honor JSON formatting because it’s trained to. GPT-4o will too — it’s optimized for API consumption. Gemini will, though you may need to add “Return valid, parseable JSON” if it starts wrapping the JSON in markdown code blocks.

This alone cuts down on parsing errors and model-specific behavioral surprises by ~60% in my experience building AlgoVesta pipelines.

Role Definition and Tone

Explicit role definition works across all three models, but the setup differs slightly in tone.

Claude responds well to collaborative framing: “You are an expert in [domain]. Help me think through [problem].” It leans into the role and tends to add nuance and caveats without being prompted for them.

GPT-4o responds better to directive framing: “You are a [role]. Your task: [specific action].” It interprets this as a clear job description and executes with less tangential thinking.

Gemini sits in the middle — it responds to both styles, but performs better when you’re explicit about constraints: “You are a [role]. Only respond with [output type]. Do not [behavior to avoid].”

All three benefit from explicit tone instructions:

## All three models, similar structure
You are a technical documentation writer for developers with intermediate Python experience.

Tone: Direct and code-focused. Avoid marketing language. Assume the reader will skip to the code examples.

Task: Explain [technical concept] in a way that makes sense for someone who understands [prerequisite] but not [this new concept].

Provide: explanation (3-4 sentences max) + working code example + one common mistake to avoid

The difference is subtle but matters at scale — directive framing pushes GPT-4o to be more efficient. Collaborative framing gets Claude to be more thoughtful.

Model-Specific Techniques and When They Work

Claude: Explicit Reasoning and the Extended Chain-of-Thought

Claude’s Constitutional AI training makes it exceptional at showing reasoning. It naturally does chain-of-thought thinking without being asked, and it handles “I’m not sure” better than the other two.

Leverage this with prompts that invite reflection:

## Claude-optimized prompt (explicit reasoning)
Analyze this customer support ticket for sentiment and urgency.

Before responding, think through:
1. What specific words or phrases indicate emotional state?
2. Is there an explicit deadline or time pressure?
3. What's NOT being said — what's implied?
4. How confident am I in this assessment?

Then return JSON:
{
  "sentiment": "positive|neutral|negative|mixed",
  "urgency_level": 1-5,
  "reasoning": "explain your assessment",
  "confidence": 0.0-1.0,
  "red_flags": ["list of concerning elements"]
}

Ticket:
[customer message]

Claude excels here because you’re asking it to slow down and think. This isn’t true of all tasks — sometimes Claude’s thinking is overkill. But for judgment calls, classification with nuance, and anything requiring “explain your reasoning,” this pattern cuts error rates measurably.

When NOT to use this: for simple, factual tasks (“extract the date from this email”), the extended reasoning adds latency without improving accuracy. Claude gets faster and more accurate if you strip the reasoning request.

GPT-4o: Few-Shot Examples and Step-by-Step Instructions

GPT-4o was trained to follow complex, sequential instructions. It responds exceptionally well to few-shot learning — showing it 2-3 examples of input and desired output — and breaking tasks into numbered steps.

## GPT-4o-optimized prompt (few-shot + sequencing)
Extract structured data from unstructured customer feedback. Return JSON.

Examples:

Input: "The app crashes every time I try to upload a photo. This is ridiculous."
Output: {"issue_type": "bug", "severity": "high", "affected_feature": "photo upload", "sentiment": "frustrated"}

Input: "Just started using this. Pretty cool so far, though a bit expensive."
Output: {"issue_type": "feedback", "severity": "low", "affected_feature": "pricing", "sentiment": "cautiously positive"}

Input: "The dark mode works great. Exactly what I needed."
Output: {"issue_type": "praise", "severity": "low", "affected_feature": "dark mode", "sentiment": "positive"}

Now process this feedback:
1. Identify the primary issue or topic
2. Assign a type: bug, feature request, feedback, or praise
3. Rate severity (1-5, where 5 = breaks core functionality)
4. Extract the feature it relates to
5. Classify sentiment
6. Return as JSON

Feedback:
[customer message]

This works because GPT-4o treats examples as a learning signal and numbered steps as a clear execution path. Add 2-3 examples and you’ve essentially shown it the pattern. It will generalize well to variations.

Failure mode: If you give GPT-4o too many conflicting examples or ambiguous instructions, it tends toward the most common case in your examples rather than reasoning through edge cases. Claude would flag the ambiguity. GPT-4o fills in the blanks.

Gemini 2.0: Long Context and Aggressive Specification

Gemini’s real advantage is context window — up to 2 million tokens. It’s also strong on multimodal tasks (text + image + video + audio in a single prompt). The tradeoff: it sometimes struggles with abstract reasoning on long documents and benefits from over-specification.

## Gemini-optimized prompt (explicit constraints)
You are analyzing a 150-page technical specification document.

CONSTRAINT: Do not synthesize or infer information not explicitly stated. If the document doesn't mention something, say "not specified" rather than guessing.

CONSTRAINT: Quote exact passages when supporting claims. Do not paraphrase.

Task:
1. Extract all system requirements (hardware, software, dependencies)
2. List every assumption the spec makes about the user's environment
3. Identify any contradictions between sections
4. Return as JSON

Return format:
{
  "requirements": [{"type": "string", "value": "string", "source_section": "string"}],
  "assumptions": [{"assumption": "string", "mentioned_in": "string"}],
  "contradictions": [{"claim_a": "string", "claim_b": "string", "sections": ["string", "string"]}]
}

Specification:
[full document text]

Gemini needs you to be aggressive about boundary-setting. The reason: it’s less trained on “I don’t know” responses and more trained on generating plausible text. Explicit constraints like “do not infer” and “quote exactly” push it toward accuracy.

Where Gemini shines: multi-document summarization, cross-referencing sources across very long contexts, extracting patterns from hundreds of pages. Where it struggles: open-ended creative reasoning, judgment calls without clear criteria.

Building a Prompt That Works on All Three

Once you understand the differences, you can write prompts that perform well across all three models. The strategy: optimize for the most restrictive model (Claude’s safety training), then add model-specific enhancements.

Here’s a production example from AlgoVesta — a prompt that classifies trading signals from multiple data sources:

## Base prompt (works on all three)
You are a financial analyst evaluating trading signals.

Analyze the signals below. Return JSON with classification, confidence, and reasoning.

Constraints:
- Only use information provided in the signals. Do not add external knowledge.
- If signals contradict, identify the contradiction and state your confidence interval.
- Rate your certainty: 0.0 (pure guess) to 1.0 (certain).

Signals to analyze:
[signal data]

Return:
{
  "primary_signal": "bullish|bearish|neutral",
  "confidence": 0.0-1.0,
  "contradictions": ["list if any"],
  "reasoning": "why you classified it this way"
}

This base prompt works on all three. Here’s how to tune it:

For Claude: Add “Think through your reasoning step by step before responding.” Claude will naturally be more thorough. Reframe constraints as questions: “Where do the signals contradict? What’s missing?”

For GPT-4o: Add 2-3 example signals with their expected classifications. Add numbered steps: “1. Extract bullish signals. 2. Extract bearish signals. 3. Compare confidence levels. 4. Return JSON.” GPT-4o will follow the sequence exactly.

For Gemini: Add explicit “Do not” statements: “Do not reference external market knowledge. Do not infer context not provided.” Add output length specifications: “Reasoning must be 1-2 sentences.” Make constraints bulletproof.

A/B Testing Prompts Across Models

In production, you need to know which prompt works best for which model. This requires systematic testing.

Step 1: Define your metric. “Better” means different things for different tasks. For classification, it’s accuracy. For summarization, it’s coverage + conciseness. For creative tasks, it’s novelty + relevance.

Step 2: Create test cases. Minimum 20 examples. They should represent edge cases and common cases. A balanced dataset catches prompt failures you’d miss with just easy examples.

Step 3: Run all prompt variants on all test cases with all models. This is tedious. Automate it with a simple Python script that loops through models and variants, then logs results to a spreadsheet.

## Example testing harness (Python)
import anthropic
import openai
from google import genai
import json
import csv

test_cases = [
    {"input": "example 1", "expected": "expected output 1"},
    {"input": "example 2", "expected": "expected output 2"},
    # ... 18 more test cases
]

prompt_variants = {
    "base": "your base prompt",
    "with_reasoning": "base + reasoning instruction",
    "few_shot": "base + 2-3 examples",
}

models = {
    "claude": "claude-3-5-sonnet-20241022",
    "gpt4o": "gpt-4o-2024-11-20",
    "gemini": "gemini-2.0-flash",
}

results = []

for model_name, model_id in models.items():
    for variant_name, prompt_template in prompt_variants.items():
        for test_case in test_cases:
            # Call the model with this specific variant
            if model_name == "claude":
                client = anthropic.Anthropic()
                response = client.messages.create(
                    model=model_id,
                    max_tokens=1024,
                    messages=[{"role": "user", "content": prompt_template + "\n\n" + test_case["input"]}]
                )
                output = response.content[0].text
            # ... similar for GPT and Gemini
            
            # Score the output (you define this)
            score = evaluate_output(output, test_case["expected"])
            results.append({
                "model": model_name,
                "variant": variant_name,
                "test_id": test_case.get("id"),
                "score": score
            })

# Write results to CSV
with open("results.csv", "w") as f:
    writer = csv.DictWriter(f, fieldnames=["model", "variant", "test_id", "score"])
    writer.writeheader()
    writer.writerows(results)

# Aggregate by model + variant
agg = {}
for r in results:
    key = (r["model"], r["variant"])
    if key not in agg:
        agg[key] = []
    agg[key].append(r["score"])

for (model, variant), scores in agg.items():
    avg_score = sum(scores) / len(scores)
    print(f"{model} + {variant}: {avg_score:.2f}")

This takes 2-3 hours to set up but saves weeks of guessing. Once you have results, you can pick the optimal prompt-model combination for your use case, or use an ensemble approach (route some requests to Claude, some to GPT-4o based on input characteristics).

Common Failures and How to Avoid Them

These patterns fail consistently across all three models if not handled correctly:

Hallucinations on factual tasks: All three models will invent plausible information when they lack training data. Fix: explicitly forbid inference. “Only use information provided. If it’s not mentioned, say ‘not provided’ rather than guessing.” This works everywhere.

Prompt instruction gaming: A model will follow the last instruction that seems highest priority. If you say “be concise” and “explain thoroughly,” it picks one. Fix: be explicit about tradeoffs. “Prioritize accuracy over brevity. A longer but correct response is better than a short but incomplete one.”

Format drift: The model starts following your format perfectly, then drops it halfway through. Fix: repeat the format instruction at the end of the prompt. “Return all responses as JSON. Do not add markdown formatting.”

Context window overload: You provide 100k tokens and the model struggles on reasoning. The issue isn’t size — it’s that very long contexts degrade attention. Fix: summarize or filter context before sending. For Gemini specifically, break multi-document tasks into smaller chunks even though it can handle 2M tokens.

When to Route to Specific Models

You don’t need to prompt-engineer equally for all three. Sometimes one model is the clear winner. Knowing when saves you time and tokens.

Task Type Best Model Why Prompt Adjustment
Classification with nuance (is this feedback positive or mixed?) Claude Constitutional AI makes it better at judgment calls. Less prone to oversimplifying. Ask for reasoning. Invite reflection.
Multi-step extraction (pull all emails, dates, and priorities) GPT-4o Excels at following numbered, sequential instructions. Use few-shot examples + step-by-step numbering.
Long document summarization (100+ pages) Gemini 2.0 Context window + lower hallucination rate on factual extraction in long docs. Be explicit about constraints. No inference.
Creative content generation GPT-4o or Claude (tie) Both excel. GPT-4o is faster. Claude is more thoughtful. For GPT: few-shot examples. For Claude: ask for alternatives and reasoning.
Code generation Claude Produces cleaner, more maintainable code. Better at explaining trade-offs. Ask for comments + explanation. Request error handling explicitly.
Image + text analysis Gemini 2.0 Built for multimodal from the ground up. Other models can do it, but less naturally. Describe image context explicitly. Be specific about what to extract.

Your Action This Week

Pick one task you’re currently using an LLM for. Rewrite your prompt using the structured output format (JSON with explicit keys), add role definition, and test it on all three models with 10 real examples from your data.

Log the results. Which model performs best? Which prompt variant did best? Spend 90 minutes on this — not more. You’ll have a data-backed decision on which model to use and exactly how to prompt it. That beats guessing.

Batikan
· 11 min read
Share

Stay ahead of the AI curve

Weekly digest of the most impactful AI breakthroughs, tools, and strategies.

Related Articles

Cursor vs GitHub Copilot vs Claude Code: Which Wins for Production Work
Learning Lab

Cursor vs GitHub Copilot vs Claude Code: Which Wins for Production Work

Three AI coding assistants dominate production environments. This isn't a feature list. It's a breakdown of what each actually does, where it fails, and which to use for architecture, boilerplate, and debugging.

· 10 min read
→
Analyze Spreadsheets With Claude and GPT-4o
Learning Lab

Analyze Spreadsheets With Claude and GPT-4o

Claude and GPT-4o can analyze your spreadsheets and CSVs, but only if you structure the data correctly and ask with precision. Learn how to upload files, write analysis prompts, and avoid hallucination pitfalls.

· 2 min read
→
LLM Hallucinations: Why They Happen and 5 Ways to Stop Them
Learning Lab

LLM Hallucinations: Why They Happen and 5 Ways to Stop Them

Why do language models confidently invent facts? Because they predict tokens, not truth. Learn how grounding, constraint prompting, and temperature settings cut hallucination rates from 15%+ to under 5% in production systems.

· 5 min read
→
Freelancer AI Workflows That Actually Increase Billable Hours
Learning Lab

Freelancer AI Workflows That Actually Increase Billable Hours

AI can double your freelance output without replacing your judgment. Learn four production workflows that compress administrative tasks and recover 10+ billable hours per month.

· 6 min read
→
Stop Hallucinating: How RAG Actually Grounds LLMs
Learning Lab

Stop Hallucinating: How RAG Actually Grounds LLMs

RAG grounds LLMs with your actual data, eliminating hallucinations. This guide explains how RAG works in production, why basic setups fail, and the specific patterns that work — with code examples and trade-offs.

· 6 min read
→
Where Your Prompts Go: Data Handling in ChatGPT, Claude, and Gemini
Learning Lab

Where Your Prompts Go: Data Handling in ChatGPT, Claude, and Gemini

ChatGPT stores your data and uses it for training by default. Claude doesn't train on web conversations unless you opt in. Gemini links your chats to your entire Google account. Here's what each model does with your prompts and how to protect sensitive information.

· 4 min read
→

More from Prompt & Learn

Otter vs Fireflies vs tl;dv: Meeting Transcription Shootout
AI Tools Directory

Otter vs Fireflies vs tl;dv: Meeting Transcription Shootout

Three tools promise to transcribe your meetings and extract action items. Only one integrates cleanly with your workflow. Here's the real comparison: Otter vs Fireflies vs tl;dv — accuracy data, pricing breakdowns, and honest pros/cons for each.

· 4 min read
→
Gamma vs Beautiful.ai vs Tome: Slide Generation Tested
AI Tools Directory

Gamma vs Beautiful.ai vs Tome: Slide Generation Tested

I tested Gamma, Beautiful.ai, and Tome on production presentations. Gamma generates fastest but struggles with branding. Beautiful.ai delivers visual consistency and data handling. Tome offers flexibility and collaboration. Here's what actually works in practice — and when each tool wins.

· 11 min read
→
App Store Launches Spike in 2026. AI Tooling Is the Catalyst
AI News

App Store Launches Spike in 2026. AI Tooling Is the Catalyst

Appfigures reports a measurable surge in app launches in 2026, driven by AI development tools that compress timelines from weeks to days. A solo developer with Claude or Mistral can now ship what required a full engineering team in 2022.

· 3 min read
→
Julius AI vs ChatGPT vs Claude for Data Analysis
AI Tools Directory

Julius AI vs ChatGPT vs Claude for Data Analysis

Julius AI, ChatGPT Advanced Data Analysis, and Claude Artifacts all handle data tasks, but execution speed, pricing, and workflow differ significantly. Here's how to pick the right one for your use case.

· 4 min read
→
Perplexity vs Google AI vs Consensus: Which Wins for Academic Research
AI Tools Directory

Perplexity vs Google AI vs Consensus: Which Wins for Academic Research

Perplexity, Google AI, and Consensus each excel at different research tasks. Perplexity wins on recent topics with real-time synthesis. Consensus delivers unmatched citation precision for peer-reviewed work. Google Scholar provides historical depth. This breakdown shows exactly which tool to use for your next paper—and why.

· 10 min read
→
Google’s Travel Tools Cut Planning Time in Half. Here’s What Actually Works
AI Tools Directory

Google’s Travel Tools Cut Planning Time in Half. Here’s What Actually Works

Google released seven integrated travel tools this spring. Price tracking predicts optimal booking windows, restaurant availability pulls real-time data, and offline maps work without cell coverage. Here's which features earn trust and where to set expectations.

· 3 min read
→

Stay ahead of the AI curve

Weekly digest of the most impactful AI breakthroughs, tools, and strategies. No noise, only signal.

Follow Prompt Builder Prompt Builder