/optimize-prompt - Optimize AI Prompt
Rewrite and optimize an AI prompt for better performance and reliability.
Steps
- Read the original prompt and understand its intended purpose
- Identify the target model and use case (chat, completion, function calling)
- Restructure the prompt with clear sections: role, context, task, constraints, format
- Rewrite ambiguous instructions with specific, measurable language
- Add or improve output format specification with examples
- Include edge case handling instructions
- Add few-shot examples if the task benefits from them
- Implement chain-of-thought reasoning for complex tasks
- Add guardrails: what the model should not do, how to handle uncertainty
- Optimize token usage: remove redundant words, consolidate instructions
- A/B test the original vs optimized prompt with sample inputs
- Present the optimized prompt with annotations explaining each change
Rules
- Preserve the original intent; do not change what the prompt is trying to achieve
- Use imperative language for instructions (do X, not "you should X")
- Place the most important instructions at the beginning and end of the prompt
- Use XML tags or markdown headers to separate prompt sections
- Include a fallback instruction for when the model cannot complete the task
- Test with adversarial inputs to verify robustness
- Keep the optimized prompt as concise as possible while maintaining effectiveness