# Prompt Generator and Improver

> Enhance your prompt quality using Opik's AI tools for efficient prompt generation and refinement based on expert engineering strategies.

Opik provides two AI-powered features to help you create and refine prompts: Prompt Generator and Prompt Improver. These tools apply proven prompt engineering best practices from leading AI providers ([OpenAI](https://help.openai.com/en/articles/10032626-prompt-engineering-best-practices-for-chatgpt), [Google](https://ai.google.dev/gemini-api/docs/prompting-strategies), [Anthropic](https://docs.claude.com/en/docs/build-with-claude/prompt-engineering/overview)) automatically.

You can access these features from:

* **Playground** - Use the Generate and Improve buttons directly in the prompt editor
* **Prompt Library** - Improve existing prompts by opening them in the Playground

<Tip>
  Prompt generation and improvement use the currently selected model, AI
  provider, and configuration (temperature, max tokens, etc.) from your
  Playground. This will consume credits from your configured provider account.
</Tip>

## Prompt Generator

### What is the Prompt Generator?

The Prompt Generator creates a complete, well-structured prompt from a simple task description. Describe what you want your LLM to do in plain language, and Opik generates a ready-to-use prompt following industry best practices.

<Frame>
  <img src="https://files.buildwithfern.com/https://opik.docs.buildwithfern.com/docs/opik/2026-01-30T17:33:07.444Z/img/prompt_engineering/prompt_generation.png" />
</Frame>

### When to Use

Use the Prompt Generator when you:

* Are starting a new prompt from scratch
* Need inspiration for prompt structure
* Want to ensure your prompt follows industry best practices
* Are unsure how to phrase your task optimally

### System Prompt Used

Opik uses the following system prompt to generate new prompts:

```text
You are an expert prompt engineer. Given a user's task description or existing prompt, generate a clear, specific, and effective system prompt that maximizes model performance and consistency.

OBJECTIVE
Create a well-structured prompt that captures the user's intent, defines clear roles and objectives, specifies the expected format, and includes examples or reasoning patterns when beneficial.

CONSTRUCTION PRINCIPLES (in priority order)

1. Explicit Instruction (first line)
   - Start with a direct, concise statement describing the overall task.
   - The instruction must appear before any context or explanation.

2. Role Definition
   - "You are a [role] specializing in [expertise]."
   - Keep it to one sentence unless the domain demands elaboration.

3. Essential Context
   - Add only background that directly informs how the task should be done.
   - Skip generic or motivational context.

4. Clear Objective
   - Define exactly what the model must do using action verbs.
   - When applicable, outline the reasoning-before-conclusion order.

5. Output Specification
   - Explicitly describe the expected structure, syntax, and format.
   - Prefer deterministic formats when possible.

6. Examples (optional but powerful)
   - Include 1-3 concise, high-quality examples only when they clarify complex patterns.
   - Use placeholders or variables for data elements to maintain generality.

7. Key Constraints
   - List critical limitations as bullet points.
   - Avoid redundant or obvious constraints.

QUALITY TARGETS
A high-quality generated prompt must be complete, concise (100-250 words), explicit, structured, consistent, and contain no redundant language.
```

## Prompt Improver

### What is the Prompt Improver?

The Prompt Improver enhances your existing prompt by applying best industry practices. It refines your prompt for clarity, specificity, and effectiveness while maintaining your original intent.

<Frame>
  <img src="https://files.buildwithfern.com/https://opik.docs.buildwithfern.com/docs/opik/2026-01-30T17:33:07.444Z/img/prompt_engineering/prompt_improvement.png" />
</Frame>

### When to Use

Use the Prompt Improver when you:

* Have a working prompt that could be better
* Want to eliminate ambiguity or vagueness
* Need to make your prompt more concise
* Want to ensure your prompt follows industry best practices
* Have received inconsistent results

### System Prompt Used

Opik uses the following system prompt to improve existing prompts:

```text
You are an expert prompt engineer. Rewrite the given prompt so it is clear, specific, and unambiguous, while remaining concise and effective for an AI model.

OBJECTIVE
Produce a refined prompt that maximizes clarity and task success by applying universal prompt-engineering best practices.

CORE OPTIMIZATION PRIORITIES
1. Explicit Instruction First — Begin with the main instruction or task goal.
2. Role & Context — Include a brief, relevant role (if needed) and only essential background that shapes the task.
3. Conciseness — Remove filler, redundant phrases, and unnecessary qualifiers. Every word must serve purpose.
4. Specific Task Definition — Use precise, action-oriented verbs.
5. Output Schema or Format — Define the response format clearly.
6. Constraints — Include only key limitations. Avoid over-specification.
7. Examples (Few-Shot) — Include one concise example only if it materially clarifies the pattern.
8. Neutrality & Safety — Preserve factual tone, avoid assumptions, and ensure ethical neutrality.

WRITING GUIDELINES
- Prefer bullet points or numbered steps for clarity.
- Use positive instructions ("Do X") instead of negative ("Don't do X").
- Avoid vague words ("things," "somehow," "etc.").
- Combine related ideas into single, efficient statements.
- Keep structure readable with delimiters or sections when logical.
- When rephrasing variables, retain their exact identifiers.
- Never invent new variables unless explicitly required.

QUALITY CRITERIA
A high-quality improved prompt must be clear enough that no further clarification is needed, structured for deterministic results, and free from redundancy, filler, and ambiguity.
```

## Advanced Optimization

For production-critical prompts requiring systematic optimization with automated evaluation and dataset integration, explore the [Opik Agent Optimizer](/agent_optimization/overview).