Skip to content

Samuel-Shek/prompt-optimizer-skill

Repository files navigation

Prompt Optimizer | 提示词优化器

把你随手写的一句话、一段粗糙需求、一份混杂的 system prompt,改写成可直接复制给任意 AI 使用的终版提示词。

Turn a rough idea, messy prompt, or tangled system prompt into a polished, ready-to-paste AI instruction.


🇨🇳 中文

它是什么

一个单用途 Skill:只优化提示词,不执行任务本身。

你发给它的每一条消息都会被当作"原材料",输出一段结构清晰、约束明确的终版提示词。

适合:

  • 优化一段已有 prompt
  • 把口语化需求变成专业 AI 指令
  • 重写 system prompt / agent 指令
  • 按 Claude / GPT / Gemini / DeepSeek / 开源模型适配格式

示例

你输入:

优化提示词:帮我做一份竞品分析

它输出:

一段包含分析维度、输出结构、约束条件和占位符的完整提示词——拿到就能直接复制给任意 AI 使用。

👉 完整 before → after 示例见 docs/examples.zh-CN.md

新手入口

三种使用方式

1. 手动模式(Manual Mode)

你主动调用,它才工作。最简单、最稳。

平台 怎么用
Claude Code(CLI + 桌面端) 输入 /prompt-optimizer,然后贴入原始内容。桌面端也可以点 + → 「Slash commands」选择。安装一次,CLI 和桌面端都能用。
Codex 安装或更新后,先重启 Codex 或至少新开一个会话,让宿主重新发现 skills。之后最顺手的方式是输入 $prompt-optimizer,然后直接贴原始内容;也可以直接发“优化提示词:...”这类触发写法,让宿主按 skill 描述自动匹配。
OpenClaw 进入 prompt-optimizer 专用工作区,贴入原始内容

提醒:Codex 没有 Claude 那种 slash command 入口,但它可以在新会话里重新发现已安装的 skill。已经打开的旧会话通常不会热更新。

安装:

bash scripts/install-local.sh claude                       # Claude Code(CLI + 桌面端)
bash scripts/install-local.sh codex                        # Codex
bash scripts/install-local.sh openclaw --mode skill-only   # OpenClaw
bash scripts/install-local.sh all                          # 全部装

2. 自动模式(Auto Mode)

在普通聊天里发触发词,自动拦截处理。仅限 OpenClaw。

你在任意普通 Agent 会话里发:

优化提示词:帮我做一份竞品分析

宿主会自动拦截这轮对话,转给提示词优化器处理,把结果写回原会话。下一轮对话自动回到普通模式。

4 种推荐触发写法:

优化提示词:<你的原始内容>
帮我优化:<你的原始内容>
<你的原始内容>——优化提示词
<你的原始内容>——帮我优化

安装:

bash scripts/install-local.sh openclaw --mode host-router

注意:

  • 默认只挂到 main agent,不会劫持其他 agent
  • 使用 xhigh 思考强度,质量优先,等待时间较长
  • 等待期间会显示 1-2 条简短进度提示

3. 复制粘贴模式(Copy-Paste Mode)

导出纯文本 prompt,粘贴到任何 AI 平台。

bash scripts/print-prompt.sh

把输出的纯文本复制到 ChatGPT、Gemini、DeepSeek、Poe 或任何其他平台的 system prompt 里即可使用。

手动模式 vs 自动模式怎么选?

手动模式 自动模式 复制粘贴模式
适合 Claude Code / Codex 用户 OpenClaw 聊天面板 / 飞书 / Telegram ChatGPT / 其他平台
触发方式 Claude 用 /prompt-optimizer;Codex 用 $prompt-optimizer 或自然触发 在普通聊天发触发词 手动粘贴 prompt 正文
配置复杂度 最低 多一层插件配置 零配置
推荐 Claude Code 用户首选 重度 OpenClaw 用户首选 不支持 skill 的平台

回归测试

node scripts/test-trigger-detection.mjs      # 触发词识别测试
node scripts/test-host-router-e2e.mjs         # 自动模式端到端测试(需本地 OpenClaw Gateway)

文件说明

文件 说明
SKILL.md 唯一权威源文件(编辑入口)
AGENTS.md / CLAUDE.md SKILL.md 的别名
scripts/install-local.sh 一键安装
scripts/print-prompt.sh 导出纯文本 prompt
integrations/prompt-optimizer-router/ 自动模式插件源码
docs/3-minute-quickstart.zh-CN.md 3 分钟上手
docs/get-started.zh-CN.md 新手总导航
docs/examples.zh-CN.md 完整示例
docs/cli-quickstart.zh-CN.md 最快 CLI 安装与使用
docs/feishu-private-bot.zh-CN.md 飞书 / Lark 私聊教程
docs/im-private-bots.zh-CN.md Telegram / Discord 私聊教程
docs/landscape.zh-CN.md 同类项目对比
docs/platforms.zh-CN.md 各平台接入说明
references/model-adaptation.md 模型适配参考

维护

只改 SKILL.mdAGENTS.mdCLAUDE.md 会自动保持一致。


🇬🇧 English

What is it

A single-purpose skill: it only optimizes prompts — it never executes the task itself.

Every message you send is treated as raw material. The output is a structured, ready-to-paste final prompt.

Good for:

  • Improving an existing prompt
  • Turning a rough idea into a professional AI instruction
  • Rewriting system prompts and agent instructions
  • Adapting prompt format for Claude, GPT, Gemini, DeepSeek, and open-source models

Example

You type:

optimize prompt: write a competitive analysis report

It outputs:

A complete prompt with analysis dimensions, output structure, constraints, and placeholders — ready to paste into any AI.

👉 Full before → after examples: docs/examples.zh-CN.md

Quick links

Three ways to use it

1. Manual Mode

You invoke it explicitly. Simplest and most stable.

Platform How
Claude Code (CLI + Desktop) Type /prompt-optimizer, then paste your content. In the desktop app, you can also click + → "Slash commands". Install once, works in both CLI and desktop.
Codex After installing or updating the skill, restart Codex or at least start a fresh session so the host can rediscover skills. The smoothest path is to type $prompt-optimizer and paste the raw content directly. You can also send trigger phrases like optimize prompt: ... and let the host match the skill description automatically.
OpenClaw Enter the prompt-optimizer workspace, then paste

Note: Codex does not use Claude-style slash commands, but it can rediscover installed skills in a fresh session. Already-open sessions usually do not hot-reload new or updated skills.

Install:

bash scripts/install-local.sh claude
bash scripts/install-local.sh codex
bash scripts/install-local.sh openclaw --mode skill-only
bash scripts/install-local.sh all

2. Auto Mode

Use trigger phrases in normal chat — it intercepts automatically. OpenClaw only.

In any ordinary agent chat, type:

优化提示词:write a competitive analysis report
帮我优化:write a competitive analysis report

The host intercepts the turn, routes it to the optimizer specialist, injects the result back, and resumes normal chat on the next turn.

Install:

bash scripts/install-local.sh openclaw --mode host-router

3. Copy-Paste Mode

Export the raw prompt text and paste it into any AI platform.

bash scripts/print-prompt.sh

Copy the output into ChatGPT, Gemini, DeepSeek, Poe, or any other platform's system prompt field.

File reference

File Purpose
SKILL.md Single source of truth (edit here)
AGENTS.md / CLAUDE.md Aliases for SKILL.md
scripts/install-local.sh One-command installer
scripts/print-prompt.sh Export plain prompt body
integrations/prompt-optimizer-router/ Auto Mode plugin source
docs/3-minute-quickstart.zh-CN.md 3-minute quickstart
docs/get-started.zh-CN.md Starter guide
docs/examples.zh-CN.md Full examples
docs/cli-quickstart.zh-CN.md Fastest CLI setup
docs/feishu-private-bot.zh-CN.md Feishu / Lark DM setup
docs/im-private-bots.zh-CN.md Telegram / Discord DM setup
docs/landscape.zh-CN.md Comparison with similar projects
references/model-adaptation.md Model adaptation notes

Privacy

This repo contains no chat logs, credentials, or local screenshots. Only shareable skill files, scripts, and docs are published.

License

MIT

About

Turn rough prompts, system prompts, and agent instructions into polished, model-adapted prompts for Claude, GPT, Gemini, DeepSeek, Codex, OpenClaw, and more.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors