prompt-engineer
Prompt Engineering
Craft effective prompts for LLM applications.
When to Use
- Creating system prompts
- Improving AI output quality
- Building AI agents
- Optimizing token usage
- Designing prompt templates
Core Techniques
Role Setting
You are an expert [role] with [X] years of experience in [domain].
Your task is to [specific goal].
Chain of Thought
Think through this step by step:
1. First, analyze [aspect 1]
2. Then, consider [aspect 2]
3. Finally, determine [conclusion]
Show your reasoning before giving the final answer.
Few-Shot Examples
Here are examples of the expected format:
Input: [example 1 input]
Output: [example 1 output]
Input: [example 2 input]
Output: [example 2 output]
Now process this input:
Input: {user_input}
Output:
Structured Output
Respond in the following JSON format:
{
"analysis": "your analysis here",
"confidence": 0.0-1.0,
"recommendations": ["item1", "item2"]
}
Return valid JSON only, no additional text.
Prompt Templates
Code Review
You are a senior code reviewer. Review the code for:
1. Security vulnerabilities
2. Performance issues
3. Code quality and readability
4. Best practices violations
For each issue:
- Severity: Critical/High/Medium/Low
- Location: file:line
- Issue: description
- Fix: suggested solution
Code to review:
{code}
Data Extraction
Extract the following information from the text:
- Name: person's full name
- Email: email address
- Company: organization name
- Role: job title
If information is not found, use "NOT_FOUND".
Return as JSON.
Text:
{text}
Classification
Classify the following text into one of these categories:
- POSITIVE
- NEGATIVE
- NEUTRAL
Consider tone, sentiment, and overall message.
Respond with only the category name.
Text: {text}
Category:
Best Practices
| Practice | Do | Don't |
|---|---|---|
| Instructions | Be specific and explicit | Be vague |
| Format | Specify output format | Assume format |
| Examples | Include 2-3 examples | Zero-shot for complex |
| Constraints | Set clear boundaries | Leave open-ended |
| Length | Set max length if needed | Allow unlimited |
Testing Prompts
- Test with edge cases
- Try adversarial inputs
- Check consistency across runs
- Measure output quality
- Track token usage
Examples
Input: "Create a prompt for summarization" Action: Design prompt with length constraint, key points extraction, format spec
Input: "Improve this prompt's output" Action: Add examples, clarify instructions, specify format, test iterations
More from htlin222/dotfiles
cpp
Write modern C++ with RAII, smart pointers, and STL. Use for C++ development, memory safety, or performance optimization.
130refactor
Refactor code for quality and maintainability. Use for cleanup and tech debt reduction.
74data-science
Data analysis, SQL queries, BigQuery operations, and data insights. Use for data analysis tasks and queries.
52c-lang
Write efficient C code with proper memory management and system calls. Use for C optimization, memory issues, or system programming.
46quarto-book
Generate Quarto Book project structure with chapters, configuration, and output settings. Use when user wants to create a book, multi-chapter document, technical manual, or asks about Quarto book setup.
45scientific-figure-assembly
Assemble multi-panel scientific figures with panel labels (A, B, C) at publication quality (300 DPI) using R. Use when combining individual plots into journal-ready figures.
43