agentleFS
kiko197kiko197/ai-agent-skills/prompt-optimizer/SKILL.md

prompt-optimizer

Skill0 starsChanged 3 months agoMITView on GitHub

系统化诊断、改写并优化已有 LLM 提示词。当现有 prompt 效果不佳、输出不稳定、想提升准确率/成本效率、或需要对不同版本做 A/B 对比时使用。

72 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use agent-architecture-audit, continuous-agent-loop and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • ronmkrSkill

    agent-architecture-audit

    Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature.

    Also in 3 projects that use this

  • junimnjwSkill

    continuous-agent-loop

    Patterns for continuous autonomous agent loops with quality gates, evals, and recovery controls.

    Also in 3 projects that use this

  • junimnjwSkill

    agent-harness-construction

    Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates.

    Also in 3 projects that use this

  • get-proofpilotSkill

    context-budget

    Audits Claude Code context window consumption across agents, skills, MCP servers, and rules. Identifies bloat, redundant components, and produces prioritized token-savings recommendations.

    Also in 5 projects that use this

  • LangChainSkill

    docker-patterns

    Best practices for Docker containerization and multi-stage builds

    Also in 4 projects that use this

  • royaluniondesign-sysSkill

    deployment-patterns

    Deployment workflows, CI/CD pipeline patterns, Docker containerization, health checks, rollback strategies, and production readiness checklists for web applications.

    Also in 3 projects that use this

The file

Files
SKILL.md

提示词优化

把"感觉不对就改两句"变成有依据的诊断→改进→验证循环。

使用步骤

1. 诊断现状(先找病根,别急着改)

用一批固定的测试输入跑现有 prompt,记录当前表现:

  • 哪里出错:理解偏、格式不符、信息遗漏、编造/幻觉、过度冗长?
  • 是"指令不清"还是"缺少示例"还是"输入没隔离"?
  • 设一个基线(当前的准确/通过率),作为对比基准。

2. 从最常见的改进点依次下手(一次只改一个)

  • 加角色 / 明确边界:用专业角色的定位限定行为。
  • 加约束:明确禁止项(不要解释、不要问多余问题、不确定就写"不确定")。
  • 加结构:用分节标题把"任务 / 输入 / 约束 / 格式"分开。
  • 加示例:针对出错最多的那类情况补 few-shot。
  • 拆任务:复杂任务拆成子步骤逐段产出。
  • 降幻觉:要求"仅基于给定资料回答,否则说明未找到"。

3. 改写为干净版本

  • 用词精炼,避免冗余废话稀释信号。
  • 关键指令置前,减少被长上下文稀释的概率。
  • 把"不要"改成清晰的正向指令更好。
  • 保持 prompt 短而足够:减 token 成本、提高稳定。

4. 做 A/B 测试

  • 用同一批测试集跑"旧版 vs 新版",量化对比。
  • 比较指标:准确率、格式合规、长度、通过率;顺带比较 token 消耗。
  • 只保留真正变好的改动;保留可复现的版本与变更记录。

5. 固化与回归

  • 把有效版本存下来(带版本号/日期/用途)。
  • 版本化提示词,必要时纳入 git,便于回退。

输出模板(记录一次优化)

版本号 / 日期:
目标与应用场景:
基线表现(旧版):
诊断到的问题:
所改项(角色/约束/结构/示例/拆分):
新版表现(A/B 对比):
是否采纳:是 / 否(原因)

参考关联

  • 基础写法与模板见 prompt-engineering 技能。
  • 需要系统评估输出质量见 llm-evaluation 技能。

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.