Enhanced prompt engineering with model-specific optimization, advanced techniques, and evaluation metrics.
TaskTechniqueTemplateCode reviewRole + constraintsReview this [language] code for...Content writingAudience + toneWrite a [type] about [topic] for [audience]Image generationSubject + style + composition[Subject], [style], [lighting], [quality]Data extractionSchema + examplesExtract fields matching this schema...AnalysisStep-by-stepAnalyze [data] by [method]
text
[Role/Context] + [Task] + [Constraints] + [Output Format]
python
# Expert role
"You are a senior software engineer with 15 years of experience in [domain]."
# Teaching role
"You are a patient teacher explaining [topic] to a beginner."
# Critic role
"You are a constructive critic reviewing [work] with specific feedback."
python
# Explicit steps
"Think through this step by step before giving the final answer."
# Structured reasoning
"1. First, identify the key facts...
2. Then, analyze the relationships...
3. Finally, draw conclusions..."
python
# Example format
"Convert these sentences to formal business English:
Example 1:
Input: gonna send u the report tmrw
Output: I will send you the report tomorrow.
Example 2:
Input: cant make the meeting, something came up
Output: I apologize, but I will be unable to attend the meeting due to an unforeseen circumstance.
Now convert:
Input: hey can we push the deadline back a bit?"
python
# JSON schema
"Return a JSON array with objects containing 'text', 'sentiment' (positive/negative/neutral), and 'confidence' (0-1)."
# Structured output
"For each issue found, provide:
- Line number
- Issue description
- Severity (high/medium/low)
- Suggested fix"
python
# Word limits
"Summarize in exactly 3 bullet points, each under 20 words."
# Format constraints
"Return only valid JSON, no explanation."
# Content constraints
"Focus only on actionable insights, not background information."
text
[Subject] + [Style] + [Composition] + [Lighting] + [Technical]
python
# Photography
"shot on Kodak Portra 400 film, soft natural lighting, shallow depth of field"
# Digital art
"digital painting, concept art, artstation, trending"
# Oil painting
"oil painting, masterpiece, classical, detailed brushwork"
# 3D render
"3D render, octane render, cinema 4D, detailed"
python
# High quality
"photorealistic, 8K, ultra detailed, sharp focus, professional, masterpiece"
# Artistic
"intricate details, award-winning, best quality"
# Technical
"high resolution, 4K, detailed texture, sharp"
python
# Common negatives
"blurry, distorted, extra limbs, watermark, text, low quality, cartoon, anime"
# Photography negatives
"overexposed, underexposed, grainy, noisy, artifacts"
# Art negatives
"ugly, deformed, disfigured, poor proportions, bad anatomy"
text
[Shot Type] + [Subject] + [Action] + [Setting] + [Style]
python
# Tracking
"Slow tracking shot following [subject] through [setting]"
# Pan
"Smooth pan across [scene] revealing [subject]"
# Zoom
"Slow zoom into [subject] with [effect]"
# Handheld
"Handheld camera following [subject] with natural movement"
python
# Speed
"slow motion, timelapse, real-time, smooth motion"
# Duration
"continuous shot, quick cuts, frozen moment"
# Transitions
"dissolve, fade, wipe, morph"
MetricDescriptionMeasurementClarityHow clear is the prompt?1-5 ratingSpecificityHow specific are the instructions?Word count, detail levelConsistencyHow consistent are results?Variance across runsQualityHow good is the output?Manual review
python
# Basic prompt
"Write a summary of this article."
python
# More specific
"Write a 3-sentence summary of this article, focusing on key findings."
python
# With constraints
"Write a 3-sentence summary of this article, focusing on key findings. Use formal business English. Include specific statistics if mentioned."
python
# With examples
"Write a 3-sentence summary of this article, focusing on key findings. Use formal business English. Include specific statistics if mentioned.
Example:
Input: 'Study finds 85% of users prefer interface X over Y.'
Output: 'A recent study reveals that 85% of users demonstrate a preference for Interface X compared to Interface Y. The findings suggest significant usability advantages for Interface X. This data should inform future interface design decisions.'"
python
# Refined prompt
"Write a 3-sentence summary of this article, focusing on key findings. Use formal business English. Include specific statistics if mentioned. Avoid technical jargon. Start with the most important finding.
Example:
Input: 'Study finds 85% of users prefer interface X over Y.'
Output: 'A recent study reveals that 85% of users demonstrate a preference for Interface X compared to Interface Y. The findings suggest significant usability advantages for Interface X. This data should inform future interface design decisions.'"
MistakeProblemFixToo vagueUnpredictable outputAdd specificsToo longModel loses focusPrioritize key infoConflictingConfuses modelRemove contradictionsNo formatInconsistent outputSpecify formatNo examplesUnclear expectationsAdd few-shot
python
"Review this [language] code for:
1. Bugs and logic errors
2. Security vulnerabilities
3. Performance issues
4. Code style/best practices
Code:
[code]
For each issue found, provide:
- Line number
- Issue description
- Severity (high/medium/low)
- Suggested fix"
python
"Write a [content type] about [topic].
Audience: [target audience]
Tone: [formal/casual/professional]
Length: [word count]
Key points to cover:
1. [point 1]
2. [point 2]
3. [point 3]
Include: [specific elements]
Avoid: [things to exclude]"
python
"Analyze this data:
[data]
Provide:
1. Key insights (3-5 findings)
2. Patterns or trends
3. Anomalies or outliers
4. Recommendations based on findings
Use statistical terms where appropriate. Include confidence levels for key claims."
python
"[Subject with details], [setting/background], [lighting type],
[art style or photography style], [composition], [quality keywords]"