prompt-engineering-patterns
Master advanced prompt engineering techniques to maximize LLM performance, reliability, and controllability in production.
Skill by JsonLee12138
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/jsonlee12138-prompt-engineering-patterns-bcf019
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: ml, agent-building
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions: not checked yet.
What's inside
- Skill name
prompt-engineering-patterns- Description
- Master advanced prompt engineering techniques to maximize LLM performance, reliability, and controllability in production. Use when optimizing prompts, improving LLM outputs, or designing production prompt templates.
- License
- MIT
- Instructions
- 470 lines in SKILL.md · view on GitHub
Before installing
- Ships executable scripts
Files (9)
- SKILL.md
- few-shot-examples.json · assets/
- prompt-template-library.md · assets/
- chain-of-thought.md · references/
- few-shot-learning.md · references/
- prompt-optimization.md · references/
- prompt-templates.md · references/
- system-prompts.md · references/
- optimize-prompt.py · scripts/
SKILL.md (first lines)
# 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
```python
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-4-6")
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)
```
## Key Patterns
### Pattern 1: Structured Output with Pydantic
```python
from anthropic import Anthropic
from pydantic import BaseModel, Field
from typing import Literal
import json
class SentimentAnalysis(BaseModel):
sentiment: Literal["positive", "negative", "neutral"]
confidence: float = Field(ge=0, le=1)
key_phrases: list[str]
reasoning: str
async def analyze_sentiment(text: str) -> SentimentAnalysis:
"""Analyze sentiment with structured output."""
client = Anthropic()From JsonLee12138/agent-team, MIT.
More from JsonLee12138/agent-team
- 0.502score
task-splitting
JsonLee12138
Decompose requirement, design, or brainstorming documents into reviewable task drafts with one function per task and one file per task, then create…
SkillDFreshness: D★ 33Claude Code +9 - 0.502score
prompt-engineering-patterns
JsonLee12138
Master advanced prompt engineering techniques to maximize LLM performance, reliability, and controllability in production.
SkillDFreshness: D★ 33Claude Code +9 - 0.498score
claude-hook-writer
Claude Skills Maintainers
Expert guidance for writing secure, reliable, and performant Claude Code hooks - validates design decisions, enforces best practices, and prevents common…
SkillDFreshness: D★ 33Claude Code +9 - 0.497score
mckinsey-consultant
JsonLee12138
McKinsey-style business consultant for hypothesis-driven problem solving, structured analysis, and strategic recommendations Use when the user asks for…
SkillDFreshness: D★ 33Claude Code +9 - 0.497score
pm
JsonLee12138
Full-stack product manager covering strategy, discovery, execution, go-to-market, market research, data analytics, marketing growth, and PM toolkit Use when…
SkillDFreshness: D★ 33Claude Code +9 - 0.497score
qa-tester
JsonLee12138
测试编写与集成验证工程师,负责 agent-team 项目的单元测试、CLI 命令测试和端到端集成验证 Use when the user asks for qa-tester-related work such as: go 单元测试编写, cli 命令测试, 端到端集成测试, 构建验证 (go…
SkillDFreshness: D★ 33Claude Code +9 - 0.497score
pencil-designer
JsonLee12138
Senior Pencil UI/UX Designer specializing in design systems, responsive interfaces, and accessible applications with mandatory Pencil MCP integration Use when…
SkillDFreshness: D★ 33Claude Code +9 - 0.497score
uniapp-dev
JsonLee12138
资深 UniApp 开发工程师,专精于 UnoCSS 原子化 CSS、Vite 工程化、UniApp 跨平台开发和 UCharts 数据可视化,具有丰富的小程序/H5/App 全场景交付经验 Use when the user asks for uniapp-dev-related work such as…
SkillDFreshness: D★ 33Claude Code +9 - 0.497score
vite-react-dev
JsonLee12138
资深 Vite-React 开发工程师,专精于 UnoCSS 原子化 CSS、Vite 工程化、Vitest 测试、React 现代开发模式和 TanStack 全家桶(Router/Query/Form/Table),具有丰富的 SPA 应用交付经验 Use when the user asks for…
SkillDFreshness: D★ 33Claude Code +9 - 0.497score
rules-writer
JsonLee12138
规则文件与 Provider 文件编写者,负责 .agents/rules/*.md、CLAUDE.md、AGENTS.md、GEMINI.md 的内容编写与维护 Use when the user asks for rules-writer-related work such as: markdown…
SkillDFreshness: D★ 33Claude Code +9 - 0.497score
pd
JsonLee12138
产品总监角色,精通产品战略、用户研究、优先级排序、路线图规划、SaaS 指标分析、研讨会引导和团队领导力发展,覆盖从发现到交付的完整产品管理生命周期 Use when the user asks for pd-related work such as: 产品战略与定位, 用户研究与客户发现, 优先级排序与路线图…
SkillDFreshness: D★ 33Claude Code +9 - 0.497score
growth-marketer
JsonLee12138
Growth marketing role for project promotion across social media platforms, content creation, and community engagement Use when the user asks for…
SkillDFreshness: D★ 33Claude Code +9
Signals
- Stars
- 33
- Forks
- 4
- Open issues
- 1
- Last commit (this folder)
- Mar 21, 2026 (7 months ago)
- Last release
- Mar 22, 2026 (7 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/JsonLee12138/agent-team
- Website
- role-hub.vercel.app/
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
Same skill elsewhere
Copies of this SKILL.md published by others; search shows only one of them.
- 0.502score
prompt-engineering-patterns
JsonLee12138
Master advanced prompt engineering techniques to maximize LLM performance, reliability, and controllability in production.
SkillDFreshness: D★ 33Claude Code +9 - 0.239score
prompt-engineering-patterns
archibate
Master advanced prompt engineering techniques to maximize LLM performance, reliability, and controllability in production.
SkillDFreshness: D★ 6Claude Code +9
More from JsonLee12138
- 0.507score
actions-npm
JsonLee12138
Use when creating or debugging GitHub Actions workflows that publish npm packages with trusted publishing / OIDC.
SkillCFreshness: C★ 2Claude Code +9 - 0.502score
task-splitting
JsonLee12138
Decompose requirement, design, or brainstorming documents into reviewable task drafts with one function per task and one file per task, then create…
SkillDFreshness: D★ 33Claude Code +9 - 0.502score
prompt-engineering-patterns
JsonLee12138
Master advanced prompt engineering techniques to maximize LLM performance, reliability, and controllability in production.
SkillDFreshness: D★ 33Claude Code +9 - 0.497score
mckinsey-consultant
JsonLee12138
McKinsey-style business consultant for hypothesis-driven problem solving, structured analysis, and strategic recommendations Use when the user asks for…
SkillDFreshness: D★ 33Claude Code +9 - 0.497score
pm
JsonLee12138
Full-stack product manager covering strategy, discovery, execution, go-to-market, market research, data analytics, marketing growth, and PM toolkit Use when…
SkillDFreshness: D★ 33Claude Code +9 - 0.497score
pencil-designer
JsonLee12138
Senior Pencil UI/UX Designer specializing in design systems, responsive interfaces, and accessible applications with mandatory Pencil MCP integration Use when…
SkillDFreshness: D★ 33Claude Code +9
Cite this page
prompt-engineering-patterns skill. Agent Mart. https://agentmart.dev/skills/jsonlee12138-prompt-engineering-patterns-bcf019 (last updated 2026-10-24)