prompt-optimize

当用户已有可评分的系统提示,并希望自动优化该提示以提升其在该评估命令下的得分时使用。每次迭代仅针对一个质量维度(清晰度、上下文、具体性、结构、示例、分解、约束条件)定向改进,重新运行用户的评估命令以测量指标;仅在指标提升时保留修改,否则回滚。循环执行直至达到目标、性能平台期或预算耗尽。指标由用户的评估命令输出决定;该方法不修改评估命令本身,也不适用于从零编写提示或调整模型权重/超参数,或无评分的手动一次性修改。

仓库最近推送
GitHub Stars
185
Forks
21
Issues / PRs
1

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "prompt-optimize":https://skillpi.com/zh/skills/deepskill-d4da190e0ff0592b668476e2e736958c81a854db16644d09c101107ff481512f。安装前核对上游来源和版本:https://github.com/gaasher/Agent-Loop-Skills。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

github.com

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

当用户已有可评分的系统提示,并希望自动优化该提示以提升其在该评估命令下的得分时使用。每次迭代仅针对一个质量维度(清晰度、上下文、具体性、结构、示例、分解、约束条件)定向改进,重新运行用户的评估命令以测量指标;仅在指标提升时保留修改,否则回滚。循环执行直至达到目标、性能平台期或预算耗尽。指标由用户的评估命令输出决定;该方法不修改评估命令本身,也不适用于从零编写提示或调整模型权重/超参数,或无评分的手动一次性修改。

0 下载

介绍来源: third_party · gaasher · 0.1.0 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
适合谁
翻译待完成,请参阅来源文档。
软件、账号及付费要求
翻译待完成,请参阅来源文档。
限制与区别
翻译待完成,请参阅来源文档。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: prompt-optimize
description: >
  Use when the user has a prompt that feeds a system they can already score, and wants that prompt
  automatically improved to raise the score against their own evaluation command. Makes one targeted
  quality edit per iteration — clarity, context, specificity, structure, examples, decomposition,
  guardrails — re-runs the user's eval to measure the metric, and keeps the edit only if the metric
  improves, else reverts; loops to a target, plateau, or budget. The metric is whatever the user's
  eval command prints (task accuracy, an LLM-judge score, a pass rate, a tool-call success rate); the
  loop is metric-agnostic and never edits the eval. Not for writing a prompt from scratch, not for
  tuning model weights or hyperparameters, and not for one-off manual prompt edits without a score.
metadata:
  version: "0.1.0"

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 —

Eval output convention. <eval_cmd> must print, on its last line, either a JSON object {"score": <number>, "feedback": "<optional notes/errors>", ...any extra metrics...} or a bare number. Higher is better unless <objective> is minimize. The feedback field, when present, is the richest signal — read it like AlphaEvolve's artifacts side-channel to decide the next edit.

Eval runs in the user's environment. <eval_cmd> may call an inference endpoint or any tooling the user has installed; the loop just shells out and reads the last line. If instead the prompt is executed by you (interactive development with no separate endpoint), first run the current prompt over the user's eval inputs to produce outputs, write them where <eval_cmd> reads, then run <eval_cmd> to score them.

The loop

Copy this checklist and tick items off:

  • [ ] Iteration 0 — baseline: run <eval_cmd> on <prompt_file>, record its score as the current best, snapshot the prompt.
  • [ ] Diagnose the prompt's single biggest weakness from the latest score, the eval feedback, and the history.
  • [ ] Apply one targeted edit (one operator from the toolkit) to <prompt_file>.
  • [ ] Measure: re-run <eval_cmd> and read the new score from its last line.
  • [ ] Keep if the metric improves (require a margin if the eval is stochastic), else revert to the best snapshot.
  • [ ] Append a ledger row; if stuck, branch from an earlier high-scoring variant; stop on <target>, plateau (<patience>), or <budget>.

Iteration 0 — baseline. Run <eval_cmd>, record its score as the best, snapshot <prompt_file> to <sandbox_root>/iter0/, and start the history ({iter, edit, score, feedback} per row).

Then, until stop (target, plateau, or budget):

  1. Diagnose. From the latest score, the <eval_cmd> feedback, and recent history, name the prompt's single biggest current weakness — the one thing most likely holding the metric back.

  2. Make one targeted edit — pick the toolkit operator that addresses that weakness:

    • Clarity — remove ambiguity, contradictions, and vague wording.
    • Context — supply missing domain knowledge, definitions, or background the task needs.
    • Specificity — make instructions concrete; pin down the output format; define what "good" is.
    • Structure — order the prompt into steps/sections; add a short checklist.
    • Examples — add one or two demonstrations of the desired input → output.
    • Decomposition — split a complex instruction into explicit ordered sub-steps.
    • Guardrails — state edge cases and what to avoid.

    One change per iteration, so its effect on the metric is attributable.

  3. Measure. Snapshot the edited prompt to <sandbox_root>/iter<N>/, run <eval_cmd>, and read the new score off the last line.

  4. Keep or revert. Keep if the metric improves per <objective> (if the eval is stochastic, require a small margin so noise alone does not drive a keep); otherwise revert <prompt_file> to the previous best snapshot. Append {edit, score, feedback} to the history either way.

  5. Escape local optima. If the score has not improved for a couple of iterations, stop making tiny tweaks — branch from an earlier high-scoring snapshot, or try a bolder restructuring (a different decomposition, a fresh set of examples). Diversity beats grinding the same local hill.

When stopping, restore the best prompt to <prompt_file> and report the score trajectory, which edits moved the metric (and which did not), and the final prompt.

Ledger

<sandbox_root>/ledger.tsv, tab-separated, never commas in the text. Header:

iter    score   status  edit

status ∈ {baseline, keep, revert}. Example (metric = task accuracy, maximize):

iter    score   status  edit
0   0.42    baseline    original prompt
1   0.61    keep    specificity: define each output label and the exact output format
2   0.61    revert  examples: add 3 few-shot demos — no metric gain
3   0.78    keep    context: add the domain rules the task assumes but never states

Report the best iteration, not necessarily the last.

Constraints

  • The metric is the user's. Never edit <eval_cmd>, its data, or its scoring — that games the number instead of improving the prompt, and the eval is the only ground truth the loop has.
  • Optimize the prompt only, and preserve the task's intent. Improve how the task is instructed, not what is being asked; do not tailor the prompt to exploit eval quirks that would break real use.
  • One edit per iteration, and compare the metric by re-running the full <eval_cmd>, not a single sample, so each score delta is attributable to that one edit.
  • Report the best variant, not the last. The sandbox is self-contained — no ../ escapes.
  • Do not pause the loop to ask whether to continue; run until target, plateau, or budget.

Stops

  • Target — the score reaches <target> (if set).
  • Plateau — no iteration improved the best for <patience> consecutive rounds (every non-improving iteration counts toward patience; a keep resets it).
  • Budget — <budget> iterations reached.

当前收录版本

0.1.0

核对来源版本 ↗

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值88/100

亮点

  • 解决提示词工程中“调优难、效果不可测”的核心痛点
  • 提供闭环反馈驱动的自动化迭代优化机制
  • 适用于提示词开发者、AI应用构建者等高频刚需场景
触发精准92/100

亮点

  • 触发条件清晰:已有可评分提示词 + 希望自动优化
  • 明确排除不适用场景(从零编写、调参、无评分修改)
  • 边界定义严谨,无歧义或重叠风险
结构规范90/100

待提升项

  • description写错位置 原报告严重程度:轻微

    顶层 description 字段为空,实质描述内容位于 skill_body 内部的 frontmatter 中

    改进建议:将 description 内容移至顶层 description 字段,保持与 frontmatter 一致

亮点

  • 结构完整:涵盖使用场景、配置、流程、约束、停止条件等关键章节
  • 流程清晰:迭代步骤分步说明,含诊断→编辑→测量→决策闭环
  • 示例充分:提供 ledger.tsv 示例和 binding 配置说明
执行可靠91/100

亮点

  • 依赖明确:仅依赖用户提供的 eval_cmd 和 prompt_file,无隐式外部依赖
  • 异常处理健全:覆盖 plateau、budget、噪声、局部最优等场景
  • 回滚机制可靠:仅当 metric 提升时保留修改,否则自动 revert
  • 配置确认机制:setup 阶段交互式确认 loop.run.yaml 参数
证据可验 (前四项均值)90/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

翻译待完成,请参阅来源文档。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。