Prompt Engineering

Techniques for writing effective prompts that get better results from AI models.

10 tips in this topic

Key Tips

All Tips

How do I get Claude to write in my style?

Paste 3-5 examples of your writing and ask Claude to analyze the style before writing new content. The model will identify patterns in tone, sentence structure, and vocabulary that it can then replicate.

quick-win Simon Willison Prompt Engineering

What is the "pretend you are an expert" technique?

Start prompts with "You are an expert [role]" to activate relevant knowledge patterns. This framing helps the model draw from specialized knowledge and adopt appropriate communication styles for that domain.

quick-win Ethan Mollick Prompt Engineering, ChatGPT Tips

How should I structure complex coding prompts?

Break complex coding tasks into three parts: context (what exists), goal (what you want), and constraints (requirements and limitations). This structure prevents the AI from making assumptions and produces more accurate code.

moderate Linus Lee Prompt Engineering, AI Coding

Why should I ask the AI to think step by step?

Adding "think step by step" or "let's work through this" to prompts triggers chain-of-thought reasoning. This dramatically improves accuracy on math, logic, and multi-step problems by forcing the model to show its work.

quick-win Ethan Mollick Prompt Engineering, ChatGPT Tips

What is the "sandwich" feedback technique?

When iterating on AI output, structure feedback as: what worked, what to change, then restate what to keep. This prevents the model from over-correcting and throwing out good elements while fixing problems.

moderate Ethan Mollick Prompt Engineering

What is context stuffing and when should I use it?

Paste relevant documentation, examples, or reference material directly into your prompt before asking questions. AI models work best with explicit context rather than relying on training data that may be outdated or incomplete.

moderate Linus Lee Prompt Engineering, AI Coding

What temperature setting should I use?

Temperature controls randomness. Use 0-0.3 for factual tasks (coding, math, analysis), 0.5-0.7 for balanced tasks (writing, summarization), and 0.8-1.0 for creative tasks (brainstorming, fiction). Start low and increase if outputs feel too rigid.

moderate Ethan Mollick Prompt Engineering

What is "few-shot prompting" and when should I use it?

Few-shot prompting means giving 2-5 examples before your actual request. Format: "Example 1: [input] -> [output]. Example 2: [input] -> [output]. Now do this: [your input]". The model learns the pattern from examples.

quick-win Riley Goodside Prompt Engineering

Should I use GPT-4 or a fine-tuned smaller model?

Use GPT-4 for prototyping and diverse tasks. Fine-tune smaller models when you have consistent, narrow use cases with thousands of examples. Fine-tuned models are cheaper to run but expensive to train and maintain. Start with GPT-4, only fine-tune if cost becomes prohibitive.

advanced Swyx Enterprise AI, Prompt Engineering

How do I write system prompts that stick?

Put the most important instructions at the start AND end of the system prompt (primacy and recency effects). Use clear formatting like numbered lists. Repeat critical constraints. Test with adversarial inputs to see if the model breaks character.

moderate Riley Goodside Prompt Engineering, AI Agents