Claude
Skills
Sign in
Back

prompt-engineering

Included with Lifetime
$97 forever

Use this skill when creating, optimizing, or improving prompts for large language models. Applies when users need help designing effective prompts, selecting appropriate prompting techniques, or troubleshooting prompt performance. Provides expert guidance through conversational consulting to build prompts using research-backed best practices and proven patterns.

AI Agents

What this skill does


# Prompt Engineering

## Overview

This skill provides expert guidance for creating effective prompts for large language models. Act as a conversational consultant to understand the user's goal, analyze task requirements, recommend appropriate techniques, and collaboratively build optimized prompts.

The skill encodes research findings from academic papers and practical implementations into actionable workflows. Guide users through a structured process to create prompts that are clear, effective, and cost-efficient.

## When to Use This Skill

Invoke this skill when:
- User asks for help creating a prompt
- User wants to improve or optimize an existing prompt
- User needs guidance on prompting techniques or best practices
- User is troubleshooting poor LLM performance
- User asks questions like "how should I prompt for X?"

## Core Workflow

Follow this four-phase conversational workflow to build effective prompts:

### Phase 1: Intake - Understand the Goal

Begin by understanding what the user is trying to accomplish. Ask targeted questions to gather essential context:

**Key Questions**:
1. What is the desired outcome? (What should the LLM produce?)
2. What is the input format? (User queries, documents, data, etc.)
3. What constraints exist? (Length, format, style, tone)
4. What model will be used? (Affects capability assumptions)
5. What does success look like? (How to evaluate quality)

**Approach**:
- Ask 2-3 focused questions at a time (avoid overwhelming)
- Listen for implicit requirements the user may not state
- Clarify ambiguous terms or expectations
- Understand the user's technical level (adjust explanations accordingly)

**Output from Phase 1**: Clear statement of objective and constraints.

**Example**:
```
User: "I need a prompt for analyzing customer feedback"

Ask:
- What specific insights do you want extracted? (Sentiment, themes, issues, etc.)
- What format should the output be in?
- How much feedback will you provide at once? (Single review vs batch)
- Is there a specific classification or framework to follow?
```

---

### Phase 2: Analysis - Assess Task Complexity

Analyze the task to determine appropriate techniques. Consider:

**Complexity Dimensions**:

**Simple Tasks** (Zero-shot candidates):
- Well-defined, common operations (summarize, classify, extract)
- Model has strong base knowledge
- No special format requirements
- Examples: Basic summarization, simple classification, fact extraction

**Medium Complexity** (Few-shot or CoT candidates):
- Specific format or style needed
- Domain conventions to follow
- Multi-step reasoning required
- Examples: Structured extraction, styled writing, calculation problems

**High Complexity** (Advanced techniques):
- Multiple reasoning paths needed
- Strategic decision-making
- High accuracy requirements
- Exploration of alternatives
- Examples: Complex analysis, strategic planning, critical decisions

**Key Factors**:
1. **Reasoning depth**: Single step vs multi-step vs exploratory
2. **Format specificity**: Any format vs specific structure
3. **Domain knowledge**: General vs specialized
4. **Accuracy requirements**: Good enough vs must be perfect
5. **Consistency needs**: One-off vs repeatable process

**Output from Phase 2**: Classification of task complexity and candidate techniques.

---

### Phase 3: Recommendation - Select Techniques

Based on the analysis, recommend specific techniques with rationale. Explain the trade-offs.

**Use the Decision Framework**:

| If the task is... | Recommend... | Because... |
|-------------------|--------------|------------|
| Simple, well-defined | Zero-shot | Most efficient, model knows the pattern |
| Needs specific format | Few-shot (2-3 examples) | Examples demonstrate structure |
| Multi-step reasoning | Chain-of-thought | Makes reasoning explicit and debuggable |
| High-stakes accuracy | Self-consistency + CoT | Multiple paths reduce error rate |
| Strategic/exploratory | Tree-of-thought | Explores alternatives systematically |
| Complex multi-stage | Least-to-most | Breaks into manageable sub-problems |
| Needs improvement | Self-refine | Iterative refinement improves quality |

**Always consider**:
- **Cost**: Token usage implications
- **Latency**: Response time requirements
- **Consistency**: Repeatability needs

**Explain the recommendation**: Don't just name the technique, explain why it fits this specific use case.

**Output from Phase 3**: Recommended technique(s) with clear rationale.

**Example**:
```
"For customer feedback analysis with structured output, recommend few-shot prompting because:
1. You need consistent JSON format (examples demonstrate structure)
2. Domain-specific categories (examples show classification style)
3. Medium complexity doesn't require heavy CoT
4. Cost-efficient for production use

Would use 3 examples showing: typical feedback, edge case (missing info), and complex feedback with multiple issues."
```

---

### Phase 4: Construction - Build the Prompt

Collaboratively build the prompt, incorporating best practices. Walk through each component and explain the choices.

**Core Components to Address**:

1. **Role/Persona** (if beneficial):
   - Specify expertise level and domain
   - Set behavioral expectations
   - Example: "You are a data analyst specializing in customer insights"

2. **Instructions**:
   - Clear, concise task description
   - Positive guidance (what to do, not what to avoid)
   - Explicit edge case handling

3. **Structure**:
   - Separate instructions from content with delimiters
   - Use triple quotes, XML tags, or clear markdown sections
   - Example: `Content: """[user input]"""`

4. **Examples** (if using few-shot):
   - 2-3 representative examples
   - Include edge cases
   - Match actual use case format

5. **Output Format**:
   - Specify if format matters
   - Provide templates or schemas
   - Example: "Respond in JSON: {sentiment: ..., themes: [...]}"

6. **Constraints**:
   - Length limits
   - Required inclusions
   - Prohibited content

**Build Iteratively**:
- Start with core instruction
- Add structure and examples
- Refine based on requirements
- Explain each addition

**Show the prompt**: Present the complete prompt in a code block for easy copying.

**Output from Phase 4**: Complete, ready-to-use prompt with explanation of design choices.

---

## Reference Materials

This skill includes comprehensive reference documentation. Load these as needed based on the conversation:

### references/techniques-guide.md
Deep dive on 10+ prompting techniques with examples, decision criteria, and pitfalls.

**Load when**:
- User wants to understand a specific technique in depth
- Need detailed examples of technique implementation
- Troubleshooting technique selection
- User asks "what is chain-of-thought?" or similar

**Contains**:
- Zero-shot, few-shot, chain-of-thought, self-consistency, tree-of-thought
- Generated knowledge, least-to-most, self-refine, directional-stimulus
- Role/persona prompting
- Technique combination strategies
- Cost-benefit analysis

---

### references/best-practices.md
Structural and strategic best practices for prompt optimization.

**Load when**:
- User asks about prompt optimization
- Need to explain structural choices
- Troubleshooting prompt quality issues
- User wants to understand "why" behind recommendations

**Contains**:
- Core principles (clarity, positive guidance, separation, condensing)
- Role and system message design
- Context organization patterns
- The 6-step optimization process
- Common anti-patterns
- Quality checklist

---

### references/pattern-library.md
Ready-to-adapt templates for common scenarios.

**Load when**:
- User wants a quick-start template
- Looking for specific pattern examples
- Need concrete format examples
- Showing implementation of recommended technique

**Contains**:
- Zero-shot patterns (classification, extraction, transformation)
- Few-shot patterns (format learning, edge cases, conversational)
- Chain-of-th

Related in AI Agents