Tips
Prompting Techniques
Chain-of-Thought
Force the model to show its work for complex reasoning
Make the model break down complex problems into explicit reasoning steps before answering. Dramatically improves accuracy on multi-step analysis, calculations, and strategic decisions.
- Add 'Let's think step by step' or 'Think through this step by step' to any prompt
- Model generates intermediate reasoning tokens before the final answer
- Each step provides context for the next, reducing logic errors
- Works best on problems with clear cause-and-effect relationships
CoT was originally observed in 100B+ parameter models, but modern architectures and training techniques (like distillation and fine-tuning) now enable effective CoT reasoning in much smaller models. Use with GPT-5.5, Claude Opus 4.8 / Sonnet 5, Gemini 3+, or their smaller variants.
Generated Knowledge
Dump relevant facts before reasoning
Two-step process: first ask the model to generate relevant knowledge, then use that knowledge as context for the actual task. Reduces hallucination by making supporting facts explicit.
- Step 1: Ask model to generate 5-10 relevant facts about the topic
- Step 2: Use those facts as context for your actual question
- Separates knowledge retrieval from reasoning
- Forces model to articulate what it knows before applying it
Grounding in explicit facts cuts hallucination. The model can't make up answers when it must first state what it knows.
Reflexion
Learn from failures with episodic memory
When the model fails or produces suboptimal output, prompt it to reflect on why it failed. Store reflections in memory. On next attempt, the model reviews past failures to avoid repeating mistakes.
- Model attempts task and either succeeds or fails
- If failed: prompt 'Why did this fail? What would you do differently?'
- Store reflection in a conversation memory buffer
- On retry: include past reflections in the prompt
- Model avoids repeating the same errors
- 1Attempt 1: Model tries task, fails
- 2Reflection: 'I failed because I didn't verify the data source'
- 3Attempt 2: Given reflection, model now checks data source first
- 4Result: Success through iterative self-correction
Advanced: Maintain a running 'lessons learned' document. Feed it back into future prompts to build institutional knowledge.
Graph of Thoughts
Merge parallel reasoning paths into unified solutions
Like Tree of Thoughts but reasoning paths can merge, not just branch. Allows brainstorming multiple ideas in parallel, developing them independently, then synthesizing into a final solution.
- Branch: Generate multiple independent reasoning paths
- Develop: Work on each path in parallel
- Aggregate: Merge insights from different paths
- Refine: Loop back to improve specific nodes
- Synthesize: Combine into unified final output
- 1Generate 3 marketing angles for product launch
- 2Develop each angle with supporting points
- 3Identify best elements from each angle
- 4Merge elements into one cohesive campaign message
- 5Refine the merged message for clarity
Limitation: Complex to manage manually. Best for high-value synthesis tasks, not routine work.
Few-Shot Prompting
Show 2-5 examples to enforce format and style
Provide 2-5 input-output examples before your actual task. The model pattern-matches to replicate the exact format, tone, and structure you want.
- Include 2-5 examples demonstrating the desired transformation
- Model's attention mechanism copies the pattern from examples
- Order matters: sometimes best examples last (recency bias)
- Each example should match the complexity of your real task
- 1Keep all examples in the same format
- 2Use diverse examples to show edge cases
- 3Match example tone to desired output tone
- 4Quality over quantity: 3 good examples beat 10 mediocre ones
Limitation: Adds token cost (examples in every request). For high-volume use, consider fine-tuning instead.
ReAct (Reason + Act)
Connect the model to tools and real-time data
Give the model access to tools (search, calculator, APIs). It decides when to use them, creating a loop: Thought, Action, Observation, repeat.
- Define available tools with clear descriptions
- Model generates a 'Thought' (what it needs to know)
- Model emits an 'Action' (tool name + parameters)
- System executes tool and returns 'Observation'
- Model uses observation in next thought, creating a reasoning loop
ReAct is a foundation of many tool-using AI agents (though many modern agents use native function-calling rather than literal ReAct). It significantly reduces hallucination by grounding responses in external data, though it does not eliminate hallucination entirely.
- 1Model reasons: 'I need current SERP data for this keyword'
- 2Action: SEMrush_API.get_keyword_difficulty('enterprise AI')
- 3Observation: 'KD: 85 (Very Hard). Related: AI agents KD: 45'
- 4Model adjusts strategy based on real data
Prompt Chaining
Break complex tasks into focused single-step prompts
Split monolithic tasks into a sequence of simple prompts where each output feeds into the next. Each step has one job, making the chain reliable and debuggable.
- Design each prompt to do ONE thing well
- Output of prompt N becomes input for prompt N+1
- Add validation steps between chains when needed
- Can branch or loop based on intermediate results
- 1Keep each step simple and focused
- 2Define clean handoffs between steps
- 3Include checkpoints for quality control
- 4Document the flow for team reuse
Advanced: Use chaining to insert human review steps. After Chain 2 (outline), get approval before Chain 3 (expensive full draft).
Tree of Thoughts
Explore multiple strategies, evaluate, and backtrack
Structure problem-solving as a search tree. Generate multiple options at each step, evaluate them, keep the best, and backtrack when paths fail. Like strategic planning or chess.
- Break challenge into decision points (nodes in a tree)
- At each node, generate 3-5 possible approaches (branches)
- Evaluate each branch's viability before proceeding
- Pursue the most promising path, backtrack if it fails
- Enables lookahead: simulate consequences before committing
- 1Define the strategic decision or creative challenge
- 2Branch: Generate multiple approaches at first decision point
- 3Evaluate: Score each branch (pros, cons, risks)
- 4Prune: Discard low-scoring branches
- 5Recurse: Continue branching on best path until solution emerges
Limitation: Token-intensive: generates multiple paths. Use for high-stakes decisions only, not routine tasks.
Self-Consistency Checks
Slash hallucinations by reconciling multiple answers
Prompt the model for multiple answers, then have it compare and reconcile them to slash hallucinations and boost accuracy.
- Generate 3-5 responses to the same prompt using higher temperature (0.7-1.0) for diversity
- Use majority voting: the most common answer wins for quantifiable outputs
- For open-ended tasks, use Universal Self-Consistency (USC): ask the LLM to judge its own multiple outputs and select the best one
- Combine with Chain-of-Thought prompting to expose different reasoning pathways
Program-of-Thought
Numerical precision through code execution
Tell the model to solve problems with code or math tools; numerical precision skyrockets when it writes and runs functions.
- Instead of having the LLM compute in natural language, instruct it to generate executable code (typically Python)
- The code is then run by an external interpreter for precise calculations
- Eliminates 'in-head' computation errors that plague Chain-of-Thought for math
Limitation: Only effective for quantitative/structured problems that can be represented as code.
Plan-and-Solve Workflow
Step-by-step planning for better results
Make the model outline a step-by-step plan before executing any task for clearer logic and better results.
- Phase 1: Have the model create a detailed plan with numbered steps
- Phase 2: Execute each step sequentially, checking results
- Phase 3: Evaluate and refine iteratively
- 1Define goal explicitly with scope and desired outcome
- 2Provide all relevant context and constraints upfront
- 3Specify output format requirements
- 4Use few-shot examples when possible
- 5Iterate: test, evaluate, refine, repeat
Structural Guardrails
A large portion of Claude's system prompt is guardrails for a reason
Wrap your instructions with explicit edge cases, fallbacks, and output formats. A large portion of Claude's system prompt is dedicated to guardrails for a reason.
Context Positioning & Negatives
Beginning and end matter most
Put mission-critical instructions near the beginning and end of the prompt and include 'don't do this' examples to avoid failure modes.
Everything is about providing the LLM guardrails. It's almost better for it to know what NOT to do than what to do.
- LLMs pay most attention to the beginning and end of prompts
- Place your most important instructions near the start (sets the frame)
- Repeat critical constraints near the end (recency bias)
- Middle sections can contain context, examples, and details
- Show the model what BAD output looks like, then good output
- 'Don't do this' examples prevent common failure modes
- Format: ❌ WRONG: [bad example] followed by ✅ RIGHT: [good example]
Meta-Prompting
The AI knows its capabilities better than you
Ask the model to critique, clarify, and suggest improvements to your prompt; it knows its own capabilities better than you do.
- Before using a prompt for its intended task, ask the LLM to analyze it
- The model can identify ambiguities, missing context, and potential misinterpretations
- Let the AI rewrite your prompt based on its self-knowledge
- 1Write your initial prompt
- 2Ask: 'Critique this prompt. What's unclear? What might cause you to fail?'
- 3Ask: 'Rewrite this prompt to be more effective for your capabilities'
- 4Compare and iterate
Reverse-Prompting
Learn from the AI's perspective
Ask the model to generate a prompt that achieves a specific outcome, then analyze the prompt for insights into its capabilities and limitations.
- Show the model the desired OUTPUT and ask it to generate the INPUT (prompt) that would produce it
- Reveals how the model 'thinks' about prompt-output relationships
- Uncovers hidden capabilities and optimal phrasing
Advanced: Chain reverse-prompting with meta-prompting: 1) Reverse-prompt to generate a prompt, 2) Meta-prompt to critique it, 3) Iterate to find the optimal structure.