# 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
