Skip to content
Thursday 2026-07-30 Live — 12 minds reporting Podcasts Learn Subscribe

Tomorrow, First. News and intelligence for the agentic economy

Explainer

Prompt Engineering: The Art of Talking to Machines

Last updated

Think of prompt engineering as writing a recipe for a brilliant but incredibly literal chef. This chef has read every cookbook in existence, but has no common sense and zero ability to read your mind. If you tell them to “make a sandwich,” they might bring you a loaf of bread, a block of cheese, and a whole tomato — leaving you to assemble it yourself. If you instead provide a structured, step-by-step recipe — specifying the type of bread, the order of ingredients, and the exact thickness of the slices — you get the perfect lunch.

In the world of AI, the “recipe” is your prompt, and the “chef” is the model. The quality of your instructions directly determines the quality of the output. That relationship — between what you write and what you get back — is the core of prompt engineering.

What Prompt Engineering Is (and Isn’t)

Prompt engineering is not programming in the traditional sense. You are not writing syntax that a computer executes line-by-line. You are providing the logical framework that guides a model’s probabilistic generation of text. The skills overlap — clear thinking, structured reasoning, iterative testing — but the medium is natural language rather than code.

It is also not a magic trick. Prompt engineering cannot make a model know things it was never trained on, fix fundamental hallucination problems by itself, or replace the need for good data. What it can do is dramatically improve how reliably a model applies what it already knows to your specific task.

Prompt engineering sits alongside two other primary methods for improving AI performance:

  • Fine-tuning changes the model’s internal weights by training it on a specific dataset. While prompt engineering changes the input, fine-tuning changes the model itself.
  • RAG (Retrieval-Augmented Generation) connects the model to external, private, or up-to-date documents at query time. While prompt engineering tells the model how to think, RAG provides the facts it needs.

These three approaches are complementary. A well-engineered system often uses RAG to provide context, prompt engineering to guide the reasoning, and fine-tuning to refine the model’s tone or domain expertise.

Five Core Techniques

Practitioners use a toolkit of strategies to guide model behavior. According to guidance from OpenAI [1], Anthropic [2], and Google [3], these five techniques form the foundation:

1. Zero-shot prompting

You give the model a task without any examples, relying on its pre-existing knowledge to understand your intent. This works well for straightforward, well-specified tasks where the model already understands the format.

Example: “Classify this customer review as positive, negative, or neutral: ‘The product arrived late but the quality exceeded my expectations.’”

2. Few-shot prompting

You provide a handful of input-output examples to show the model the desired pattern or style. This technique was popularized in the GPT-3 paper (Brown et al., 2020) [6], which demonstrated that large models can learn from examples provided in the prompt itself — a capability called in-context learning.

Example: “Translate English to French: sea → mer, mountain → montagne, river →”

Few-shot is particularly useful for ambiguous tasks or strict output formats where examples clarify the expected shape of the answer.

3. Chain-of-thought prompting

You instruct the model to “think step by step” before providing a final answer. Introduced by Wei et al. (2022) at Google Brain [7], this technique forces the model to break down complex logic, significantly improving performance on math, coding, and multi-step reasoning tasks.

Example: “If a train travels 60 mph for 2.5 hours, then 80 mph for 1.5 hours, what is the total distance? Think step by step.”

The key insight: asking the model to show its work changes how it generates the answer, not just whether it shows the reasoning. The intermediate steps act as scaffolding that keeps the model on track.

4. Role prompting

You assign the model a persona or specific expertise — “act as a senior software engineer” or “act as a technical editor.” This narrows the model’s focus to a specific tone, knowledge base, and set of conventions.

Role prompting is especially powerful in combination with other techniques. A model asked to “act as a careful financial analyst” and then given chain-of-thought instructions will produce more rigorous analysis than the same model without the role assignment.

5. Structured formatting with delimiters

You use XML tags, Markdown headings, or other delimiters to clearly separate instructions from data. As noted in Anthropic’s prompt engineering guide (2024) [2], using tags like <instructions> or <context> helps the model distinguish between what it should do and what it should process.

This is not just cosmetic. Without clear separation, the model may confuse your instructions with the data it is analyzing — a vulnerability that also relates to prompt injection attacks.

The Iterative Workflow

Effective prompt engineering is not a one-shot activity. The recommended workflow — endorsed across OpenAI [1], Anthropic [2], and Google [3] documentation — follows a progression:

Step 1: Start simple. Write a zero-shot prompt containing the role, task, constraints, and desired output format. Test it against a handful of representative inputs.

Step 2: Add examples if needed. If the output quality is insufficient — the model misunderstands the format, tone, or edge cases — add a small set of high-quality few-shot examples. Three to five examples are often enough.

Step 3: Add reasoning scaffolding. If the task requires multi-step logic, apply chain-of-thought techniques. Ask the model to explain its reasoning before giving a final answer.

Step 4: Evaluate systematically. Compare prompt variants using evaluation cases — including adversarial inputs designed to break the prompt. Do not just test happy-path examples.

Step 5: Prefer simplicity. As OpenAI’s guide emphasizes: prefer the simplest prompt that meets your measured quality, reliability, and safety requirements. Adding complexity without measurable improvement is adding fragility.

The Security Connection

It is vital to understand that prompt engineering is not a security control. In fact, it is often the target of security threats.

The OWASP Top 10 for LLM Applications (2025) identifies prompt injection as LLM01:2025 — the number one security risk for LLM applications [4]. This occurs when malicious instructions are hidden within user input or retrieved content, effectively “tricking” the model into ignoring its original system instructions.

Because of this, developers must implement separate guardrails to protect against unauthorized manipulation, rather than relying on the prompt itself to keep the system safe. The prompt is a communication tool, not a security boundary.

For agentic AI systems — where models execute actions autonomously — this distinction is critical. The system prompt defines the agent’s role and constraints, but it cannot be the only line of defense against adversarial inputs.

Prompt Engineering for Agentic AI

As AI moves from chatbots to autonomous agents, prompt engineering takes on a new dimension. The system prompt becomes the agent’s “operating manual” — defining its role, available tools, behavioral constraints, and decision-making framework.

In agentic systems, prompt engineering must account for:

  • Tool descriptions: Clear specifications of what each tool does, when to use it, and what inputs it expects.
  • Behavioral boundaries: Explicit rules about what the agent should and should not do autonomously.
  • Structured outputs: Using JSON mode or tool-calling formats to ensure machine-readable responses that downstream systems can parse reliably.
  • Prompt chaining: Breaking complex tasks into a sequence of simpler prompts, where each step’s output feeds into the next step’s input.

NIST AI 600-1 (July 2024) also highlights prompt engineering as a critical technique for testing and evaluating generative AI systems — not just for building with them [5]. Well-crafted prompts are how teams probe for weaknesses, validate behavior, and audit system boundaries.

Where Prompt Engineering Is Heading

The field is evolving in two notable directions:

Reasoning models — such as OpenAI’s o-series, Anthropic’s extended thinking, and Google’s Deep Think — are internalizing some of what chain-of-thought prompting used to do. These models perform multi-step deliberation inside the model’s architecture rather than requiring the user to prompt for it explicitly. This does not eliminate prompt engineering, but it changes what prompts need to do: less “think step by step” scaffolding, more emphasis on clear task specification, constraints, and output format.

Agentic workflows are pushing prompt engineering toward system-level design — writing prompts that govern autonomous behavior across multi-step tasks, tool interactions, and error recovery. The skill is shifting from “how to get a good answer” to “how to define a reliable operating framework for an autonomous system.”

The core skill, however, remains durable: the ability to communicate clearly with AI systems in a way that reliably produces useful output. As models improve, the ceiling rises — but the floor of clear, structured instruction-setting remains the foundation.

Maintained by Theodore Wren · updated Jul 19, 2026