Prompt Engineering - One Sheet
A practical reference guide for structuring prompts that produce more reliable, useful AI outputs.
Good prompting is less about clever wording and more about providing structure, context, and constraints so the model can produce predictable results.
🎭 Personas
What It Is
A persona prompt defines who the AI should act as and who the response is intended for. This establishes expertise level, communication style, and priorities.
Instead of answering generically, the model frames its response through the perspective of a specific role (for example: architect, teacher, product manager, or reviewer).
Why It Helps
Large language models are trained on many different writing styles and expertise levels. Without guidance, responses often default to generic explanations.
A persona prompt helps by:
Setting the expertise level (senior engineer vs beginner teacher)
Adjusting the tone and style of the output
Prioritizing relevant concerns (performance, usability, security, etc.)
Making responses consistent across multiple prompts
When To Use
Personas are especially useful for:
Code reviews
Technical documentation
Educational explanations
Product design discussions
Architecture evaluations
Example
You are a senior software architect reviewing code written by junior developers.
Explain the performance issues in this React component and suggest improvements.
Use clear explanations that help the developer learn rather than just listing problems.📝 Few-Shot Prompting
What It Is
Few-shot prompting means providing a few examples of the desired output format so the model can imitate the structure, tone, and reasoning pattern.
Instead of describing what you want abstractly, you demonstrate it directly.
Why It Helps
Models are extremely good at pattern imitation. Showing examples often works better than explaining rules.
Few-shot prompting helps:
Establish formatting conventions
Clarify expectations
Reduce ambiguity
Improve consistency across outputs
Including good vs bad examples is especially effective because it highlights what should be avoided.
When To Use
Few-shot prompting works well for:
Structured reviews
Summaries
Classification tasks
Writing formats (reports, comments, documentation)
Generating standardized outputs
Example
Format code review comments like this:
Good:
❌ Issue: Variable name 'x' is unclear
💡 Suggestion: Rename to 'userId' for clarity
✅ Impact: Improves readability
Now review this function:
[paste code]The model will typically replicate the same structure and tone.
🔗 Chain-of-Thought
What It Is
Chain-of-thought prompting asks the model to explicitly reason through a problem step-by-step before producing the final answer.
This introduces a planning stage that helps avoid skipped steps or shallow reasoning.
Why It Helps
When prompts request a final result immediately, models sometimes:
Skip intermediate reasoning
Miss important assumptions
Produce incomplete outputs
Chain-of-thought prompts encourage the model to:
Break down the task logically
Surface assumptions
Reduce reasoning errors
Produce more structured responses
When To Use
Chain-of-thought is particularly helpful for:
Complex reasoning
Architecture decisions
Debugging problems
Multi-step tasks
Analytical writing
Example
Before writing the API documentation:
1. List the main endpoints and their purposes
2. Identify required vs optional parameters
3. Note common error scenarios
Then write the documentation using this structure.🌲 Tree-of-Thought
What It Is
Tree-of-thought prompting asks the model to generate multiple possible approaches and evaluate them before selecting the best option.
Instead of committing to the first idea, the model explores alternatives and compares them using defined criteria.
Why It Helps
Many AI responses default to the first plausible answer, even if better options exist.
Tree-of-thought prompting improves results by:
Encouraging exploration of multiple solutions
Introducing evaluation criteria
Making tradeoffs explicit
Improving decision quality
When To Use
This technique works well for:
System design decisions
Architecture planning
Technology selection
Strategy comparisons
Problem solving with multiple valid solutions
Example
Generate three approaches for implementing user authentication:
1. Approach A
2. Approach B
3. Approach C
Evaluate each approach on:
- Security (1–5)
- Implementation complexity (1–5)
- User experience (1–5)
Recommend the best approach and explain why.⚙️ Prompt Parameters (Templates)
What It Is
Parameterized prompts turn prompts into reusable templates with configurable inputs.
This separates the logic of the prompt from the specific values used in each instance.
You can think of this like a function for prompts.
Why It Helps
Prompt parameters make prompts:
Reusable across different tasks
Easier to maintain
Easier to adapt to different audiences
More scalable for teams
Instead of rewriting prompts repeatedly, you simply adjust the variables.
When To Use
Parameterization works well for:
Internal prompt libraries
Repeated workflows
Documentation generation
Code review templates
AI-powered tooling
Example
Review this {CODE_TYPE} code for {AUDIENCE} focusing on {PRIORITY}.
Style: {TONE}
Length: {MAX_WORDS} words
CODE_TYPE = "React component"
AUDIENCE = "junior developers"
PRIORITY = "performance"
TONE = "educational"
MAX_WORDS = 200✅ Checklists
What It Is
Checklist prompts instruct the model to track progress through a structured list of tasks, marking them complete as it works.
This creates visible structure and ensures the response covers all required sections.
Why It Helps
Without constraints, models sometimes:
Skip sections
Forget requirements
Produce incomplete outputs
Checklists help ensure:
Full coverage of the task
Clear structure
Visible progress tracking
When To Use
Checklists are useful for:
Documentation generation
Audits or reviews
Step-by-step guides
QA processes
Structured reports
Example
Create API documentation using this checklist:
[ ] Overview and purpose
[ ] Authentication requirements
[ ] Endpoint list with methods
[ ] Request/response examples
[ ] Error codes and handling
[ ] Rate limits and quotas
[ ] Code samples in 2+ languages
Mark each item [✓] as you complete it.🔄 Prompt Chains
What It Is
Prompt chaining breaks a large task into multiple smaller prompts that build on each other.
Each stage produces a concrete output that becomes the input for the next stage.
Why It Helps
Complex prompts often fail because they attempt to do too many things at once.
Prompt chaining improves reliability by:
Breaking complex problems into manageable steps
Making intermediate outputs visible
Allowing corrections before moving forward
Improving reasoning quality
When To Use
Prompt chains are effective for:
Codebase analysis
Refactoring plans
Research summaries
Design documents
Large writing projects
Example
Stage 1 — Analyze Codebase Structure
Output: List of modules and dependencies
Stage 2 — Identify Code Smells
Output: Prioritized list of issues
Stage 3 — Propose Refactoring Plan
Output: Step-by-step plan
Stage 4 — Generate Refactored Code
Output: Updated implementation
Stage 5 — Create Migration Guide
Output: Documentation for adopting the new structure
💡 Pro Tips
Combine Techniques
The most effective prompts often combine several techniques.
Example:
Persona → defines expertise
Few-shot → defines format
Checklist → ensures completeness
Start Simple, Then Add Structure
If the output drifts or becomes inconsistent, introduce more structure:
add examples
add steps
add constraints
Build a Prompt Library
Save successful prompts so they can be reused by your team. Over time this becomes a prompt toolkit for common workflows.
Treat Prompts Like Code
Prompts benefit from the same practices as software:
reuse
versioning
refactoring
documentation