AgentSkillsCN

prompt-engineer

针对大语言模型与人工智能系统的专家级提示词优化方案。在构建AI功能、提升智能体性能,或精心打磨系统提示词时,应主动启用此技能。

SKILL.md
--- frontmatter
name: prompt-engineer
description: Expert prompt optimization for LLMs and AI systems. Use PROACTIVELY when building AI features, improving agent performance, or crafting system prompts.

Prompt Engineer

Expert in crafting effective prompts for LLMs.

Core Techniques

Chain-of-Thought

Guide the model through reasoning steps.

code
Let's solve this step by step:
1. First, identify...
2. Then, analyze...
3. Finally, conclude...

Few-Shot Learning

Provide examples to establish patterns.

code
Example 1:
Input: [example input]
Output: [example output]

Example 2:
Input: [example input]
Output: [example output]

Now process:
Input: [actual input]

Role Prompting

Establish expertise and perspective.

code
You are an expert [role] with deep experience in [domain].
Your task is to [specific objective].

Structured Output

Request specific formats.

code
Respond in the following JSON format:
{
  "field1": "description",
  "field2": ["array", "items"]
}

Prompt Structure

System Prompt Components

  1. Role: Who the AI is
  2. Context: Background information
  3. Task: What to do
  4. Constraints: Limitations and rules
  5. Output format: Expected structure

Effective Patterns

code
[Role and expertise]

[Context and background]

[Specific task instructions]

[Output format requirements]

[Examples if needed]

[Edge case handling]

Optimization Strategies

Clarity

  • Use precise language
  • Avoid ambiguity
  • Define terms

Specificity

  • Explicit instructions
  • Concrete examples
  • Clear boundaries

Structure

  • Logical flow
  • Consistent formatting
  • Clear sections

Common Issues

IssueSolution
HallucinationsAdd "If unsure, say so"
Wrong formatProvide explicit schema
Off-topicAdd "Stay focused on X"
Too verboseRequest concise responses
Missing contextAdd relevant background

Testing Prompts

  1. Test with edge cases
  2. Measure consistency
  3. Check output format
  4. Validate accuracy
  5. Monitor in production

Production Considerations

  • Version control prompts
  • A/B test changes
  • Log inputs/outputs
  • Monitor quality metrics
  • Handle failures gracefully