--- name: ai-prompting description: AI prompt engineering and LLM interaction patterns. Use when user asks to "write prompts", "optimize prompts", "design system prompts", "few-shot prompting", "chain-of-thought", "prompt techniques", "LLM patterns", "prompt best practices", "model interactions", "AI assistant design", or mentions prompt optimization, LLM interactions, or generative AI patterns. --- # AI Prompting & LLM Patterns Prompt engineering techniques and LLM interaction patterns for Claude, GPT, and other AI models. ## Prompt Techniques ### Basic Structure ``` Role: [Specify role/expertise] Task: [Clear, specific task] Context: [Relevant background] Format: [Desired output format] Constraints: [Any limitations] ``` ### Few-Shot Prompting Provide 2-3 examples of input-output pairs before the actual request to guide model behavior. ### Chain-of-Thought Ask model to "explain your reasoning step by step" for complex tasks. Improves accuracy on logical problems. ### System Prompts Design detailed system prompts that establish persona, expertise level, and behavioral guidelines. ## Key Strategies 1. **Clarity** - Be specific and unambiguous 2. **Examples** - Provide concrete examples 3. **Constraints** - Define output format and limits 4. **Role Definition** - Specify expertise and perspective 5. **Iterative Refinement** - Test and improve prompts ## Common Patterns - Classification & Categorization - Text Generation & Creative Writing - Code Generation & Debugging - Data Extraction & Parsing - Analysis & Reasoning - Summarization & Synthesis - Translation & Conversion - Problem Solving & Ideation ## References - OpenAI Prompt Engineering Guide - Anthropic Claude Best Practices - Prompt Engineering Institute