# Optimize Prompt

> Optimize prompts for better AI performance. Use when user says "improve this prompt for better results", "optimize this prompt to reduce tokens", "apply prompt engineering best practices to this", "make this prompt more effective", "help me refine this system prompt", or "tune this prompt for the AI model I'm using".

- Skill: `uniswap/optimize-prompt` (Agent Skill)
- Install (CLI): `npx skillmds@latest add uniswap/optimize-prompt`
- Raw SKILL.md: https://api.skillmd.com/api/skills/uniswap/optimize-prompt/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: uniswap (https://skillmd.com/u/uniswap)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/uniswap/optimize-prompt

---


# Prompt Optimizer

Optimize prompts for better AI model performance using engineering techniques.

## When to Activate

- User wants to improve a prompt
- Token efficiency needed
- Better AI responses desired
- Prompt engineering techniques requested
- Model-specific optimization needed

## Optimization Areas

### 1. Prompt Engineering

- Chain-of-thought reasoning
- Few-shot examples
- Role-based instructions
- Clear delimiters and formatting
- Output format specifications

### 2. Context Optimization

- Minimize token usage
- Hierarchical information structure
- Remove redundancy
- Add relevant context
- Compression techniques

### 3. Performance Testing

- Create prompt variants
- Design evaluation criteria
- Test edge cases
- Measure consistency
- Compare outputs

### 4. Model-Specific Optimization

- Techniques for the target model family, checked against its current API rather than recalled
- Prompt chaining strategies
- Sampling parameter tuning — parameters are provider-specific. `frequency_penalty` and
  `presence_penalty` are OpenAI-only and are rejected by the Anthropic Messages API. On the
  Claude 5 family, `temperature`, `top_p`, and `top_k` are removed entirely — sending any of them
  returns a 400 whether or not thinking is enabled, so never recommend them for a Claude 5 target.
  `budget_tokens` is also rejected (use `thinking: {type: "adaptive"}`).
- Token budget management

### 5. RAG Integration

- Context window management
- Retrieval query optimization
- Chunk size recommendations
- Embedding strategies
- Reranking approaches

### 6. Production Considerations

- Prompt versioning
- A/B testing framework
- Monitoring metrics
- Fallback strategies
- Cost optimization

## Output

Provides:

- Optimized prompt variants
- Explanations for each change
- Evaluation metrics
- Testing strategies
- Quality and cost considerations

