Skip to main content
This appendix provides reusable prompt templates and patterns for common agentic operations.

System Prompt Structure

The system prompt establishes identity, capabilities, and constraints.
Example:

Few-Shot Pattern

Show examples before requesting completion.
Example - Classification:

Chain of Thought

Request explicit reasoning before conclusions.
Example:

Structured Output

Request specific JSON or formatted output.
Example:

Evaluation and Critique

Request assessment of content quality.
Example:

Decomposition

Break complex tasks into subtasks.
Example:

Synthesis

Combine multiple inputs into coherent output.
Example:

Error Analysis

Transform errors into actionable fixes.
Example:
Provide:
  1. Root cause (what specifically went wrong)
  2. Fix (exact changes needed)
  3. Prevention (how to avoid this in future)
You are an expert [specialist type] with deep knowledge of:
  • [domain knowledge 1]
  • [domain knowledge 2]
Your task is to [specific task]. Approach this as a [specialist] would:
  • [characteristic behavior 1]
  • [characteristic behavior 2]
[Specific instructions for the task]
You are an expert code reviewer with deep knowledge of:
  • TypeScript best practices
  • React performance optimization
  • Security vulnerabilities in web applications
Your task is to review this pull request for issues. Approach this as a senior engineer would:
  • Focus on correctness, security, and maintainability
  • Suggest improvements, not just flag problems
  • Prioritize issues by severity
Review this code and categorize findings as:
  • Critical: Must fix before merge
  • Important: Should fix, can merge with follow-up
  • Suggestion: Nice to have improvements
[Code to review]
Based ONLY on the following information, [task]: Information: [provided context] Rules:
  • Only use facts from the provided information
  • If the information doesn’t address something, say so explicitly
  • Do not use general knowledge unless it’s to clarify provided facts
  • Cite specific parts of the information when making claims
Based ONLY on the following product documentation, answer the customer’s question: Documentation: """ The Pro plan includes 100GB storage, unlimited projects, and priority support. The Team plan includes everything in Pro plus SSO, audit logs, and a dedicated account manager. All plans include a 14-day free trial. Annual billing provides a 20% discount. """ Rules:
  • Only use facts from the provided documentation
  • If the documentation doesn’t address something, say “I don’t have information about that” and suggest contacting support
  • Do not make assumptions about features not explicitly mentioned
Customer question: “Does the Pro plan include SSO?”
You are a prompt engineering expert. Given this prompt and its performance, suggest improvements: Current prompt: [prompt text] Performance issues: [what’s not working well] Desired outcome: [what we want to achieve] Suggest a revised prompt that addresses these issues while maintaining the original intent. Explain why your changes should improve performance.
[Task instructions] After completing the task, provide:
  1. Your response/output
  2. Confidence level (0-100%)
  3. What would increase your confidence
  4. What could be wrong with your response
Be well-calibrated: high confidence should mean high accuracy, uncertainty should be expressed as low confidence.
Classify this customer inquiry and suggest a response. Inquiry: “Why did my order arrive damaged?” After classification, provide:
  1. Category and suggested response
  2. Confidence level (0-100%)
  3. What additional information would increase confidence
  4. What assumptions might be wrong
Be well-calibrated: express genuine uncertainty when the inquiry is ambiguous.