Prompt Engineering Guide: Advanced Techniques I Rely On Daily
Prompt Engineering Guide: Advanced Techniques I Rely On Daily
I write between 50 and 100 prompts per day. Some are quick queries to ChatGPT or Claude. Others are carefully crafted system prompts for production AI systems. Over the past two years I have developed a set of techniques that consistently produce better results than generic prompting.
These are not the "just ask nicely" tips you see everywhere. These are patterns I have tested across thousands of prompts and refined until they became part of my daily workflow.
The Role-Context-Task-Format Framework
Every serious prompt I write follows this structure:
Role: Who is the AI? "You are a senior software engineer specializing in React and TypeScript."
Context: What is the situation? "We are building a dashboard component that displays real-time analytics data. The component needs to handle WebSocket connections and gracefully degrade when the connection drops."
Task: What specifically should the AI do? "Refactor this component to separate the WebSocket logic from the rendering logic using a custom hook."
Format: How should the output look? "Provide the complete refactored code with TypeScript types, comments explaining key decisions, and a brief summary of what changed."
This framework sounds basic, but the discipline of filling in all four sections for every prompt dramatically improves output quality. Most bad results come from skipping the Role or Format sections.
Chain-of-Thought for Complex Reasoning
When I need the model to reason through a problem, I explicitly tell it to think step by step. But I go further than that.
I use structured chain-of-thought prompts where I define the reasoning steps myself:
"Analyze this problem by completing these steps in order:
- Identify the core requirements
- List potential approaches with pros and cons
- Evaluate each approach against the requirements
- Recommend the best approach with justification"
By defining the reasoning structure, I get more consistent and thorough analysis than a generic "think step by step" instruction.
Negative Instructions Work Better Than Positive Ones
I learned this from testing. Telling a model what NOT to do is often more effective than telling it what to do.
Instead of "Write a professional email," I write "Write an email. Do not use exclamation marks. Do not use emojis. Do not use phrases like 'I hope this finds you well.' Keep sentences under 25 words."
The specificity of negative constraints eliminates common failure modes that positive instructions leave open. I use this pattern for all writing tasks now.
Few-Shot Examples for Format Compliance
When I need a specific output format, providing one or two examples is more effective than describing the format in words.
If I want JSON output with specific fields, I include a complete example in the prompt. If I want a specific writing style, I include a paragraph written in that style. The model pattern-matches from examples more reliably than it follows verbal descriptions of patterns.
I keep a library of example outputs for common tasks. When I need a new prompt, I grab the relevant examples from my library and include them directly in the prompt.
Temperature Selection by Task
Most people leave temperature at the default. I adjust it deliberately based on the task:
Temperature 0: Code generation, data extraction, factual queries, any task where consistency matters more than creativity. At temperature 0, the model produces nearly deterministic output.
Temperature 0.3-0.5: Summarization, analysis, technical writing. Some variation is acceptable but I want the model to stay grounded.
Temperature 0.7-0.9: Creative writing, brainstorming, marketing copy. Higher temperature produces more varied and creative output.
Temperature 1.0+: Ideation and exploration phases where I want unexpected connections and novel ideas. The output is less reliable but more surprising.
The "Ask Me Questions" Pattern
For complex tasks where I might not have provided all necessary information, I add this instruction at the end of my prompt:
"Before generating a complete response, ask me 3-5 clarifying questions about anything that is ambiguous or missing from my request. Wait for my answers before proceeding."
This single instruction has saved me from dozens of poorly specified prompts. The model identifies gaps in my instructions that I missed, and I can fill them before wasting tokens on an irrelevant response.
System Prompts for Persistent Behavior
For production systems, I invest heavily in the system prompt. The system prompt sets the model's behavior for an entire conversation, so it is worth making it thorough.
My system prompts typically include: the role and expertise level, specific knowledge boundaries, output format requirements, tone and style guidelines, things the model should never do, and handling instructions for edge cases.
A good system prompt is usually 200-500 words. Short system prompts leave too much behavior undefined. Long system prompts (over 1000 words) tend to lose focus as the model cannot attend to all instructions equally.
Iterative Refinement
My most important technique is iterative refinement. I rarely get the perfect prompt on the first try. I write a prompt, review the output, identify what is wrong, adjust the prompt, and try again.
I keep a log of my prompts and their results. When I find a pattern that works, I save it. When I encounter a failure mode, I note what went wrong and what fix worked. Over time, this library of patterns makes me faster and more effective at writing new prompts.
Comments
No comments yet. Be the first to share your thoughts!
Related Articles
Stay ahead of the curve
Get the latest insights on AI, technology, and innovation delivered weekly.
