Prompt design, optimization, few-shot learning, and chain of thought techniques for LLM applications.
View on GitHubpluginagentmarketplace/custom-plugin-ai-engineer
ai-engineer-plugin
January 20, 2026
Select agents to install to:
npx add-skill https://github.com/pluginagentmarketplace/custom-plugin-ai-engineer/blob/main/skills/prompt-engineering/SKILL.md -a claude-code --skill prompt-engineeringInstallation paths:
.claude/skills/prompt-engineering/# Prompt Engineering
Master the art of crafting effective prompts for LLMs.
## Quick Start
### Basic Prompt Structure
```python
# Simple completion prompt
prompt = """
You are a helpful assistant specialized in {domain}.
Task: {task_description}
Context: {relevant_context}
Instructions:
1. {instruction_1}
2. {instruction_2}
Output format: {desired_format}
"""
# Using OpenAI
from openai import OpenAI
client = OpenAI()
response = client.chat.completions.create(
model="gpt-4",
messages=[
{"role": "system", "content": system_prompt},
{"role": "user", "content": user_prompt}
]
)
```
### Few-Shot Learning
```python
few_shot_prompt = """
Classify the sentiment of the following reviews.
Examples:
Review: "This product exceeded my expectations!"
Sentiment: Positive
Review: "Terrible quality, broke after one day."
Sentiment: Negative
Review: "It's okay, nothing special."
Sentiment: Neutral
Now classify:
Review: "{user_review}"
Sentiment:
"""
```
## Core Techniques
### Chain of Thought (CoT)
```python
cot_prompt = """
Solve this step by step:
Problem: {problem}
Let's think through this carefully:
1. First, identify what we know...
2. Then, determine what we need to find...
3. Apply the relevant formula/logic...
4. Calculate the result...
Final Answer:
"""
```
### Self-Consistency
```python
# Generate multiple reasoning paths
responses = []
for _ in range(5):
response = generate_with_cot(prompt, temperature=0.7)
responses.append(response)
# Take majority vote
final_answer = majority_vote(responses)
```
### ReAct Pattern
```python
react_prompt = """
Answer the following question using the ReAct framework.
Question: {question}
Use this format:
Thought: [Your reasoning about what to do next]
Action: [The action to take: Search, Calculate, or Lookup]
Observation: [The result of the action]
... (repeat Thought/Action/Observation as needed)
Thought: I now have enough information to answer.
Final Answer: [Your answer]
"""
```