克劳德演说家
一 模型上下文协议(MCP) 用于确定性快速优化的服务器 克劳德代码。7个质量维度上的分数提示,从11个维度中自动选择 人类学技术,并返回结构脚手架。没有LLM呼叫,没有网络,亚毫秒。
______________________________________________________________________
安装
要求:

来自shell:
claude mcp add claude-orator-mcp -- npx claude-orator-mcp从内部克劳德 (需要重新启动):
Add this to our global mcp config: npx claude-orator-mcp
Install this mcp: https://github.com/Vvkmnn/claude-orator-mcp从任何手动配置 mcp.json:(光标、风帆等)
{
"mcpServers": {
"claude-orator-mcp": {
"command": "npx",
"args": ["claude-orator-mcp"],
"env": {}
}
}
}有 不 npm install 必需的 --没有外部依赖或数据库,只有确定性启发式。
然而,如果 npx 解决错误的包,您可以使用以下命令强制解决:
npm install -g claude-orator-mcp技能
可选地,安装技能来教Claude何时主动优化提示:
npx skills add Vvkmnn/claude-orator-mcp --skill claude-orator --global
# Optional: add --yes to skip interactive prompt and install to all agents这使得Claude在分派子代理、编写系统提示或制作任何值得改进的提示之前,会自动优化提示。MCP在没有技能的情况下工作,但技能提高了可发现性。
插件
要使用钩子和命令进行自动提示优化,请从安装 克劳德商场 市场:
/plugin marketplace add Vvkmnn/claude-emporium
/plugin install claude-orator@claude-emporium这 克劳德演说家 插件提供:
钩子 (分代理调度前发生火灾):
- 任务之前——建议在启动代理之前进行提示优化
命令: /reprompt-orator
需要先安装MCP服务器。请参阅商场了解其他Claude Code插件和MCP。
特征
MCP服务器 只需一个工具。提示输入,优化提示输出。
orator_optimize
分析7个质量维度的提示,从11种拟人技术中自动选择,并返回一个结构优化的支架,带有前后评分。
orator_optimize prompt="Write a function that sorts users"
> Returns optimized scaffold with XML tags, output format, examples section
orator_optimize prompt="You are a helpful assistant" intent="system"
> Returns role-assigned system prompt with structure and constraints
orator_optimize prompt="Extract all emails from this text" techniques=["xml-tags", "few-shot"]
> Force-applies specific techniques regardless of auto-selection计分仪 (渐变填充条):
🪶 3.2 ░░░▓▓▓▓▓▓▓▓ 7.8
+xml-tags +few-shot +structured-output · 3 issues
Wrapped in XML tags, added examples, specified output format三区酒吧: ░░░ (基线) ▓▓▓▓▓ (改进) ░░ (净空高度为10)。
最小案例 (结构良好):
🪶 ━━ already well-structured (8.4)输入:
| 参数 | 类型 | 必填 | 说明 | |||||
|---|---|---|---|---|---|---|---|---|
prompt | string | Yes | 要优化的原始提示 | |||||
intent | enum | 否 | `code \ | analysis \ | creative \ | extraction \ | conversation \ | system` (自动检测) |
target | enum | 否 | `claude-code \ | claude-api \ | claude-desktop \ | generic (默认值: claude-code`) | ||
techniques | string\[\] | 否 | 强制应用特定技术ID |
输出:
| 字段 | 类型 | 描述 |
|---|---|---|
optimized_prompt | string | 重写提示脚手架(主要输出) |
score_before | number | 原件质量分数(0-10) |
score_after | number | 优化后的质量分数(0-10) |
summary | string | 1行改进说明 |
detected_intent | string | 自动检测到的意图类别 |
applied_techniques | string\[\] | 已应用的技术ID |
issues | string\[\] | 检测到问题 |
suggestions | string\[\] | 可操作的修复 |
这 optimized_prompt 是一种结构脚手架。Claude利用领域知识、代码库上下文和对话历史对其进行了改进。
方法论
🪶 claude-orator-mcp
════════════════════
orator_optimize
──────────────
PROMPT
│
┌────────────┴────────────┐
▼ ▼
┌───────────┐ ┌────────────┐
│ Detect │ │ Measure │
│ Intent │ │ Complexity │
└─────┬─────┘ └──────┬─────┘
│ │
system > code > word count +
extraction > clause depth
analysis > │
creative > │
conversation │
+ disambiguation │
+ fallback heuristics │
│ │
└────────────┬────────────┘
│
▼
┌───────────────────┐
│ Score Before │
│ │
│ clarity 20% │ strong verbs, single task
│ specificity 20% │ named tech, constraints
│ structure 15% │ XML tags, headers, lists
│ examples 15% │ input/output pairs
│ constraints 10% │ scope, edge cases
│ output_fmt 10% │ format specification
│ efficiency 10% │ no filler, no redundancy
│ │
│ ░░░░░░░░░░ 3.2 │
└────────┬──────────┘
│
▼
┌───────────────────┐ techniques?
│ Select Techniques │◄──── (force override)
│ │
│ when_to_use() × │ 11 predicates
│ intent match × │ filtered
│ score gaps × │ sorted by impact
│ cap at 4 │
└────────┬──────────┘
│
▼
┌───────────────────┐
│ Template Assembly │
│ │
│ role preamble │ expert identity
│ → │ grounding data first
│ → │ XML-wrapped prompt
│ → │ constraints + gaps
│ → │ multishot I/O pairs
│ → output format │ format specification
└────────┬──────────┘
│
▼
┌───────────────────┐
│ Score After │
│ │
│ ░░░▓▓▓▓▓▓▓░░ 7.8│
└────────┬──────────┘
│
▼
OUTPUT
optimized_prompt
+ scores + techniques
+ issues + suggestions
score meter (gradient fill bar):
─────────────────────────────────
🪶 3.2 ░░░▓▓▓▓▓▓▓▓ 7.8
+xml-tags +few-shot +structured-output
Wrapped in XML, added examples, format
░░░ baseline ▓▓▓ improvement ░░ headroom7个质量维度 (加权评分,确定性):
| 尺寸 | 重量 | 度量 |
|---|---|---|
| 清晰度 | 20% | 强动词,单任务,无对冲 |
| 特异性 | 20% | 命名技术、数字、约束 |
| 结构 | 15% | XML标签、标题、列表 |
| 示例 | 15% | 输入/输出对,演示 |
| 约束 | 10% | 负约束、范围、边缘情况 |
| 输出格式 | 10% | 格式规范、结构定义 |
| 令牌效率 | 10% | 无填充,无冗余 |
11人类技术 (根据意图、分数和复杂性自动选择):
| ID | 名称 | 自动选择 |
|---|---|---|
chain-of-thought | 让克劳德想想 | 分析意图、复杂任务 |
xml-tags | 使用XML标记 | 长提示+低结构分数 |
few-shot | 多镜头示例 | 低示例分数+提取/编码 |
role-assignment | 系统提示和角色 | 系统意图或低特异性 |
structured-output | 控制输出格式 | 输出格式得分低 |
prefill | 结构化输出格式 | API目标+提取/代码 |
prompt-chaining | 链复杂任务 | 复杂+多个子任务 |
uncertainty-permission | 说“我不知道” | 分析或提取意图 |
extended-thinking | 延伸思考 | 复杂+分析/代码意图 |
long-context-tips | 长上下文 | 长提示(>2000个字符或>50行) |
tool-use | 工具使用 | 提示提及工具/函数调用 |
核心算法:
- 意图检测 (
detectIntent):跨6个类别的优先级排序正则表达式模式:system > code > extraction > analysis > creative > conversation包括消歧(例如。,system+code信号解析为code)以及代码块的回退启发式、“构建我”模式和调试语言。 - 启发式评分 (
scorePrompt):7维加权分析。每个维度0-10,总体为加权和。也产生平坦issues[]和suggestions[]阵列。 - 技术选择 (
selectTechniques):每种技术都有when_to_use()谓语。根据意图+分数+复杂性自动选择。按冲击力排序,上限为4。 - 模板组装 (
optimize):使用选定的技术构建结构脚手架。上下文优先排序:角色→ `→→→` → 输出格式。
设计原则:
- 单一工具:一个切入点,最小的认知开销
- 确定性的:相同的输入,相同的输出。没有LLM呼叫,没有网络
- 脚手架,不是最终的:优化后的提示是结构化的;克劳德补充了内容
- 精益产出:用于问题/建议的扁平字符串数组,没有嵌套对象
- 加权尺寸:清晰度和特异性最重要(各占20%)
- 技术帽:每次优化最多4种技术(超出后收益递减)
- 反模式检测:12个克劳德特有的反模式+来自34个生产AI工具的20个行业模式
- 零依赖:仅
@modelcontextprotocol/sdk+zod
替代方案
每个现有的快速优化工具都需要LLM调用、标记的数据集或评估基础设施。当您需要零延迟的结构改进(CI/CD、子代理调度、离线)时,他们无法提供帮助。
| 特点 | 演说家 | DSPy | promptfoo | TextGrad | OPRO | LLMLingua | 拟人生成器 |
|---|---|---|---|---|---|---|---|
| 零延迟 | **是(\=20.0.0(ES模块) |
- 运行时:
@modelcontextprotocol/sdk,zod - 零外部数据库:与合作
npx
开发工作流程:
npm run build # TypeScript compilation with executable permissions
npm run dev # Watch mode with tsc --watch
npm run start # Run the MCP server directly
npm run lint # ESLint code quality checks
npm run lint:fix # Auto-fix linting issues
npm run format # Prettier formatting (src/)
npm run format:check # Check formatting without changes
npm run typecheck # TypeScript validation without emit
npm run test # Lint + type check + vitest (25 tests)
npm run prepublishOnly # Pre-publish validation (build + lint + format:check)Git钩子(通过赫斯基):
- 预承诺:自动格式化已暂存
.ts使用Prettier和ESLint的文件
贡献:
- 分叉存储库并创建功能分支
- 遵循TypeScript严格模式 MCP协议 标准
从示例中学习:
- 官方MCP服务器 供参考实现
- TypeScript SDK 最佳实践
- 用于npm包开发
- 人工提示工程文档 了解技术细节
致谢
通过对34个AI编码工具的系统提示进行深入分析得出的行业模式数据 收集在 人工智能工具的系统提示和模型, 包括Claude Code、Cursor、Windsurf、v0、Devin、Cline、Lovable、Replit、Amp、Gemini和 25人。模式是用患病率数据精心策划的,并嵌入其中——没有外部依赖性 或需要安装。与来自 即时报告 (调查了1500篇论文)和 Anthropic的快速工程文档.
许可证
_西塞罗谴责卡提林 通过 凯撒 马卡里 (1889).“Catilina,耐心的鼻孔?”(Catiline,你会滥用我们的耐心多久?)- 克劳迪乌斯._
