Malhar Ujawane

Blog

Explainer·(updated October 31, 2026)

What is prompt engineering? What still works in 2026

Prompt engineering is writing and testing the instructions you give an LLM. The techniques that still work in 2026, what changed, and a Python eval harness.

What is prompt engineering? What still works in 2026

Prompt engineering is the practice of writing, structuring and testing the instructions you give a language model so it produces the output you need, reliably. In 2026 it means clear task descriptions, context about why, a few good examples, an explicit output format, and an eval set that tells you whether a change to the prompt made things better or worse.

The phrase has a reputation problem. To many people it means magic words and “you are a world-class expert” preambles. That version mostly died with better models. The version that survived looks a lot like writing a good spec for a new colleague, and then testing it.

How did prompt engineering start?

With GPT-3. The 2020 paper Language Models are Few-Shot Learners (Brown et al.) showed that a large enough model could do a new task from “only a few examples or from simple instructions” in the prompt, with no fine-tuning. Suddenly the prompt was the program, and how you wrote it mattered.

Two results in 2022 made it a field. Chain-of-thought prompting (Wei et al., January 2022) showed that including worked reasoning steps in few-shot examples improved arithmetic, commonsense and symbolic reasoning in large models. Large Language Models are Zero-Shot Reasoners (Kojima et al., May 2022) got a similar effect by adding “Let’s think step by step” before the answer. I cover that thread in chain-of-thought prompting.

Then ChatGPT arrived in November 2022, and everyone became a prompt engineer whether they wanted the title or not.

What changed by 2026?

Three things.

Reasoning models think on their own. “Let’s think step by step” was a workaround for models that didn’t reason unless asked. Reasoning models are trained to do it, and their thinking is controlled by API settings rather than prompt phrases. OpenAI’s prompt engineering guide puts the difference simply: “A reasoning model is like a senior co-worker. You can give them a goal to achieve and trust them to work out the details,” while “a GPT model is like a junior coworker” that does best with explicit instructions.

Models follow instructions more literally. Anthropic’s prompting best practices say current Claude models are “trained for precise instruction following”. Their example: if you say “can you suggest some changes,” Claude will sometimes suggest rather than implement. Vague prompts that older models charitably over-interpreted now get exactly what they asked for.

The prompt is a small part of the context. In an agent, the instructions you wrote are a few thousand tokens next to tool definitions, files, search results and history. Deciding all of that is context engineering, which Anthropic calls “the natural progression of prompt engineering”. Prompt engineering didn’t go away; it became one layer of a bigger job.

Which prompt engineering techniques still work?

These are the ones both Anthropic’s and OpenAI’s current guides still recommend, and the ones I’d teach first.

Be clear and direct. Anthropic’s advice is to treat the model as “a brilliant but new employee who lacks context on your norms and workflows”, with a test I like: “Show your prompt to a colleague with minimal context on the task and ask them to follow it. If they’d be confused, Claude will be too.”

Explain why. Giving the reason behind an instruction helps because, in Anthropic’s words, “Claude can generalize from the explanation.” “Keep answers under 80 words” is a rule. “Answers are read aloud by a voice assistant, so keep them under 80 words” is a rule the model can extend to cases you didn’t list, such as skipping tables and URLs.

Show examples. Few-shot examples are still “one of the most reliable ways to steer” format, tone and structure. Make them relevant, diverse enough that the model doesn’t copy an accidental pattern, and clearly marked, for example inside <example> tags.

Structure the prompt. Separate instructions, context, examples and input with XML tags or Markdown headers so the model can’t confuse a document with an instruction. OpenAI’s guide shows the same idea with Identity, Instructions and Examples sections.

Put long documents first. For inputs of 20k tokens or more, Anthropic recommends placing the documents at the top and the question at the end, and asking the model to quote the relevant parts before answering.

Specify the output. Ask for a specific format, and when code will parse it, use structured output so the API enforces the schema instead of hoping the model complies.

Pin the model. OpenAI recommends pinning production apps to a model snapshot, because “different snapshots of models within the same family could produce different results”. A prompt is tuned for a model, not for all models.

What I’d drop: role-play superlatives, threats, tips and ALL-CAPS shouting. Anthropic’s guide warns that newer Claude models are more responsive to the system prompt, so language like “CRITICAL: You MUST use this tool” written for older models can make them overtrigger; their fix is to “soften any aggressive language”.

How do you test a prompt?

This is the part most teams skip and the part that makes it engineering. Anthropic’s prompt engineering overview says it plainly: before you start, have “a clear definition of the success criteria” and “some ways to empirically test against those criteria”. Here is the smallest version: two prompt versions, three test cases, a scorer written in code.

# prompt_eval.py: prompt engineering as a test suite, not a vibe.
# Two prompt versions, the same test cases, scored by code. The outputs below are
# sample data standing in for model replies, so the scores illustrate the method only.
import json

def build_prompt(version, ticket):
    if version == "v1":
        return f"Classify this support ticket and give a priority.\n\n{ticket}"
    return "\n".join([  # v2: role, why, explicit format, one example, input in its own tag
        "You triage support tickets for an invoicing app used by small Indian businesses.",
        "Priority decides who gets paged at night, so only use P1 when money is moving wrongly.",
        'Reply with JSON only: {"category": "billing|bug|account|other", "priority": "P1|P2|P3"}',
        "<example>",
        "<ticket>GST shows 28% instead of 18% on every invoice since this morning</ticket>",
        '{"category": "billing", "priority": "P1"}',
        "</example>",
        f"<ticket>{ticket}</ticket>",
    ])

CASES = [
    ("Customer was charged twice for the same invoice", {"category": "billing", "priority": "P1"}),
    ("Dark mode text is hard to read on the settings page", {"category": "bug", "priority": "P3"}),
    ("How do I add a second user to my account?", {"category": "account", "priority": "P3"}),
]

RECORDED = {  # sample replies for each (version, case index)
    ("v1", 0): "This looks like a billing issue. I'd say it's high priority!",
    ("v1", 1): 'Category: UI bug\nPriority: Low',
    ("v1", 2): '{"category": "account", "priority": "low"}',
    ("v2", 0): '{"category": "billing", "priority": "P1"}',
    ("v2", 1): '{"category": "bug", "priority": "P3"}',
    ("v2", 2): '{"category": "account", "priority": "P2"}',
}

def score(reply, want):
    try:
        got = json.loads(reply)
    except json.JSONDecodeError:
        return "unparseable"
    return "pass" if got == want else f"wrong {got}"

for version in ("v1", "v2"):
    n_tokens = len(build_prompt(version, CASES[0][0])) // 4  # rough English estimate
    results = [score(RECORDED[(version, i)], want) for i, (_, want) in enumerate(CASES)]
    print(f"{version} (~{n_tokens} prompt tokens): {results.count('pass')}/{len(CASES)} pass")
    for (ticket, _), r in zip(CASES, results):
        print(f"   {ticket[:30]:<32}{r}")

Output (Python 3.13.11):

v1 (~24 prompt tokens): 0/3 pass
   Customer was charged twice for  unparseable
   Dark mode text is hard to read  unparseable
   How do I add a second user to   wrong {'category': 'account', 'priority': 'low'}
v2 (~116 prompt tokens): 2/3 pass
   Customer was charged twice for  pass
   Dark mode text is hard to read  pass
   How do I add a second user to   wrong {'category': 'account', 'priority': 'P2'}

The replies are sample data I wrote to show the method, so don’t read the scores as a result about any model. Read the shape instead. The v1 prompt never said what format or what priority scale to use, so even a correct judgment (“high priority!”) fails the parser. The v2 prompt adds a role, a reason (“decides who gets paged at night”), a format and one example, and costs about 90 more tokens per call. The remaining failure is useful: the prompt defines P1 but never says what separates P2 from P3, so the next edit is obvious. Wire RECORDED to a real API call, grow CASES to 50 real tickets, and this is a working eval. How to evaluate AI agents covers the next steps, including using a model as the judge.

Is prompt engineering still a job?

As a standalone title, mostly not, in my view. As a skill, it’s part of every AI engineering job, the same way writing SQL is part of every data job. The people who are good at it write clearly, think about edge cases and test their changes. Those are engineering habits, and they transfer to agentic engineering, where the prompt is an AGENTS.md file or a task spec for a coding agent.

What I would do

I’d start every prompt with the eval, not the prompt: 20 to 50 real inputs with expected outputs, and a scorer in code wherever the output can be checked mechanically. Then I’d write the plainest prompt that explains the task, the reason, the format and one or two examples, and iterate only on failures the eval shows me.

From delivery work, the habits I’d enforce on a team: keep prompts in version control next to the code, change one thing at a time, re-run the eval on every model upgrade, and set temperature deliberately rather than leaving it at the default. And when a prompt keeps growing to handle exceptions, I’d take that as a sign that part of the job belongs in code or in a tool.

FAQ

Is prompt engineering dead?

The magic-words version is. The version that means clear specifications, examples, output formats and evals is alive, and it’s now part of context engineering for agents rather than a separate discipline.

Do I still need “think step by step” with reasoning models?

Usually not. Reasoning models are trained to reason before answering, and OpenAI suggests giving them high-level goals. Use the API’s reasoning or effort settings to control how much they think.

What is the difference between prompt engineering and fine-tuning?

Prompt engineering changes the input and leaves the model alone; it’s fast and cheap to iterate. Fine-tuning changes the model’s weights with training examples. Try prompting and retrieval first, and fine-tune when a well-tested prompt still can’t hit the quality or cost you need.

Are few-shot examples still useful in 2026?

Yes. Both Anthropic and OpenAI still recommend examples for steering format and tone. Keep them few, varied and clearly separated from the instructions.

Sources

Get new posts in your inbox

© 2026 Malhar Ujawane. Built with Astro.