본문으로 건너뛰기
Skillpedia
프롬프트 및 LLM41k · #6724

prompt-engineering-patterns

하는 일

이 도구는 인공지능을 위한 더 좋고 효과적인 지시문을 만드는 데 도움을 줍니다. AI가 원하는 바를 정확히 이해하고 더 정확하고 믿을 수 있는 답을 줄 수 있도록 고급 기법을 가르쳐 줍니다.

사용하는 경우

  • ✓AI가 더 정확한 응답을 만들기를 원할 때.
  • ✓복잡한 작업을 위한 AI 시스템을 만들 때.
  • ✓AI가 특정 응답 형식을 따르도록 하고 싶을 때.

스킬 링크

https://github.com/wshobson/agents/blob/main/plugins/llm-application-dev/skills/prompt-engineering-patterns/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/wshobson/agents/blob/main/plugins/llm-application-dev/skills/prompt-engineering-patterns/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“AI에게 보낼 이 지시문 'Write a summary about World War II'를 어떻게 개선할 수 있을까요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

AI가 단계별로 생각하고, 예시를 사용해 배우며, 응답을 구조화된 방식으로 만들도록 가르쳐서 작동합니다. 이를 통해 AI가 지시를 더 잘 이해하고 실수를 줄입니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

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 handling
  • Error handling for malformed outputs

4. Prompt Optimization

  • Iterative refinement workflows
  • A/B testing prompt variations
  • Measuring prompt performance metrics (accuracy, consistency, latency)
  • Reducing token usage while maintaining quality
  • Handling edge cases and failure modes

5. Template Systems

  • Variable interpolation and formatting
  • Conditional prompt sections
  • Multi-turn conversation templates
  • Role-based prompt composition
  • Modular prompt components

6. System Prompt Design

  • Setting model behavior and constraints
  • Defining output formats and structure
  • Establishing role and expertise
  • Safety guidelines and content policies
  • Context setting and background information

Quick Start

from langchain_anthropic import ChatAnthropic
from langchain_core.prompts import ChatPromptTemplate
from pydantic import BaseModel, Field

# Define structured output schema
class SQLQuery(BaseModel):
    query: str = Field(description="The SQL query")
    explanation: str = Field(description="Brief explanation of what the query does")
    tables_used: list[str] = Field(description="List of tables referenced")

# Initialize model with structured output
llm = ChatAnthropic(model="claude-sonnet-5")
structured_llm = llm.with_structured_output(SQLQuery)

# Create prompt template
prompt = ChatPromptTemplate.from_messages([
    ("system", """You are an expert SQL developer. Generate efficient, secure SQL queries.
    Always use parameterized queries to prevent SQL injection.
    Explain your reasoning briefly."""),
    ("user", "Convert this to SQL: {query}")
])

# Create chain
chain = prompt | structured_llm

# Use
result = await chain.ainvoke({
    "query": "Find all users who registered in the last 30 days"
})
print(result.query)
print(result.explanation)

Detailed patterns and worked examples

Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.

Best Practices

  1. Be Specific: Vague prompts produce inconsistent results
  2. Show, Don't Tell: Examples are more effective than descriptions
  3. Use Structured Outputs: Enforce schemas with Pydantic for reliability
  4. Test Extensively: Evaluate on diverse, representative inputs
  5. Iterate Rapidly: Small changes can have large impacts
  6. Monitor Performance: Track metrics in production
  7. Version Control: Treat prompts as code with proper versioning
  8. Document Intent: Explain why prompts are structured as they are

Common Pitfalls

  • Over-engineering: Starting with complex prompts before trying simple ones
  • Example pollution: Using examples that don't match the target task
  • Context overflow: Exceeding token limits with excessive examples
  • Ambiguous instructions: Leaving room for multiple interpretations
  • Ignoring edge cases: Not testing on unusual or boundary inputs
  • No error handling: Assuming outputs will always be well-formed
  • Hardcoded values: Not parameterizing prompts for reuse

Success Metrics

…

자주 묻는 질문

'Chain-of-Thought'란 무엇인가요?

AI가 답에 도달하기까지의 단계별 추론을 마치 소리 내어 생각하듯 보여 주도록 지시하는 기법입니다.

'Few-Shot Learning'이란 무엇인가요?

본 질문을 하기 전에 원하는 답의 예시를 몇 개 주는 방식입니다. AI는 이 예시를 보고 배웁니다.

'구조화된 출력'은 왜 쓰나요?

AI가 정보를 JSON 같은 예측 가능한 형식으로 돌려주도록 해서, 다른 프로그램이 그 정보를 쉽게 사용할 수 있게 합니다.

상세 정보

작성자의 원본 설명

This skill should be used when the user asks to "optimize a prompt", "improve prompt performance", "design a prompt template", "write better prompts", "debug prompt issues", "use chain-of-thought", "structured prompting", "few-shot prompting", or wants to apply advanced prompt engineering patterns for production LLM applications.

repo: wshobson/agents

인기도

GitHub 스타
41k
순위
#6724
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬