prompt-optimize

prompt-optimize is a command for Claude Code from EngineerWithAI/engineerwith-agents. It costs 0 tokens per session (3,143 once invoked), scanned B, a copy of prompt-optimize, MIT.

A prompt-writing guide for improving the instructions given to language models.

In plain words
What is it for?
Use it to review prompts, add examples and reasoning structure, handle failures, and adapt prompts to particular models or tasks.
Why use it?
It helps make model responses more accurate, consistent, safer, and less wasteful of tokens by addressing unclear instructions and edge cases.

Command for Claude Code

Written for Claude Code: $ARGUMENTS substitution.

Good fit Use it to review prompts, add examples and reasoning structure, handle failures, and adapt prompts to particular models or tasks.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/engineerwithai/engineerwith-agents/prompt-optimize
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/EngineerWithAI/engineerwith-agents

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for prompt-optimize

README.md
[![agentmods](https://agentmods.dev/badge/commands/engineerwithai/engineerwith-agents/prompt-optimize/github.svg)](https://agentmods.dev/commands/engineerwithai/engineerwith-agents/prompt-optimize)
Your own site
<a href="https://agentmods.dev/commands/engineerwithai/engineerwith-agents/prompt-optimize"><img src="https://agentmods.dev/badge/commands/engineerwithai/engineerwith-agents/prompt-optimize/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for prompt-optimize

Your own site · 80×15
<a href="https://agentmods.dev/commands/engineerwithai/engineerwith-agents/prompt-optimize"><img src="https://agentmods.dev/badge/commands/engineerwithai/engineerwith-agents/prompt-optimize.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,143 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.03143
Opus 5.5 $0.00000 $0.01257
Sonnet 5.5 $0.00000 $0.00629
Haiku 4.5 $0.00000 $0.00314

Measured 1mo ago against content hash b8620d529ed8, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade B, and why

prompt-optimize scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Strips warnings and disclaimersmediumAnti-refusal

Omitting safety caveats hides risk from the user and is a common jailbreak preamble.

- No speculation without disclaimers
Origin

This is a copy

100% identical to prompt-optimize — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

plugins/llm-application-dev/commands/prompt-optimize.md · 588 lines

How it starts

The opening of the file, as written. The whole thing — 588 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Prompt Optimization

You are an expert prompt engineer specializing in crafting effective prompts for LLMs through advanced techniques including constitutional AI, chain-of-thought reasoning, and model-specific optimization.

Context

Transform basic instructions into production-ready prompts. Effective prompt engineering can improve accuracy by 40%, reduce hallucinations by 30%, and cut costs by 50-80% through token optimization.

Requirements

$ARGUMENTS

Instructions

1. Analyze Current Prompt

Evaluate the prompt across key dimensions:

Assessment Framework

  • Clarity score (1-10) and ambiguity points
  • Structure: logical flow and section boundaries
  • Model alignment: capability utilization and token efficiency
  • Performance: success rate, failure modes, edge case handling

Decomposition

  • Core objective and constraints
  • Output format requirements
  • Explicit vs implicit expectations
  • Context dependencies and variable elements

2. Apply Chain-of-Thought Enhancement

Standard CoT Pattern

# Before: Simple instruction
prompt = "Analyze this customer feedback and determine sentiment"

# After: CoT enhanced
prompt = """Analyze this customer feedback step by step:

1. Identify key phrases indicating emotion
2. Categorize each phrase (positive/negative/neutral)
3. Consider context and intensity
4. Weigh overall balance
5. Determine dominant sentiment and confidence

Customer feedback: {feedback}

Step 1 - Key emotional phrases:
[Analysis...]"""

Zero-Shot CoT

enhanced = original + "\n\nLet's approach this step-by-step, breaking down the problem into smaller components and reasoning through each carefully."

Tree-of-Thoughts

tot_prompt = """
Explore multiple solution paths:

Problem: {problem}

Approach A: [Path 1]
Approach B: [Path 2]
Approach C: [Path 3]

Evaluate each (feasibility, completeness, efficiency: 1-10)
Select best approach and implement.
"""

3. Implement Few-Shot Learning

Read the full file on GitHub · 588 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 588 lines · 0 tokens per session scan B b8620d529ed8

Subscribe to this mod's changes

prompt-optimize is a command published in the GitHub repository EngineerWithAI/engineerwith-agents (4 stars, last pushed 9mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 3,143 tokens. A static security scan graded it B with 1 finding (strips warnings and disclaimers). It is 100% identical to prompt-optimize, differing in 0 lines, and is treated as a copy.