prompt-engineering-patterns
Qué hace
Esta herramienta te ayuda a crear instrucciones mejores y más eficaces para las inteligencias artificiales. Enseña técnicas avanzadas para que la IA entienda exactamente lo que quieres y ofrezca respuestas más precisas y fiables.
Cuándo usarla
- ✓Cuando quieres que la IA genere respuestas más precisas.
- ✓Cuando estás creando un sistema de IA para tareas complejas.
- ✓Para que la IA siga un formato de respuesta concreto.
Link de la skill
https://github.com/wshobson/agents/blob/main/plugins/llm-application-dev/skills/prompt-engineering-patterns/SKILL.mdCópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.
Cómo usar
La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.
Mensaje listo para pegar
Para Claude Code, Codex o Cursor: ejecútalo en la carpeta del proyecto y la skill queda instalada.
Descarga el SKILL.md y ponlo en la carpeta de skills de tu agente.
Ejemplo de qué pedirle a la IA
“¿Cómo puedo mejorar este prompt para la IA: 'Escribe un resumen sobre la Segunda Guerra Mundial'?”
5 skills nuevas por semana. 1 minuto de lectura.
Cómo funciona
Funciona enseñando a la IA a pensar paso a paso, a usar ejemplos para aprender y a dar las respuestas con una estructura clara. Así la IA entiende mejor las instrucciones y comete menos errores.
Contenido técnico (SKILL.md original)
Texto original del autor, en inglés, directo de 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
- Be Specific: Vague prompts produce inconsistent results
- Show, Don't Tell: Examples are more effective than descriptions
- Use Structured Outputs: Enforce schemas with Pydantic for reliability
- Test Extensively: Evaluate on diverse, representative inputs
- Iterate Rapidly: Small changes can have large impacts
- Monitor Performance: Track metrics in production
- Version Control: Treat prompts as code with proper versioning
- 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
…
Preguntas frecuentes
¿Qué es 'Chain-of-Thought'?
Es una técnica en la que se pide a la IA que muestre su razonamiento paso a paso para llegar a una respuesta, como si pensara en voz alta.
¿Qué es 'Few-Shot Learning'?
Es cuando das unos pocos ejemplos de cómo quieres la respuesta antes de hacer la pregunta principal. La IA aprende de esos ejemplos.
¿Para qué sirven las 'Structured Outputs'?
Garantizan que la IA devuelva la información en un formato predecible, como JSON, para que otros programas puedan usarla más fácilmente.
Detalles
Descripción original del autor
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
Popularidad
- Estrellas en GitHub
- 41 mil
- Posición en el ranking
- #6724
- Licencia
- MIT
- Actualizada
- 15/10/2026
Comentarios
- …
Más skills de este repositorio
screen-reader-testing
41 milHace que tu agente pruebe sitios web con lectores de pantalla para comprobar que son accesibles.
wcag-audit-patterns
41 milAyuda a tu agente a auditar la accesibilidad de sitios web y a corregir problemas según las pautas WCAG.
multi-reviewer-patterns
41 milPermite a tu agente coordinar revisiones de código en paralelo, eliminando hallazgos duplicados y consolidando los informes.
parallel-debugging
41 milPermite a tu agente depurar problemas complejos con investigaciones en paralelo y análisis de causa raíz.
Skills parecidas
writing-skills
311 milEnseña a tu agente a escribir skills nuevas y a probar cada una primero, comprobando que realmente cambia la forma en que se comporta el agente.
writing-for-agents
310 milExplica cómo escribir instrucciones claras para agentes de IA, incluidas las skills y los archivos AGENTS.md y CLAUDE.md, para que el agente se comporte de forma predecible.
bengali-nlp
280 milHace que tu agente procese texto en bengalí. Ayuda a entender y trabajar con el idioma, normalizando el texto y gestionando sus características propias.