Optimize prompts for LLMs - structure, clarity, and effectiveness. Use when writing system prompts, designing AI features, or improving LLM interactions.
name prompt-engineering description Optimize prompts for LLMs - structure, clarity, and effectiveness. Use when writing system prompts, designing AI features, or improving LLM interactions. Prompt Engineering When to Use This Skill Writing system prompts for AI applications Designing AI-powered features Optimizing existing prompts for better results Reducing hallucinations and improving accuracy Building RAG systems or AI agents Core Principles
✅ Good: "Summarize this article in 3 bullet points, focusing on:
✅ Good: "You are a senior Python developer reviewing code for a production API. The following function handles user authentication. Review for security vulnerabilities and suggest fixes with explanations." 3. Use Examples (Few-Shot) Convert product descriptions to JSON format.
Example 1: Input: "Blue cotton t-shirt, size M, $29.99" Output: {"color": "blue", "material": "cotton", "type": "t-shirt", "size": "M", "price": 29.99}
Example 2: Input: "Red leather wallet, $45" Output: {"color": "red", "material": "leather", "type": "wallet", "price": 45}
Now convert: Input: "Black wool sweater, size L, $89.50" 4. Structured Output Analyze the following customer feedback and respond in this exact format:
SENTIMENT: [positive/negative/neutral] TOPICS: [comma-separated list] URGENCY: [low/medium/high] SUGGESTED_ACTION: [one sentence] SUMMARY: [2-3 sentences] Prompt Patterns Role Pattern You are an expert [ROLE] with [EXPERIENCE/QUALIFICATIONS]. Your task is to [SPECIFIC TASK]. Consider [CONSTRAINTS/REQUIREMENTS]. Example: You are a senior security engineer with 10 years of experience in web application security. Your task is to review this authentication code for vulnerabilities. Consider OWASP Top 10, common attack vectors, and secure coding best practices. Chain of Thought Solve this step by step:
Show your reasoning for each step. Self-Consistency Approach this problem from three different angles:
Then synthesize the insights into a final answer. Reflection Pattern After generating your response:
Mark corrections with [CORRECTED]. System Prompt Structure
You are [ROLE DESCRIPTION].
[BACKGROUND INFORMATION] [CONSTRAINTS] [USER CONTEXT]
[PRIMARY TASK] [SPECIFIC REQUIREMENTS] [OUTPUT FORMAT]
[GUIDELINE 3]
[EXAMPLE INPUT/OUTPUT PAIRS]
Never [PROHIBITED ACTION] Reducing Hallucinations Ground in Facts Answer based ONLY on the provided context. If the information is not in the context, say "I don't have enough information to answer this."
Context: [PROVIDED DOCUMENTS/DATA]
Question: [USER QUESTION] Require Citations For each claim you make, cite the source from the provided documents. Format: [CLAIM] (Source: [DOCUMENT NAME], Section: [SECTION])
If you cannot cite a source, prefix with "Based on general knowledge:" or don't include it. Confidence Levels Rate your confidence in each statement:
Format: [STATEMENT] [CONFIDENCE: HIGH/MEDIUM/LOW] Output Control Length Control Respond in exactly:
Instructions:
Context: {context}
Question: {question}
Answer: Multi-Document Synthesis Synthesize information from the following sources to answer the question.
Requirements:
Sources: {documents}
Question: {question} Agent Prompts Tool Use You have access to these tools: {tool_descriptions}
To use a tool, format your response as: THOUGHT: [Your reasoning about what to do] ACTION: [tool_name] INPUT: [tool input]
After receiving tool output: OBSERVATION: [What you learned] THOUGHT: [Next step reasoning] ...
When you have the final answer: THOUGHT: I now have enough information FINAL_ANSWER: [Your response to the user] Planning Before taking action, create a plan: