P

Prompt Optimize Command

Analyze and optimize LLM prompts for clarity, consistency, and effectiveness. Restructure system prompts, improve instruction specificity, reduce token usage, and generate A/B test variants for comparing prompt performance.

CommandCommunitydevelopmentv1.0.0MIT
0 views0 copies

Command

/prompt-optimize

Description

Takes an existing LLM prompt (system, user, or tool prompt) and rewrites it for better performance. Analyzes for common anti-patterns, improves structure, reduces ambiguity, and generates optimized variants you can A/B test.

Behavior

  1. Analyze the current prompt for anti-patterns and inefficiencies
  2. Score against a prompt quality rubric
  3. Rewrite with improved structure and clarity
  4. Generate 2-3 variants for testing
  5. Provide evaluation criteria for measuring improvement

Analysis Rubric

CriterionWeightDescription
Clarity25%Unambiguous instructions, no conflicting rules
Specificity20%Concrete examples, not vague directives
Structure20%Logical ordering, clear sections, scannable
Efficiency15%Minimal tokens for maximum effect
Robustness10%Handles edge cases, prevents jailbreaks
Testability10%Success criteria are measurable

Common Anti-Patterns Detected

## Anti-Pattern: Vague Instructions - BAD: "Be helpful and provide good answers" - GOOD: "Answer the user's question in 2-3 sentences. Include a code example if the question is about implementation." ## Anti-Pattern: Contradicting Rules - BAD: "Always respond in JSON" + "For errors, explain in plain text" - GOOD: "Always respond in JSON. For errors: {"error": "description"}" ## Anti-Pattern: Instruction Stuffing - BAD: 30 rules in a flat list - GOOD: Grouped rules under ## sections with priorities ## Anti-Pattern: No Examples - BAD: "Format output appropriately" - GOOD: "Format output as:\n| Name | Value |\n|------|-------|\n| CPU | 45% |" ## Anti-Pattern: Missing Edge Cases - BAD: "Translate the text to Spanish" - GOOD: "Translate to Spanish. If text is already Spanish, return it unchanged. If text contains code blocks, preserve them."

Output Format

## Prompt Analysis ### Current Score: 52/100 | Criterion | Score | Issues | |-----------|-------|--------| | Clarity | 6/10 | 3 ambiguous instructions | | Specificity | 4/10 | No examples provided | | Structure | 5/10 | Flat list, no grouping | | Efficiency | 7/10 | Some redundancy | | Robustness | 4/10 | Missing edge cases | | Testability | 3/10 | No success criteria | ### Optimized Prompt (Score: 87/100) [Rewritten prompt here] ### Variant A: Concise (Score: 82/100) [Shorter variant focusing on efficiency] ### Variant B: Comprehensive (Score: 85/100) [Longer variant with more examples] ### A/B Test Plan - **Metric**: Task completion accuracy on 50 sample inputs - **Duration**: 100 requests per variant - **Evaluation**: Compare output quality scores

Rules

  1. Preserve intent - never change what the prompt is trying to do
  2. Show reasoning - explain why each change improves the prompt
  3. Measure improvements - provide before/after scores
  4. Test-ready variants - outputs should be copy-paste ready
  5. Token awareness - report token count changes

Examples

# Optimize a prompt from a file /prompt-optimize src/prompts/summarizer.txt # Optimize inline prompt /prompt-optimize "You are a helpful coding assistant..." # Optimize with specific focus /prompt-optimize src/prompts/classifier.txt --focus efficiency
Community

Reviews

Write a review

No reviews yet. Be the first to review this template!

Similar Templates