Prompt Optimizer
Turn whatever the user has — an existing prompt, a rough thought dump, or nothing at all — into a prompt tuned for their target model, effort level, and application. Never tune for a specific model from memory: the per-model behavioral deltas live in references/ and change every generation. Route first, then write.
Workflow
- Classify the starting material. Existing prompt → diagnose before rewriting (see Common defects below); preserve the user's domain knowledge and hard-won constraints. Thought dump → extract goal, audience, constraints, success criteria; reorganize, don't summarize away. Nothing → interview first.
- Establish the target. Four facts, inferred where possible, asked in ONE batch (AskUserQuestion in Claude Code) only for what's missing: model, application (Claude Code / Cowork / claude.ai chat / Deep Research / API or custom agent), effort or thinking setting, intent (what success looks like, who consumes the output, one-off vs reusable). If the user doesn't know model/effort, recommend from
references/models-and-effort.mdinstead of asking them to decide blind. - Load references per the routing tables below. Read every file the target matches before writing.
- Build or rewrite applying the universal guidelines, then layer the model-specific and application-specific patterns from the loaded references. Copy the references' verbatim prompt snippets where they fit — they are tested language.
- Deliver: the prompt in a fenced block (with
{{PLACEHOLDER}}s for reusable prompts), one-line recommended settings (model, effort/thinking, placement), and 3–6 "what changed and why" bullets for rewrites. Offer one iteration round: if the output misses, ask for the actual output and diagnose rather than guessing.
Universal guidelines (all current Claude models)
- Clear and direct. The golden rule: show the prompt to a colleague with minimal context — if they'd be confused, Claude will be too. Want above-and-beyond behavior? Ask for it explicitly.
- Give the reason, not only the request. State why the task matters, who it's for, what the output enables. Claude generalizes correctly from motivation ("output is read by TTS, so no ellipses" beats "NEVER use ellipses").
- Make success measurable. Concrete output format, length, audience, acceptance criteria.
- Structure with XML tags when mixing instructions, context, examples, or variable inputs. Long documents (20k+ tokens) go at the TOP, query at the bottom; wrap docs in
<document>tags and ask for grounding quotes first. - 3–5 examples when format or tone is hard to describe: relevant, diverse (edge cases, no unintended patterns), wrapped in
<example>tags. Claude follows examples over contradicting instructions. - Say what to do, not what to avoid. "Write flowing prose paragraphs" beats "don't use markdown." Match your prompt's own style to the desired output style.
- Prefer general instructions over prescriptive steps. "Think thoroughly about edge cases" beats a hand-written reasoning plan. Current models need intent and boundaries, not enumerated micro-instructions — over-prescription degrades output (only Haiku-class models want the opposite: explicit steps, tighter format specs, more examples).
- Effort is the primary capability/cost lever — recommend an effort setting alongside the prompt; per-model recommendations differ (see routing).
- Cut everything that doesn't earn its tokens. Obsolete scaffolding actively hurts: anti-laziness nudges, "CRITICAL: you MUST" emphasis, prescribed step-by-step reasoning, prefill hacks,
budget_tokensthinking configs, forced interim status messages, and show-your-reasoning instructions (refusal risk on Fable 5). - Measure any prompting change against real outputs or evals rather than assuming it helped.
Routing — model axis (always load the matching file)
| Target model | Read | The traps it saves you from |
|---|---|---|
| Fable 5 / Mythos 5 | references/fable-5.md |
Longer turns by default (timeouts, async check-ins); effort high default / xhigh for capability-critical; anti-overplanning + brevity + checkpoint snippets; grounding progress claims against tool results; memory-system construction; parallel-subagent defaults; send-to-user tool; NEVER instruct reasoning echo (reasoning_extraction refusals); prior-generation skills are too prescriptive — trim them |
| Opus 5 | references/opus-5.md |
REMOVE verification/self-check instructions (over-verification); effort doesn't shorten visible responses — prompt length explicitly; written deliverables run long — calibrate; scope-expansion constraint; subagent spawn caps; thinking-disabled artifacts |
| Opus 4.8 | references/opus-4-8.md |
Thinking OFF unless {type: "adaptive"}; xhigh start for coding/agentic + 64k max_tokens headroom; favors reasoning over tool calls — raise effort or instruct tool use; literal instruction following at low effort; cream/serif design default |
| Sonnet 5 | references/sonnet-5.md |
Adaptive thinking ON by default (change from 4.6); temperature/top_p/top_k now 400 errors; new tokenizer ≈ +30% tokens — revisit max_tokens; effort mapping (Sonnet 5 medium ≈ 4.6 high); literal instruction following |
| Haiku 4.5 | no dedicated guide | Use universal guidelines + the Haiku-class exception above (explicit steps, more examples); say honestly that no behavioral guide is on file |
| Any model, deep topic | references/best-practices.md |
Full sections: General principles, Output and formatting, Tool use (parallel calls, <default_to_action> blocks), Thinking and reasoning, Agentic systems (state management, subagents, anti-hardcoding, anti-hallucination), Capability-specific tips, Migration considerations |
Routing — application axis (load in addition to the model file)
| Application context | Read |
|---|---|
| Claude Code, Cowork, claude.ai chat, API — where instructions live, platform features | references/platforms.md |
| Deep Research request | references/deep-research.md (brief structure, template, anti-patterns) |
| Long-horizon / autonomous / multi-agent runs (incl. Claude Code ultracode) | model file's long-run sections (Fable 5: longer turns, progress grounding, subagents, memory, early stopping) + references/best-practices.md § Agentic systems |
| Code-review harness | Opus 4.8 / Sonnet 5: the model file's "Code review harnesses" section. Opus 5: "Capability improvements" (code-review bullet). Fable 5: no dedicated section — apply the same rule from here: conservative-filter language ("only high-severity," "be conservative") silently tanks recall on current models; instruct report-everything with per-finding severity+confidence and filter downstream |
| Interactive coding product | model file's "Interactive coding products" section (front-load the spec; reduce user turns) |
| Frontend/design brief | model file's "Design and frontend defaults" (fixed house-style palettes; specify concretely or ask for 4 directions) |
| Computer use | model file's "Computer use" section (resolution/cost tuning) |
| Choosing model or effort for the user | references/models-and-effort.md |
Worked routing examples: "Fable 5 in Claude Code driving an ultracode fleet" → fable-5.md (all long-run sections) + platforms.md § Claude Code + best-practices.md § Agentic systems. "Opus 5 deep research in the Claude app" → opus-5.md (deliverable length, over-verification) + deep-research.md.
Common defects in existing prompts
- Missing motivation — rules with no why.
- Buried instructions — critical constraints mid-wall-of-text; move to top/bottom or a tagged section.
- Conflicting rules — accumulated patches; resolve, don't stack.
- Negative-only formatting rules — replace with positive instructions.
- Obsolete scaffolding — see the cut-list in Universal guidelines; also legacy verification steps (harmful on Opus 5) and forced-status-update scaffolding (current models update well unprompted).
- Example drift — examples contradicting instructions; Claude follows the examples.
- Wrong-generation tuning — prompt tuned for an older model's failure modes; check the target model file's migration notes before preserving any workaround.