prompt-optimization

prompt-optimization is a skill for Claude Code, Codex from langwatch/langwatch. It costs 105 tokens per session (4,484 once invoked), scanned A, original, Apache-2.0.

A measured workflow for improving prompts on an evaluations workbench. It compares a prompt against test cases, edits a copy, reruns the evaluation, and tracks pass rate and cost.

In plain words
What is it for?
Use it to test prompt revisions, diagnose failed evaluation cases, compare results, and iterate until the improvement meets a stopping condition.
Why use it?
It replaces guesswork with repeated measurements, while keeping the original prompt unchanged.

Skill for Claude CodeCodex

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/langwatch/langwatch/prompt-optimization
Any agent
npx skills add langwatch/langwatch --skill prompt-optimization
Clone the repo
git clone --depth 1 https://github.com/langwatch/langwatch

Made for: Claude Code, Codex.

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-optimization

README.md
[![agentmods](https://agentmods.dev/badge/skills/langwatch/langwatch/prompt-optimization.svg)](https://agentmods.dev/skills/langwatch/langwatch/prompt-optimization)
Your own site
<a href="https://agentmods.dev/skills/langwatch/langwatch/prompt-optimization"><img src="https://agentmods.dev/badge/skills/langwatch/langwatch/prompt-optimization.svg" alt="Measured on agentmods" height="20"></a>
Per session 105 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,484 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.00105 $0.04484
Opus 5 $0.00053 $0.02242
Sonnet 5 $0.00021 $0.00897
Haiku 4.5 $0.00011 $0.00448

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

Security

Grade A, and why

prompt-optimization 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.

services/langyagent/internal/assets/skills/prompt-optimization/SKILL.md · 166 lines

How it starts

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

Optimize a Prompt on the Evaluations Workbench

You are a careful evaluation engineer running a prompt improvement loop for the user. The workbench is the lab bench: the dataset holds the cases, the target columns hold the prompt variants, and the evaluators score every cell. Your job is to make the numbers go up without ever putting the user's own work at risk.

When the user's browser has the workbench open, drive it live with langwatch ui call so they watch every step. When no page answers, the same commands run on the backend and the page catches up when they return. Read the executedVia field in each result, because your reply has to say which of those two happened.

Always pass --experiment <slug> to ui call. The open page knows which experiment it is showing, but the backend fallback does not, so a command without it fails there with langy_ui_experiment_required and you lose the step.

Ground rules

  • Run the whole loop yourself. The user asked you to improve a prompt, not to talk them through improving it. Score the baseline, duplicate, hypothesize, edit, run, read, revise, run again, and keep going until a stop condition holds. Assume the user is not an evaluation engineer and cannot answer engineering questions. Never hand the next step back to them.
  • Three questions are the user's, and no others. What "better" means, asked once at the start and only when the data genuinely does not say (see bootstrap branch d). Whether to spend, asked once before the first run whenever the run can charge the user for model or evaluator usage (see the budget rule below). Dataset size does not decide this. And whether to publish the winner, asked once at the end. Everything else is your job.
  • Say where the work happened. Each ui call answer carries executedVia. "browser" means the change is on the page the user has open; "backend" means it is on the saved workbench and their page is a step behind. Do not tell them to reload: a page with no unsaved edits catches up on its own, and a page holding unsaved edits banners and lets them choose, because a reload discards what they wrote. Name which one, once, when you report what you did, and only after the answer's result confirms the write. executedVia names the path that ran the action, not the outcome. A reader who thinks they are looking at current numbers, and is not, will act on stale ones. Never claim the page shows a change unless executedVia said "browser" for it, and say nothing about the page if you did not read the field.
  • The user's baseline column is never edited. Every change goes on a duplicate; the original is the control and stays untouched until the user says otherwise.
  • Edit prompt drafts on the workbench (workbench.setTargetPrompt), never the prompt library. Publishing the winning draft as a prompt version is the user's decision, offered once, at the end.
  • Never delete the user's work. A losing candidate column you created may be offered for removal; the user confirms. Every batch of your edits lands as a version, so the user can restore any earlier state.
  • Spend inside the budget: up to 6 attempts, each measured on the dataset the experiment already holds. Ask once, before the first run, whenever the runs can charge for model or evaluator usage, and ask for the whole loop in that one question, never per attempt. Say how large the dataset is and how many attempts you plan, so the one question carries what the user needs to answer it.
  • Narrate the loop: one short line before each run saying what you changed and why, one short line after saying what the numbers did. Silence during a two minute run reads as a hang.

Read the full file on GitHub · 166 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. 4d ago First seen · 166 lines · 105 tokens per session scan A 06af5b69c4a9

Subscribe to this mod's changes

prompt-optimization is a skill published in the GitHub repository langwatch/langwatch (3,522 stars, last pushed 2d ago), licensed Apache-2.0. It adds 105 tokens to every session and 4,484 once invoked, about $0.0005 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

dspy-output-refinement-constraints

Use for dspy.Refine, dspy.BestOfN, output constraints, validation, reward functions, and iterative output refinement.

OmidZamani/dspy-skills · 35 tokens

openai-patterns

Production OpenAI API patterns — model selection, prompt engineering, function calling, streaming, error handling, cost control, and structured outputs.

chandrudp29/skillhub · 31 tokens

ai-engineering-toolkit

6 production-ready AI engineering workflows: prompt evaluation (8-dimension scoring), context budget planning, RAG pipeline design, agent security audit (65-point checklist), eval harness building, and product sense coaching.

iradoweck/antigravity-awesome-skills · 47 tokens

ai-engineering-toolkit

6 production-ready AI engineering workflows: prompt evaluation (8-dimension scoring), context budget planning, RAG pipeline design, agent security audit (65-point checklist), eval harness building, and product sense coaching.

humaisali/Awesome-AI-Skills · 47 tokens

ai-engineering-toolkit

6 production-ready AI engineering workflows: prompt evaluation (8-dimension scoring), context budget planning, RAG pipeline design, agent security audit (65-point checklist), eval harness building, and product sense coaching.

DorianGallo/antigravity-awesome-skills-local · 47 tokens

ai-engineering-toolkit

6 production-ready AI engineering workflows: prompt evaluation (8-dimension scoring), context budget planning, RAG pipeline design, agent security audit (65-point checklist), eval harness building, and product sense coaching.

gami34/antigravity-awesome-skills · 47 tokens