0PricingLogin
AI Prompt Engineering · Lesson

What Is Meta-Prompting?

Prompts that produce other prompts: the recursive power of LLMs.

Meta-Prompting Defined

Meta-prompting is the practice of writing prompts whose output is other prompts. Instead of directly solving a task, a meta-prompt instructs the model to generate the instructions that will then solve the task. It is a layer of abstraction above regular prompting.

First-Order vs. Meta-Prompting

The distinction between first-order and meta-prompting: first-order prompts produce task outputs (summaries, code, analysis). Meta-prompts produce prompts, evaluation criteria, or system instructions that can then be applied to the actual task.

import anthropic

client = anthropic.Anthropic(api_key='YOUR_API_KEY')

# FIRST-ORDER prompt (produces a task output directly)
first_order = 'Write a customer service response for a user whose order was delayed.'

# META-PROMPT (produces a prompt that can then solve similar tasks)
meta_prompt = (
    'Design a system prompt for a customer service AI agent '
    'that handles order delay complaints. The agent should '
    'be empathetic, solution-focused, and proactively offer '
    'compensation when appropriate. Output only the system prompt.'
)

response = client.messages.create(
    model='claude-opus-4-5', max_tokens=800,
    messages=[{'role': 'user', 'content': meta_prompt}]
)
generated_system_prompt = response.content[0].text
print('Generated system prompt:')
print(generated_system_prompt[:300], '...')

All lessons in this course

  1. What Is Meta-Prompting?
  2. Prompts That Generate Prompts
  3. Self-Improving Prompt Systems
  4. Evaluation and Selection in Self-Improvement
← Back to AI Prompt Engineering