Optimize Prompt
Workflow
- Read the original prompt and all context the user supplied in the current conversation.
- Match the user's language unless the user requests another language.
- Read best-practices.md and classify the task as general-purpose or coding-related.
- Extract the explicit goal, context, constraints, requested output, and completion criteria.
- Identify only missing information that could materially change the optimized prompt.
- If essential information is missing, follow the clarification policy and stop until the user answers through Ask User or explicitly invokes $optimize-prompt again.
- Rewrite the prompt with the minimum structure needed for reliable execution.
- Check the result against the preservation and output rules before returning it.
Clarification Policy
When essential information is missing:
- Use Ask User when it is available.
- When Ask User is unavailable, ask concise questions in plain text and instruct the user to answer by explicitly invoking
$optimize-promptagain. - Ask one to three highest-impact questions in one interaction, ordered by importance.
- Use mutually exclusive choices when the valid options are known; otherwise use an open question.
- Do not ask for details that are present, safely inferable, or merely nice to have.
- Do not output a partial optimized prompt.
- After the user answers through Ask User or explicitly invokes
$optimize-promptagain, read the original prompt and their answers from the current conversation and resume the workflow without repeating resolved questions.
Rewrite Rules
- Preserve the user's intent, language, facts, examples, and hard constraints.
- Do not invent business facts, technical context, source material, file paths, or acceptance criteria.
- Resolve ambiguity only from supplied context or user answers.
- Add headings, ordering, or explicit steps only when they improve clarity or reliability.
- Keep simple prompts concise; do not mechanically expand every checklist item into a section.
- Make the prompt standalone so it remains usable outside the current conversation.
- For coding tasks, include scope, project conventions, verification, and behavior-based completion criteria when known.
Output Rules
If essential information is missing, output only the clarification request.
When information is sufficient:
- Output exactly one complete prompt in a fenced code block.
- Use a fence that does not conflict with fenced content inside the prompt.
- Do not add a preface, analysis, explanation, change log, alternative version, placeholder, or usage note unless the user explicitly requests it.