refine-prompt
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRefining Prompts
Prompt优化
Process
流程
- Assess — Identify what the prompt is missing:
| Element | Check |
|---|---|
| Task | Is the core action explicit and unambiguous? |
| Constraints | Are length, format, tone, and scope defined? |
| Output format | Does it specify the expected structure? |
| Context | Does the model have enough background to act? |
| Examples | Would a demonstration clarify the expected output? |
| Edge cases | Are failure modes and boundary conditions addressed? |
-
Rewrite — Transform into specification language: precise, imperative, no filler. Treat the prompt as a spec, not conversation.
-
Validate — Check the rewrite against the assessment table. Every gap identified in step 1 must be addressed.
- 评估 — 识别Prompt中缺失的内容:
| 要素 | 检查项 |
|---|---|
| 任务 | 核心动作是否明确且无歧义? |
| 约束条件 | 是否定义了长度、格式、语气和范围? |
| 输出格式 | 是否指定了预期的结构? |
| 上下文 | 模型是否拥有足够的背景信息来执行任务? |
| 示例 | 演示是否能明确预期输出? |
| 边缘案例 | 是否考虑了失败模式和边界条件? |
-
重写 — 转换为规范语言:精准、命令式,无冗余内容。将Prompt视为规格说明,而非对话。
-
验证 — 对照评估检查表检查重写后的内容。步骤1中发现的每一处漏洞都必须得到解决。
Rules
规则
- Length: 0.75x–1.5x the original. Conciseness is a feature — add only what's missing, cut what's vague.
- Never invent — only use information present in the original prompt or conversation context. If critical info is missing, ask instead of assuming.
- Instruction hierarchy — order sections by priority: task → constraints → examples → input data → output format. Place the most important instruction first.
- Progressive complexity — start with the simplest prompt that could work. Add few-shot examples, chain-of-thought, or role framing only when the task demands it, not by default.
- Specific verbs — replace vague actions ("analyze", "process", "handle") with measurable ones ("list the top 3", "classify as A/B/C", "return JSON with keys X, Y").
- One output format — specify exactly one format (JSON schema, markdown template, numbered list). Ambiguous format expectations cause inconsistent results.
- No meta-commentary — output only the refined prompt as markdown. No preamble ("Here's an improved version..."), no explanation of changes unless explicitly requested.
- 长度:为原Prompt的0.75-1.5倍。简洁是核心优势——仅补充缺失的内容,删除模糊表述。
- 禁止编造——仅使用原Prompt或对话语境中存在的信息。若关键信息缺失,应询问而非自行假设。
- 指令优先级——按重要性排序内容:任务→约束条件→示例→输入数据→输出格式。将最重要的指令放在最前面。
- 渐进式复杂度——从最简单的可用Prompt开始。仅当任务需要时才添加few-shot examples、chain-of-thought或角色设定,而非默认添加。
- 具体动词——将模糊动作(如「analyze」「process」「handle」)替换为可衡量的动作(如「列出前3项」「分类为A/B/C」「返回包含X、Y键的JSON」)。
- 单一输出格式——明确指定一种格式(JSON schema、markdown模板、编号列表)。模糊的格式要求会导致结果不一致。
- 无元注释——仅输出markdown格式的优化后Prompt。除非明确要求,否则不要添加开场白(如「这是优化后的版本...」)或更改说明。
Anti-Patterns
反模式
| Problem | Fix |
|---|---|
| Vague verbs ("look into", "deal with") | Replace with concrete actions ("list", "compare", "extract") |
| Missing output spec | Add explicit format section with example structure |
| Examples contradict instructions | Align examples to match every stated rule |
| Over-engineered from the start | Strip to simplest working version, then add complexity only where output quality requires it |
| Prompt exceeds context with examples | Limit to 2–3 diverse examples; use one simple, one edge case |
| 问题 | 修复方案 |
|---|---|
| 模糊动词(如「look into」「deal with」) | 替换为具体动作(如「列出」「对比」「提取」) |
| 缺失输出规范 | 添加带有示例结构的明确格式说明 |
| 示例与指令矛盾 | 调整示例以符合所有已说明的规则 |
| 初始过度设计 | 简化为最简单的可用版本,仅当输出质量需要时再增加复杂度 |
| 示例导致Prompt超出上下文限制 | 限制为2-3个多样化示例;包含一个简单示例和一个边缘案例 |