--- name: create-prompt description: Expert prompt engineering for creating effective prompts for Claude, GPT, and other LLMs. Use when writing system prompts, user prompts, few-shot examples, or optimizing existing prompts for better performance. --- Create highly effective prompts using proven techniques from Anthropic and OpenAI research. This skill covers all major prompting methodologies: clarity, structure, examples, reasoning, and advanced patterns. Every prompt created should be clear, specific, and optimized for the target model. 1. **Clarify purpose**: What should the prompt accomplish? 2. **Identify model**: Claude, GPT, or other (techniques vary slightly) 3. **Select techniques**: Choose from core techniques based on task complexity 4. **Structure content**: Use XML tags (Claude) or markdown (GPT) for organization 5. **Add examples**: Include few-shot examples for format-sensitive outputs 6. **Define success**: Add clear success criteria 7. **Test and iterate**: Refine based on outputs Every effective prompt has: ```xml Background information the model needs Clear, specific instruction of what to do - Specific constraints - Output format - Edge cases to handle Input/output pairs demonstrating expected behavior How to know the task was completed correctly ``` **Priority**: Always apply first - State exactly what you want - Avoid ambiguous language ("try to", "maybe", "generally") - Use "Always..." or "Never..." instead of "Should probably..." - Provide specific output format requirements See: [references/clarity-principles.md](references/clarity-principles.md) **When**: Claude prompts, complex structure needed Claude was trained with XML tags. Use them for: - Separating sections: ``, ``, `` - Wrapping data: ``, ``, `` - Defining boundaries: Clear start/end of sections See: [references/xml-structure.md](references/xml-structure.md) **When**: Output format matters, pattern recognition easier than rules Provide 2-4 input/output pairs: ```xml User clicked signup button track('signup_initiated', { source: 'homepage' }) ``` See: [references/few-shot-patterns.md](references/few-shot-patterns.md) **When**: Complex reasoning, math, multi-step analysis Add explicit reasoning instructions: - "Think step by step before answering" - "First analyze X, then consider Y, finally conclude Z" - Use `` tags for Claude's extended thinking See: [references/reasoning-techniques.md](references/reasoning-techniques.md) **When**: Setting persistent behavior, role, constraints System prompts set the foundation: - Define Claude's role and expertise - Set constraints and boundaries - Establish output format expectations See: [references/system-prompt-patterns.md](references/system-prompt-patterns.md) **When**: Enforcing specific output format (Claude-specific) Start Claude's response to guide format: ``` Assistant: {"result": ``` Forces JSON output without preamble. **When**: Long-running tasks, multi-session work, large context usage For Claude 4.5 with context awareness: - Inform about automatic context compaction - Add state tracking (JSON, progress.txt, git) - Use test-first patterns for complex implementations - Enable autonomous task completion across context windows See: [references/context-management.md](references/context-management.md) **Gather requirements** using AskUserQuestion: 1. What is the prompt's purpose? - Generate content - Analyze/extract information - Transform data - Make decisions - Other 2. What model will use this prompt? - Claude (use XML tags) - GPT (use markdown structure) - Other/multiple 3. What complexity level? - Simple (single task, clear output) - Medium (multiple steps, some nuance) - Complex (reasoning, edge cases, validation) 4. Output format requirements? - Free text - JSON/structured data - Code - Specific template **Draft the prompt** using this template: ```xml [Background the model needs to understand the task] [Clear statement of what to accomplish] [Step-by-step process, numbered if sequential] [Rules, limitations, things to avoid] [Exact structure of expected output] [2-4 input/output pairs if format matters] [How to verify the task was done correctly] ``` **Apply relevant techniques** based on complexity: - **Simple**: Clear instructions + output format - **Medium**: Add examples + constraints - **Complex**: Add reasoning steps + edge cases + validation **Review checklist**: - [ ] Is the task clearly stated? - [ ] Are ambiguous words removed? - [ ] Is output format specified? - [ ] Are edge cases addressed? - [ ] Would a person with no context understand it? ❌ "Help with the data" ✅ "Extract email addresses from the CSV, remove duplicates, output as JSON array" ❌ "Don't use technical jargon" ✅ "Write in plain language suitable for a non-technical audience" ❌ Describing format in words only ✅ Showing 2-3 concrete input/output examples ❌ "Process the file" ✅ "Process the file. If empty, return []. If malformed, return error with line number." See: [references/anti-patterns.md](references/anti-patterns.md) **Core principles:** - [references/clarity-principles.md](references/clarity-principles.md) - Being clear and direct - [references/xml-structure.md](references/xml-structure.md) - Using XML tags effectively **Techniques:** - [references/few-shot-patterns.md](references/few-shot-patterns.md) - Example-based prompting - [references/reasoning-techniques.md](references/reasoning-techniques.md) - Chain of thought, step-by-step - [references/system-prompt-patterns.md](references/system-prompt-patterns.md) - System prompt templates - [references/context-management.md](references/context-management.md) - Context windows, long-horizon reasoning, state tracking **Best practices by vendor:** - [references/anthropic-best-practices.md](references/anthropic-best-practices.md) - Claude-specific techniques - [references/openai-best-practices.md](references/openai-best-practices.md) - GPT-specific techniques **Quality:** - [references/anti-patterns.md](references/anti-patterns.md) - Common mistakes to avoid - [references/prompt-templates.md](references/prompt-templates.md) - Ready-to-use templates A well-crafted prompt has: - Clear, unambiguous objective - Specific output format with example - Relevant context provided - Edge cases addressed - No vague language (try, maybe, generally) - Appropriate technique selection for task complexity - Success criteria defined