claudegoodies
Skill

prompt-engineering-patterns

From wshobson

>-

Provides reference patterns and best practices for designing, structuring, and optimizing LLM prompts.

Use it when

  • Designing few-shot or chain-of-thought prompts for production LLM apps
  • Building structured JSON/Pydantic output schemas with LangChain
  • Debugging inconsistent or malformed prompt outputs
  • Creating reusable prompt templates with variable interpolation

Skip it if

  • Examples and code use LangChain + ChatAnthropic specifically
  • You need actual working code, not just documentation and guidelines
  • You want automated prompt testing/optimization, not written advice

Facts

Repository
wshobson/agents
Status
Actively maintained
Last commit

Source preview

The instructions Claude Code reads when this skill runs.

# Prompt Engineering Patterns

Master advanced prompt engineering techniques to maximize LLM performance, reliability, and controllability.

## When to Use This Skill

- Designing complex prompts for production LLM applications
- Optimizing prompt performance and consistency
- Implementing structured reasoning patterns (chain-of-thought, tree-of-thought)
- Building few-shot learning systems with dynamic example selection
- Creating reusable prompt templates with variable interpolation
- Debugging and refining prompts that produce inconsistent outputs
- Implementing system prompts for specialized AI assistants
- Using structured outputs (JSON mode) for reliable parsing

## Core Capabilities

### 1. Few-Shot Learning

- Example selection strategies (semantic similarity, diversity sampling)
- Balancing example count with context window constraints
- Constructing effective demonstrations with input-output pairs
- Dynamic example retrieval from knowledge bases
- Handling edge cases through strategic example selection

### 2. Chain-of-Thought Prompting

- Step-by-step reasoning elicitation
- Zero-shot CoT with "Let's think step by step"
- Few-shot CoT with reasoning traces
- Self-consistency techniques (sampling multiple reasoning paths)
- Verification and validation steps

### 3. Structured Outputs

- JSON mode for reliable parsing
- Pydantic schema enforcement
- Type-safe response 
View full source on GitHub →

Other skills