Prompt Design Skill
Based on Anthropic Prompt Library official guidelines prompt design assistant.
Core Workflow
Create New Prompt
- Determine Type - Identify the task scenario (programming/documentation/creative/education/academic)
- Select Template - Refer to templates.md to select the corresponding template
- Fill In Content - Fill in the content of each tag according to the template structure
- Quality Check - Use quality-checklist.md to validate
- Output Prompt - Deliver the complete System Prompt + User Prompt
Optimize Existing Prompt
- Diagnose Issues - Identify output quality issues (hallucination/format confusion/unclear logic)
- Check Against Guidelines - Check whether it conforms to the XML tag specifications below
- Apply Template - Restructure into the standard structure
- Enhance Mechanisms - Add CoT/citation verification/XML tags, etc.
XML Tag Specifications
Claude was trained with XML tags; the following structure is recommended:
Core Structure Tags
| Tag |
Purpose |
Key Requirements |
<role> |
Role definition |
Clearly specify identity and professional background |
<task> |
Task statement |
Use "Your task is to..." |
<thinking> |
Internal reasoning |
Must be marked "not to be output directly to the user" |
<instructions> |
Operational instructions |
Include steps + format selection logic |
<output_format> |
Output format |
Only general specifications; multiple templates listed in parallel are prohibited |
<constraints> |
Constraints |
Use affirmative instructions |
Tag Responsibility Separation Principle
Core rule: In multi-scenario prompts, place format selection logic in <instructions>,<output_format> and write only general specifications.
❌ 错误:output_format 并列多种格式
<output_format>
【分析类】**分析过程:** [...]
---
【事实类】**回答:** [...]
</output_format>
✅ 正确:格式选择在 instructions
<instructions>
X. **格式选择**:根据问题类型:
- 分析类:使用 "**分析过程**" + "**结论**"
- 事实类:使用 "**回答**" + "**来源**"
</instructions>
<output_format>
使用 Markdown 格式,对比数据用表格
</output_format>
Content Wrapper Tags
| Tag |
Purpose |
<document> |
Wrap reference documents |
<code> |
Wrap code snippets |
<example> |
Few-Shot examples |
<context> |
Background information |
Advanced Reasoning Tags
| Tag |
Purpose |
<scratchpad> |
Intermediate calculation/reasoning steps |
<reasoning> |
Structured logical derivation |
<verification> |
Result self-check |
Design Guidelines
1. Affirmative is better than negative
❌ "Don't make up information"
✅ "Only use information from the provided document. If uncertain, say 'I don't know'"
2. Chain-of-Thought guidance
For complex tasks, add step-by-step thinking:
Think step by step before providing your final answer.
First, analyze the problem. Then, consider possible approaches. Finally, provide your solution.
3. System vs Human Prompt division of labor
| Type |
Content |
| System |
Role definition, global constraints, tool definitions |
| Human |
Specific tasks, input data, specific requirements |
Scenario-Specific Key Points
| Scenario |
Key Elements |
| Programming |
<code> Tags + Annotation requirements + Error handling |
| Documentation category |
<document> Tags + Formatted output |
| Academic category |
ReAct validation + CoT + LaTeX formulas |
| Citation category |
Use only provided documents + Cite sources + Confidence |
Detailed reference