prompt-optimize

prompt-optimize is a skill for Claude Code, Codex from gaasher/Agent-Loop-Skills. It costs 166 tokens per session (1,985 once invoked), scanned A, original, MIT.

An iterative method for improving an existing prompt by testing one focused change at a time against a score produced by your own evaluation command.

In plain words
What is it for?
Use it to refine prompts for a system you can already run and score, such as by improving clarity, context, structure, examples, or safeguards.
Why use it?
It shows whether a prompt edit actually improves the system's measured results and keeps only changes that help.

Skill for Claude CodeCodex

Part of the Agent-Loop-Skills plugin — 25 skills shipped together

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.

agentmods
npx agentmods add skills/gaasher/agent-loop-skills/prompt-optimize
Any agent
npx skills add gaasher/Agent-Loop-Skills --skill prompt-optimize
Clone the repo
git clone --depth 1 https://github.com/gaasher/Agent-Loop-Skills

Made for: Claude Code, Codex.

Or install Agent-Loop-Skills, the plugin that ships this one along with the rest of its 25 skills.

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/skills/gaasher/agent-loop-skills/prompt-optimize.svg)](https://agentmods.dev/skills/gaasher/agent-loop-skills/prompt-optimize)
Your own site
<a href="https://agentmods.dev/skills/gaasher/agent-loop-skills/prompt-optimize"><img src="https://agentmods.dev/badge/skills/gaasher/agent-loop-skills/prompt-optimize.svg" alt="Measured on agentmods" height="20"></a>
Per session 166 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,985 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found 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 $0.00166 $0.01985
Opus 5 $0.00083 $0.00992
Sonnet 5 $0.00033 $0.00397
Haiku 4.5 $0.00017 $0.00198

Measured 4d ago against content hash c2c9cd2d904e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

prompt-optimize scanned grade A with 0 findings 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 4d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

loops/prompt-optimize/SKILL.md · 132 lines

How it starts

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

Prompt Optimize Loop

An evolutionary optimizer for a prompt (OpenEvolve / AlphaEvolve-style). The artifact is a prompt that feeds the user's system; the feedback signal is a scalar metric printed by the user's own evaluation command. Each iteration proposes one quality-focused edit, re-runs the eval, and keeps the edit only if the metric improves — evolving the prompt toward higher scores. The eval is a black-box oracle the loop runs but never edits, so the optimization tracks what actually matters rather than gaming a number.

When to use

Use this when the user has a prompt and a command that scores the system using it, and wants the prompt improved to raise that score. Default to diagnosing the prompt's biggest current weakness each round and applying the one operator that addresses it; if the eval feedback points elsewhere, follow the feedback. Not for authoring a prompt from nothing, tuning weights/hyperparameters, or making a single manual edit with no score to compare against.

Setup

Resolve bindings interactively. If loop.run.yaml exists in the working dir, load it, confirm the values in one line, and skip to the loop. Otherwise: on Claude Code (the AskUserQuestion tool is available) infer a likely value for each binding and present it as the recommended option; on other hosts ask each as a quoted plain-text prompt. Then write loop.run.yaml (format: examples/run.example.yaml) and confirm the values before creating any other files.

binding meaning default how to infer
<prompt_file> the prompt to optimize — the artifact the loop evolves scan the working dir for the prompt/template file the eval reads
<eval_cmd> required. Command that scores the current <prompt_file>; prints the metric (see output convention below). Treated as a black box — never edited ask the user; look for eval/score/bench scripts
<objective> maximize or minimize, plus one line on what the metric measures maximize ask the user
<target> optional score at which to stop early ask the user; else leave unbound
<sandbox_root> where prompt snapshots + ledger live ./sandbox
<budget> max iterations 10
<patience> stop after N consecutive non-improving iterations (plateau) 3

Read the full file on GitHub · 132 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 4d ago First seen · 132 lines · 166 tokens per session scan A c2c9cd2d904e

Subscribe to this mod's changes

prompt-optimize is a skill published in the GitHub repository gaasher/Agent-Loop-Skills (163 stars, last pushed 2mo ago), licensed MIT. It adds 166 tokens to every session and 1,985 once invoked, about $0.0008 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

enhance-prompt

Transforms vague UI ideas into polished, Stitch-optimized prompts. Enhances specificity, adds UI/UX keywords, injects design system context, and structures output for better generation results.

google-labs-code/stitch-skills · 41 tokens

prompt-optimization

Improve a prompt on the evaluations workbench through a measured loop. Score the baseline first, then duplicate the target column, form a hypothesis from failing rows, edit the copy's prompt draft, run, compare pass rate and cost, and repeat until the numbers hold. Use when the user asks to optimize or improve a…

langwatch/langwatch · 105 tokens

prompt-engineer

Writes, refactors, and evaluates prompts for LLMs — generating optimized prompt templates, structured output schemas, evaluation rubrics, and test suites. Use when designing prompts for new LLM applications, refactoring existing prompts for better accuracy or token efficiency, implementing chain-of-thought or few-shot…

Jeffallan/claude-skills · 93 tokens

trend-analysis

基于多维度数据进行分级评估与趋势预测,通过设定差异化增长率计算预测值,并生成对比可视化图表,适用于绩效评估、目标设定等场景。.

OpenSenseNova/SenseNova-Skills · 52 tokens

large-file-parquet-analysis-and-highlight

当Excel文件总行数超过1万行时,通过转换为Parquet格式提升读取性能,提取目标指标并计算最大值,最后将结果输出为Excel并对特定行进行高亮标注。.

OpenSenseNova/SenseNova-Skills · 55 tokens

excel-basic-statistics-and-routing

Skill "excel-basic-statistics-and-routing" from OpenSenseNova/SenseNova-Skills, covering skill steps, 保存区间提取与汇总结果 and 保存筛选与统计结果.

OpenSenseNova/SenseNova-Skills · 46 tokens