prompt-improvement

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Prompt Improvement

提示词改进

MANDATORY: Query Official Documentation First

强制要求:先查询官方文档

STOP - Before improving ANY prompt, you MUST invoke the docs-management skill.
This is NOT optional guidance - it is a required execution step.
注意 - 在改进任何提示词之前,你必须调用docs-management技能。
这不是可选建议,而是必须执行的步骤。

Required: Query Documentation via docs-management Skill

要求:通过docs-management技能查询文档

Invoke the
claude-ecosystem:docs-management
skill BEFORE making any improvements:
Search for relevant documentation using natural language:
  • Primary query: "prompt engineering chain of thought XML tags"
  • Read the top results returned by the skill
在进行任何改进之前,先调用
claude-ecosystem:docs-management
技能:
使用自然语言搜索相关文档:
  • 核心查询词:"prompt engineering chain of thought XML tags"
  • 阅读该技能返回的顶部结果

Why Documentation Query is Required

为什么必须查询文档

  • Training data is stale - Your knowledge may be outdated
  • Official docs are canonical - Anthropic's current best practices
  • Prevents hallucination - Ground improvements in real documentation
  • Ensures accuracy - Latest Claude 4.x guidance
  • 训练数据过时 - 你的知识可能已经陈旧
  • 官方文档是权威来源 - Anthropic当前的最佳实践
  • 避免幻觉 - 基于真实文档进行改进
  • 确保准确性 - 遵循最新的Claude 4.x指导方针

Recommended Query Topics

推荐查询主题

Query at least ONE of these topics based on your improvement needs:
  • Chain of thought: "chain of thought thinking tags reasoning"
  • XML structure: "XML tags structure prompts formatting"
  • Examples/multishot: "multishot prompting examples few-shot"
  • Claude 4.x best practices: "Claude 4 prompting best practices"
根据你的改进需求,至少查询以下主题之一:
  • 思维链:"chain of thought thinking tags reasoning"
  • XML结构:"XML tags structure prompts formatting"
  • 示例/多轮提示:"multishot prompting examples few-shot"
  • Claude 4.x最佳实践:"Claude 4 prompting best practices"

Verification Checkpoint

验证检查点

Before improving a prompt, verify:
  • Did I invoke the docs-management skill? (not just read about it)
  • Did I receive documentation from docs-management?
  • Did I READ at least one official doc returned by the skill?
  • Are my improvements based on what I read from official docs?
If ANY checkbox is unchecked, STOP and invoke the docs-management skill first.
在改进提示词之前,请验证:
  • 我是否调用了docs-management技能?(不是仅仅阅读相关说明)
  • 我是否从docs-management获取了文档?
  • 我是否阅读了该技能返回的至少一份官方文档?
  • 我的改进是否基于从官方文档中读取的内容?
如果有任何一个复选框未勾选,请停止操作并先调用docs-management技能。

Overview

概述

This meta-skill replicates Anthropic's Console/Workbench prompt improver functionality within Claude Code. It provides workflows, patterns, and keyword registries to transform basic prompts into high-performance structured templates.
What this skill provides:
  • The 4-step improvement workflow (quick reference)
  • Keyword registry for docs-management queries
  • Decision trees for improvement strategies
  • Pattern libraries (XML tags, chain of thought, prefills)
  • Before/after transformation examples
  • Iterative refinement guidance
  • Trade-off warnings (latency/cost implications)
What this skill does NOT provide:
  • Duplicated official documentation (use
    docs-management
    skill)
  • Hardcoded best practices (query
    docs-management
    for current guidance)
这款元技能在Claude Code中复现了Anthropic控制台/工作台的提示词优化功能。它提供工作流、模式和关键词注册表,可将基础提示词转换为高性能的结构化模板。
该技能提供的功能:
  • 四步改进工作流(快速参考)
  • 用于docs-management查询的关键词注册表
  • 改进策略决策树
  • 模式库(XML标签、思维链、预填充内容)
  • 改进前后的转换示例
  • 迭代优化指导
  • 权衡警告(延迟/成本影响)
该技能不提供的内容:
  • 重复的官方文档(请使用
    docs-management
    技能)
  • 硬编码的最佳实践(请查询
    docs-management
    获取当前指导方针)

When to Use This Skill

适用场景

Use this skill when:
  • Improving an existing prompt for better accuracy or structure
  • Adding chain of thought reasoning to complex tasks
  • Structuring prompts with XML tags for clarity and parseability
  • Enhancing examples with reasoning steps
  • Optimizing prompts for Claude 4.x models with explicit instructions
  • Iterating on prompt quality with feedback loops
  • Generating test cases when examples are lacking
在以下场景使用该技能:
  • 改进现有提示词,提升准确性或结构合理性
  • 为复杂任务添加思维链推理
  • 用XML标签构建提示词结构,提升清晰度和可解析性
  • 为示例添加推理步骤
  • 针对Claude 4.x模型优化提示词,添加明确指令
  • 通过反馈循环迭代提升提示词质量
  • 在缺少示例时生成测试用例

Quick Decision Tree

快速决策树

What do you want to do?
  1. Improve a prompt from scratch -> See The 4-Step Improvement Workflow
  2. Add XML structure -> Query docs-management: "Find documentation about XML tags for structuring prompts"
  3. Add chain of thought -> Query docs-management: "Find documentation about chain of thought prompting"
  4. Add/improve examples -> See references/patterns/example-enrichment-patterns.md
  5. Iterate with feedback -> See references/workflows/iterative-refinement.md
  6. Generate test cases -> See references/workflows/test-case-generation.md
  7. Understand trade-offs -> See references/troubleshooting/tradeoffs-guide.md
你想要做什么?
  1. 从零开始改进提示词 -> 查看四步改进工作流
  2. 添加XML结构 -> 查询docs-management:"Find documentation about XML tags for structuring prompts"
  3. 添加思维链 -> 查询docs-management:"Find documentation about chain of thought prompting"
  4. 添加/改进示例 -> 查看references/patterns/example-enrichment-patterns.md
  5. 结合反馈迭代优化 -> 查看references/workflows/iterative-refinement.md
  6. 生成测试用例 -> 查看references/workflows/test-case-generation.md
  7. 了解权衡要点 -> 查看references/troubleshooting/tradeoffs-guide.md

The 4-Step Improvement Workflow

四步改进工作流

The prompt improver enhances prompts through a structured 4-step process:
提示词优化器通过结构化的四步流程增强提示词:

Step 1: Example Identification

步骤1:示例识别

  • Locate and extract any existing examples from the prompt
  • Note the format and structure of current examples
  • Identify if examples are missing (if so, consider generating them)
  • 定位并提取提示词中已有的所有示例
  • 记录当前示例的格式和结构
  • 判断是否缺少示例(如有需要,考虑生成示例)

Step 2: Initial Draft

步骤2:初稿撰写

  • Create a structured template with clear sections
  • Add XML tags to separate components:
    • <instructions>
      - Task definition and behavioral guidelines
    • <context>
      - Background information and relevant details
    • <examples>
      - Demonstration cases
    • <formatting>
      - Desired output format specification
  • Query docs-management: "Find documentation about XML tags for structuring prompts"
  • 创建带有清晰分区的结构化模板
  • 添加XML标签分隔不同组件:
    • <instructions>
      - 任务定义和行为准则
    • <context>
      - 背景信息和相关细节
    • <examples>
      - 演示案例
    • <formatting>
      - 期望的输出格式规范
  • 查询docs-management:"Find documentation about XML tags for structuring prompts"

Step 3: Chain of Thought Refinement

步骤3:思维链优化

  • Add step-by-step reasoning instructions
  • Include thinking tags:
    <thinking>
    ,
    <analysis>
    ,
    <answer>
  • Guide Claude through the problem-solving process
  • Query docs-management: "Find documentation about chain of thought prompting"
  • 添加分步推理指令
  • 包含思维标签:
    <thinking>
    ,
    <analysis>
    ,
    <answer>
  • 引导Claude完成问题解决流程
  • 查询docs-management:"Find documentation about chain of thought prompting"

Step 4: Example Enhancement

步骤4:示例增强

  • Update examples to demonstrate the new reasoning process
  • Add
    <thinking>
    steps within examples showing intermediate reasoning
  • Ensure examples match the output format specification
  • This teaches Claude HOW to reason, not just WHAT to output
Detailed workflow: references/workflows/improvement-workflow.md
  • 更新示例以展示新的推理流程
  • 在示例中添加
    <thinking>
    步骤,展示中间推理过程
  • 确保示例符合输出格式规范
  • 这能教会Claude如何推理,而不仅仅是输出结果
详细工作流: references/workflows/improvement-workflow.md

What You Get After Improvement

改进后的成果

An improved prompt typically includes:
  • Detailed chain-of-thought instructions guiding Claude's reasoning
  • Clear XML tag organization separating components
  • Standardized example formatting with step-by-step reasoning
  • Strategic prefills guiding initial responses
改进后的提示词通常包含:
  • 详细的思维链指令,引导Claude的推理过程
  • 清晰的XML标签组织,分隔不同组件
  • 标准化的示例格式,包含分步推理
  • 策略性预填充内容,引导初始响应

Typical Improved Prompt Structure

典型的改进后提示词结构

xml
<instructions>
Your task definition and behavioral guidelines
</instructions>

<context>
Background information and relevant details
</context>

<examples>
  <example>
    <input>Sample input</input>
    <thinking>Step-by-step reasoning</thinking>
    <output>Expected output</output>
  </example>
</examples>

<formatting>
Specify desired output format and structure
</formatting>
xml
<instructions>
你的任务定义和行为准则
</instructions>

<context>
背景信息和相关细节
</context>

<examples>
  <example>
    <input>示例输入</input>
    <thinking>分步推理过程</thinking>
    <output>期望输出</output>
  </example>
</examples>

<formatting>
指定期望的输出格式和结构
</formatting>

Keyword Registry for docs-management

docs-management关键词注册表

Use these keywords to query the
docs-management
skill for official documentation:
使用以下关键词查询
docs-management
技能获取官方文档:

Core Techniques

核心技术

TopicQuery Keywords
Prompt Improverprompt improver, prompt improvement, optimize prompts
Chain of Thoughtchain of thought, CoT, thinking, step-by-step, reasoning
XML TagsXML tags, structure prompts, tagging, XML structure
Examplesmultishot, few-shot, example formatting, multishot prompting
System Promptssystem prompt, role, persona, Claude role
Clarityclear, direct, explicit, specific instructions, be clear and direct
Claude 4.xClaude 4, Claude 4.5, Sonnet 4.5, Opus 4.5, best practices
主题查询关键词
提示词优化器prompt improver, prompt improvement, optimize prompts
思维链chain of thought, CoT, thinking, step-by-step, reasoning
XML标签XML tags, structure prompts, tagging, XML structure
示例multishot, few-shot, example formatting, multishot prompting
系统提示词system prompt, role, persona, Claude role
清晰度clear, direct, explicit, specific instructions, be clear and direct
Claude 4.xClaude 4, Claude 4.5, Sonnet 4.5, Opus 4.5, best practices

Advanced Topics

进阶主题

TopicQuery Keywords
Prefillingprefill, response prefill, assistant prefill, output format
Long Contextlong context, long context tips, document placement
Extended Thinkingextended thinking, thinking budget, deep reasoning
Prompt Chainingchain prompts, prompt chaining, multi-step prompts
主题查询关键词
预填充prefill, response prefill, assistant prefill, output format
长上下文long context, long context tips, document placement
扩展思维extended thinking, thinking budget, deep reasoning
提示词链式调用chain prompts, prompt chaining, multi-step prompts

Example Queries

查询示例

text
Find documentation about chain of thought prompting and thinking tags
text
Find documentation about XML tags for structuring prompts
text
Find documentation about multishot prompting and example formatting
text
Find documentation about Claude 4 and Claude 4.5 prompting best practices
text
Find documentation about prefilling Claude's response for output control
text
Find documentation about chain of thought prompting and thinking tags
text
Find documentation about XML tags for structuring prompts
text
Find documentation about multishot prompting and example formatting
text
Find documentation about Claude 4 and Claude 4.5 prompting best practices
text
Find documentation about prefilling Claude's response for output control

Performance Expectations

性能预期

Empirical Guidance: The metrics below are illustrative examples from Anthropic's testing at time of publication. Actual results vary by task, domain, and model version. These are NOT guarantees - use them as rough benchmarks for improvement potential.
Based on Anthropic's testing, prompt improvement typically yields:
  • 30% accuracy increase on multi-label classification tasks
  • 100% word count adherence on summarization tasks
  • ~40% reduction in prompt iteration cycles
Important: Improved prompts produce longer, more thorough responses. Consider trade-offs for latency-sensitive or cost-sensitive applications.
实证指导:以下指标是Anthropic发布时的测试示例结果。实际结果会因任务、领域和模型版本而异。这些指标不构成保证,仅作为改进潜力的大致基准。
根据Anthropic的测试,提示词改进通常能带来:
  • 多标签分类任务准确率提升30%
  • 摘要任务100%符合字数要求
  • 提示词迭代周期缩短约40%
重要提示: 改进后的提示词会生成更长、更详尽的响应。对于对延迟或成本敏感的应用,需考虑权衡取舍。

References Guide

参考指南

Load these files based on your specific needs:
根据你的具体需求加载以下文件:

Workflows

工作流

  • Improvement Workflow - Detailed 4-step process with quality checks
  • Iterative Refinement - Multi-pass improvement with feedback
  • Test Case Generation - Creating examples when none exist
  • 改进工作流 - 包含质量检查的详细四步流程
  • 迭代优化 - 结合反馈的多轮改进
  • 测试用例生成 - 无示例时创建示例

Examples

示例

  • Basic Transformations - Simple before/after examples
  • Advanced Transformations - Complex multi-component prompts
  • Domain-Specific - Code, analysis, creative, support domains
  • 基础转换 - 简单的前后对比示例
  • 进阶转换 - 复杂的多组件提示词
  • 领域特定 - 代码、分析、创意、支持等领域

Patterns

模式

  • XML Tagging Patterns - Complete tag library with usage
  • Chain of Thought Patterns - Basic, guided, structured CoT
  • Prefill Patterns - Strategic response prefilling
  • System Prompt Patterns - Role/persona assignment
  • Example Enrichment Patterns - Enhancing examples with reasoning
  • XML标签模式 - 完整的标签库及使用方法
  • 思维链模式 - 基础、引导式、结构化思维链
  • 预填充模式 - 策略性响应预填充
  • 系统提示词模式 - 角色/人设分配
  • 示例增强模式 - 为示例添加推理过程

Troubleshooting

故障排除

  • Common Issues - Problems and fixes
  • Debugging Guide - Systematic debugging
  • Trade-offs Guide - When NOT to use improvement
  • 常见问题 - 问题及解决方案
  • 调试指南 - 系统化调试方法
  • 权衡指南 - 不适合使用改进的场景

Metadata

元数据

  • Keyword Registry - Complete keyword-to-topic mappings
  • Tag Reference - Complete XML tag reference
  • 关键词注册表 - 完整的关键词-主题映射
  • 标签参考 - 完整的XML标签参考

Related Components

相关组件

Companion Agent

配套Agent

  • prompt-improver - Subagent that executes the 4-step improvement workflow
    • Auto-loads this skill for keyword registries and workflow guidance
    • Use when you need automated prompt improvement execution
    • Invoked by the
      /improve-prompt
      command
  • prompt-improver - 执行四步改进工作流的子Agent
    • 自动加载本技能以获取关键词注册表和工作流指导
    • 当你需要自动执行提示词改进时使用
    • 通过
      /improve-prompt
      命令调用

Slash Command

斜杠命令

  • /improve-prompt - User-facing command for prompt improvement
    • Input modes: direct text, file path, context, iterate
    • Supports
      --feedback
      for iterative refinement
    • Supports
      --generate-examples
      for prompts lacking examples
  • /improve-prompt - 面向用户的提示词改进命令
    • 输入模式:直接文本、文件路径、上下文、迭代
    • 支持
      --feedback
      参数用于迭代优化
    • 支持
      --generate-examples
      参数为缺少示例的提示词生成示例

Related Skills

相关技能

  • claude-ecosystem:docs-management - Official documentation access (all documentation queries delegate here)
  • claude-ecosystem:current-date - Get current UTC date for version history
  • claude-ecosystem:skill-development - Creating and validating skills
  • claude-ecosystem:docs-management - 官方文档访问(所有文档查询均委托给该技能)
  • claude-ecosystem:current-date - 获取当前UTC日期用于版本历史
  • claude-ecosystem:skill-development - 创建和验证技能

Version History

版本历史

  • v1.0.0 (2025-12-03): Initial release - Meta-skill for prompt improvement with 4-step workflow, delegation to docs-management, comprehensive pattern library

  • v1.0.0 (2025-12-03): 初始版本 - 提示词改进元技能,包含四步工作流、docs-management委托、全面的模式库

Last Updated

最后更新

Date: 2025-12-03 Model: claude-opus-4-5-20251101
日期: 2025-12-03 模型: claude-opus-4-5-20251101