---
name: "prompt-optimizer"
description: "Paste a rough AI prompt and get an optimized version with an explanation of every improvement. Applies clarity, specificity, context-setting, output format, and constraint techniques. Works for Claude, GPT, Gemini, and any LLM."
metadata:
  version: "1.0.0"
disable-model-invocation: true
---

# Prompt Optimizer

> **Purpose:** Transform a rough, vague, or inconsistent AI prompt into a high-quality, optimized version. Analyzes the original for common failure modes — ambiguity, missing context, no output format spec, conflicting constraints — then produces an improved version with a diff-style explanation of every change made. Works for any LLM (Claude, GPT, Gemini, Llama).

---

## Invocation

```
/optimize-prompt
```

Paste your prompt after the command or in the next message.

---

## What Gets Analyzed

### 1. Clarity and Specificity
- Is the task underspecified? ("write some code" vs "write a TypeScript function that...")
- Are there ambiguous pronouns or references?
- Does it state what a "good" output looks like?

### 2. Context
- Is there missing background the model needs to answer well?
- Should a persona or role be set? ("You are a senior security engineer...")
- Is the input format specified?

### 3. Output Format
- Is the expected format defined (JSON, Markdown, bullet list, numbered steps)?
- Is length/verbosity specified?
- Are examples of the desired output provided?

### 4. Constraints
- Are there conflicting or redundant instructions?
- Are hard constraints clearly marked vs soft preferences?
- Is scope limited to prevent scope creep?

### 5. Chain-of-Thought
- Would the model benefit from "think step by step"?
- Should it show its reasoning or just the answer?

---

## Output Format

```markdown
## Original Prompt

[your original prompt, quoted]

---

## Issues Found

| # | Issue | Severity | Category |
|---|-------|----------|----------|
| 1 | [description] | High/Med/Low | Clarity/Context/Format/Constraints |

---

## Optimized Prompt

[the improved prompt, ready to copy-paste]

---

## What Changed

- **[Change 1]:** [explanation of why this improves the prompt]
- **[Change 2]:** [explanation]

---

## Tips for This Type of Prompt

[1-3 specific tips for prompts in this domain]
```

---

## Rules

- **Never change the intent** — only improve how it's expressed
- **Show every change** — the explanation section must account for all edits
- If the original prompt is already well-optimized (score ≥ 8/10), say so and note only minor suggestions
- Rate the original prompt 1-10 for context (e.g., "Original: 4/10 — Optimized: 9/10")
- If the prompt is for a specific model (Claude, GPT-4, etc.), apply model-specific best practices
- Don't over-engineer simple prompts — sometimes "write a haiku about coffee" doesn't need improvement

## Playground

<!DOCTYPE html><html><head><meta charset='utf-8'><style>*{box-sizing:border-box;margin:0;padding:0}body{background:#0d1117;color:#e6edf3;font-family:monospace;font-size:12px;height:100vh;display:flex;flex-direction:column;overflow:hidden}.header{background:#161b22;border-bottom:1px solid #30363d;padding:8px 14px;font-size:11px;color:#8b949e;display:flex;justify-content:space-between;align-items:center;flex-shrink:0}.title{color:#58a6ff;font-weight:bold;font-size:13px}.panels{display:flex;flex:1;overflow:hidden}.panel{flex:1;overflow:auto;padding:12px;border-right:1px solid #30363d}.panel:last-child{border-right:none}.label{font-size:10px;color:#8b949e;text-transform:uppercase;letter-spacing:.08em;margin-bottom:6px}pre{white-space:pre-wrap;word-break:break-word;line-height:1.5}</style></head><body><div class='header'><span class='title'>Prompt Optimizer</span><span>Example · SkillSlap</span></div><div class='panels'><div class='panel'><div class='label'>Input: Rough prompt</div><pre><span style='color:#8b949e'>write me a function that takes</span>
<span style='color:#8b949e'>a list of numbers and removes</span>
<span style='color:#8b949e'>duplicates and also sorts it</span>
<span style='color:#8b949e'>and returns it, in python</span></pre></div><div class='panel'><div class='label'>Output: Optimized prompt</div><pre><span style='color:#58a6ff'>Write a Python function with this</span>
<span style='color:#58a6ff'>signature:</span>

<span style='color:#3fb950'>def dedupe_sorted(nums: list[int])</span>
<span style='color:#3fb950'>  -> list[int]:</span>

<span style='color:#58a6ff'>Requirements:</span>
<span style='color:#8b949e'>- Remove duplicate values</span>
<span style='color:#8b949e'>- Return elements in ascending order</span>
<span style='color:#8b949e'>- Do not modify the input list</span>
<span style='color:#8b949e'>- Handle empty list (return [])</span>
<span style='color:#8b949e'>- Type-annotated, no external imports</span>

<span style='color:#58a6ff'>Example:</span>
<span style='color:#8b949e'>dedupe_sorted([3,1,2,1,3]) → [1,2,3]</span>
<span style='color:#8b949e'>dedupe_sorted([])          → []</span></pre></div></div></body></html>