home / skills / jeremylongshore / claude-code-plugins-plus-skills / ai-ml-engineering-pack

This skill optimizes prompts for LLMs to reduce token usage, lower costs, and improve response speed while preserving quality.

npx playbooks add skill jeremylongshore/claude-code-plugins-plus-skills --skill ai-ml-engineering-pack

Review the files below or copy the command above to add this skill to your agents.

Files (4)
SKILL.md
3.2 KB
---
name: optimizing-prompts
description: |
  This skill optimizes prompts for Large Language Models (LLMs) to reduce token usage, lower costs, and improve performance. It analyzes the prompt, identifies areas for simplification and redundancy removal, and rewrites the prompt to be more concise and effective. It is used when the user wants to reduce LLM costs, improve response speed, or enhance the quality of LLM outputs by optimizing the prompt. Trigger terms include "optimize prompt", "reduce LLM cost", "improve prompt performance", "rewrite prompt", "prompt optimization".
---

## Overview

This skill empowers Claude to refine prompts for optimal LLM performance. It streamlines prompts to minimize token count, thereby reducing costs and enhancing response speed, all while maintaining or improving output quality.

## How It Works

1. **Analyzing Prompt**: The skill analyzes the input prompt to identify areas of redundancy, verbosity, and potential for simplification.
2. **Rewriting Prompt**: It rewrites the prompt using techniques like concise language, targeted instructions, and efficient phrasing.
3. **Suggesting Alternatives**: The skill provides the optimized prompt along with an explanation of the changes made and their expected impact.

## When to Use This Skill

This skill activates when you need to:
- Reduce the cost of using an LLM.
- Improve the speed of LLM responses.
- Enhance the quality or clarity of LLM outputs by refining the prompt.

## Examples

### Example 1: Reducing LLM Costs

User request: "Optimize this prompt for cost and quality: 'I would like you to create a detailed product description for a new ergonomic office chair, highlighting its features, benefits, and target audience, and also include information about its warranty and return policy.'"

The skill will:
1. Analyze the prompt for redundancies and areas for simplification.
2. Rewrite the prompt to be more concise: "Create a product description for an ergonomic office chair. Include features, benefits, target audience, warranty, and return policy."
3. Provide the optimized prompt and explain the token reduction achieved.

### Example 2: Improving Prompt Performance

User request: "Optimize this prompt for better summarization: 'Please read the following document and provide a comprehensive summary of all the key points, main arguments, supporting evidence, and overall conclusion, ensuring that the summary is accurate, concise, and easy to understand.'"

The skill will:
1. Identify areas for improvement in the prompt's clarity and focus.
2. Rewrite the prompt to be more direct: "Summarize this document, including key points, arguments, evidence, and the conclusion."
3. Present the optimized prompt and explain how it enhances summarization performance.

## Best Practices

- **Clarity**: Ensure the original prompt is clear and well-defined before optimization.
- **Context**: Provide sufficient context to the skill so it can understand the prompt's purpose.
- **Iteration**: Iterate on the optimized prompt based on the LLM's output to fine-tune performance.

## Integration

This skill integrates with the `prompt-architect` agent to leverage advanced prompt engineering techniques. It can also be used in conjunction with the `llm-integration-expert` to optimize prompts for specific LLM APIs.

Overview

This skill optimizes prompts for Large Language Models to reduce token usage, lower costs, and improve output performance. It streamlines language, removes redundancy, and preserves the original intent to maintain or enhance result quality. The goal is faster responses and more cost-efficient LLM calls without degrading accuracy.

How this skill works

The skill inspects the input prompt to locate verbosity, repeated instructions, and vague phrasing. It rewrites the prompt using concise wording, targeted instructions, and prioritized requirements. It returns the optimized prompt plus a short rationale and expected token or cost reduction estimate.

When to use it

  • When you want to reduce LLM API costs by cutting token consumption.
  • When responses are slow and you need faster turnaround from the LLM.
  • When outputs are unfocused or inconsistent and need clearer instructions.
  • Before scaling batch requests that multiply prompt costs.
  • When adapting prompts for a different LLM or tighter token limits.

Best practices

  • Provide the full original prompt and a brief description of the intended output or audience.
  • Highlight non-negotiable elements (must-haves) so the rewrite keeps them intact.
  • Test the optimized prompt and iterate—small tweaks can change model behavior.
  • Specify desired format or length constraints to guide concise phrasing.
  • Use the provided rationale to understand trade-offs between brevity and detail.

Example use cases

  • Compressing product description prompts to lower per-call cost while keeping key fields.
  • Converting verbose summarization instructions into precise, efficient summarization prompts.
  • Standardizing prompts for customer support templates to ensure consistent LLM replies.
  • Preparing prompts for large-scale batch jobs where token savings compound.
  • Adapting prompts to fit stricter token limits on mobile or edge deployments.

FAQ

Will optimizing a prompt change the output content?

Optimizations aim to preserve intent and required elements; however, wording changes can shift tone or emphasis, so test the optimized prompt and iterate if needed.

How much cost savings can I expect?

Savings vary by prompt and usage volume; concise rewrites typically reduce tokens by 10–40%, with larger savings when removing long redundant context across many requests.