Prompt Patterns Library

Research-backed frameworks for effective AI communication. These patterns are proven techniques to understand and adapt for your specific needs.

AI for Everybody Built With UD/UDL Security A+ 100% Performance 100% AI Assisted Building Claude Code Community GitHub

Browse Prompt Patterns

Select a category to filter patterns by type, or browse all available frameworks.

Chain of Thought

Reasoning

Encourage step-by-step reasoning by asking AI to "think through" problems before answering. This approach significantly improves accuracy on complex tasks.

How to use:

"Let's think through this step by step..." or "Walk me through your reasoning."

Best for: Math, logic puzzles, complex analysis, debugging

Few-Shot Learning

Output

Provide a few examples of the input-output format you want before your actual request. This leverages the AI's pattern recognition capabilities.

How to use:

"Example 1: [input] → [output]. Example 2: [input] → [output]. Now do: [your input]"

Best for: Consistent formatting, classification, translation

Role Prompting

Role

Assign AI a specific role or expertise to shape its responses and vocabulary. This activates domain-specific knowledge patterns.

How to use:

"You are an experienced [role] who specializes in [domain]..."

Best for: Technical writing, advice, specialized content

Structured Output

Output

Define the exact format you want (JSON, table, outline) before the request. Clear structure reduces ambiguity and improves usability.

How to use:

"Return your response in this format: {title: ..., summary: ..., points: [...]}"

Best for: Data extraction, API integration, consistent reports

Self-Consistency

Reasoning

Ask AI to verify its own work or approach a problem multiple ways and compare. This catches errors and increases confidence in results.

How to use:

"After your answer, verify it's correct." or "Solve this two different ways."

Best for: Math, fact-checking, critical decisions

Prompt Chaining

Reasoning

Break complex tasks into sequential prompts where each output feeds the next input. This manages complexity and maintains quality.

How to use:

1. Research → 2. Outline → 3. Draft → 4. Edit (separate prompts)

Best for: Long documents, research, multi-step workflows

Devil's Advocate

Role

Ask AI to argue against a position or find weaknesses in an idea. This surfaces blind spots and strengthens decision-making.

How to use:

"Play devil's advocate and critique this plan." or "What could go wrong?"

Best for: Decision making, risk assessment, strengthening arguments

Constraints First

Output

State limitations and requirements before the main request to frame the response. Front-loading constraints prevents wasted generation.

How to use:

"Constraints: 200 words max, no jargon, audience is beginners. Task: Explain..."

Best for: Length control, audience targeting, style consistency

Flipped Interaction

Interaction

Ask AI to interview you first before giving advice. This prevents generic responses and yields personalized outputs.

How to use:

"Before answering, ask me 5 questions to understand my situation better."

Best for: Personalized advice, complex decisions, strategic planning
Learn Flipped Interaction

Pattern Selection Guide

Use this guide to select the right pattern for your task type.

Task Type Recommended Pattern Why It Works Example Use
Problem Solving Chain of Thought Forces step-by-step reasoning Debugging code, math problems
Consistent Formatting Few-Shot Learning Demonstrates exact output pattern Data transformation, templates
Expert Knowledge Role Prompting Activates domain-specific responses Technical writing, consulting
Data Integration Structured Output Ensures machine-readable format API responses, reports
High-Stakes Decisions Self-Consistency Validates through multiple approaches Financial analysis, diagnostics
Large Projects Prompt Chaining Breaks complexity into manageable steps Research papers, long documents
Risk Assessment Devil's Advocate Surfaces hidden problems Business plans, proposals
Targeted Content Constraints First Prevents off-target responses Social media posts, emails
Personalized Advice Flipped Interaction Gathers context before responding Career guidance, planning

Patterns in Action

See how these patterns transform real-world AI interactions.

📊

From Vague to Valuable

The Challenge: A marketing manager asked AI to "write some social media posts" and received generic, unusable content.

Pattern Applied: Constraints First + Few-Shot Learning

New Prompt: "Constraints: 280 characters max, conversational tone, include one emoji, target audience is small business owners. Examples: [example 1] [example 2]. Now write 5 posts about our new scheduling feature."

Result: All 5 posts were within character limit, on-brand, and ready to use with minimal editing.
🔍

Debugging Made Systematic

The Challenge: A developer pasted error-prone code and asked "why isn't this working?" The AI's response was superficial.

Pattern Applied: Chain of Thought + Self-Consistency

New Prompt: "Let's debug this step by step. First, trace the data flow. Then identify where the expected behavior diverges from actual. Finally, verify your diagnosis by explaining what the fix would change."

Result: AI identified a race condition that wasn't obvious from the error message alone, with clear explanation of the fix.
🎯

Career Guidance Personalized

The Challenge: A professional asked "should I change careers?" and got generic advice that could apply to anyone.

Pattern Applied: Flipped Interaction

New Prompt: "I'm considering a career change. Before giving advice, interview me: ask about my current role, what I enjoy vs. what drains me, my financial situation, and my risk tolerance."

Result: After gathering context, AI provided specific, actionable advice that acknowledged their unique constraints and goals.

How to Use These Patterns

These patterns are principles, not scripts. Understand why they work, then adapt them to your needs.

💡

Understand, Don't Copy

Patterns are frameworks to internalize, not templates to paste. Learn the principle behind each pattern so you can adapt it naturally.

🔗

Combine Patterns

Patterns work well together. Use Role + Chain of Thought for expert analysis, or Few-Shot + Structured Output for consistent formatting.

🔄

Iterate and Refine

Start with a pattern, see what works, then adjust. The best prompts come from experimentation and learning from each interaction.

⚖️

Match Complexity to Need

Not every task needs every pattern. Simple questions don't need Chain of Thought. Match the pattern's complexity to your task's requirements.

📈

Build Your Library

Keep examples of prompts that worked well for you. Over time, you'll develop personal variations that fit your communication style.

🎓

Learn the Methods

These patterns are building blocks. Learn complete methodologies like CRISP, COSTAR, and ReAct to combine patterns into powerful frameworks.

Common Pitfalls to Avoid

Over-Engineering Simple Tasks

Don't use Chain of Thought for "What's the capital of France?" Match complexity to need—simple questions deserve simple prompts.

Ignoring Context Windows

Very long few-shot examples can crowd out your actual question. Keep examples concise and relevant to leave room for quality responses.

Conflicting Instructions

Asking AI to be "detailed but brief" or "formal but conversational" creates confusion. Be clear about your priorities.

Pro Tip: The Two-Prompt Test

If your first prompt doesn't work well, try a completely different pattern instead of just tweaking words. Sometimes a fresh approach works better than iteration.

Put Patterns Into Practice

Learn the methodologies that combine these patterns, or test your prompts with our Analyzer tool.