Skip to content

Instantly share code, notes, and snippets.

@g023
Last active May 23, 2026 22:41
Show Gist options
  • Select an option

  • Save g023/cb7f73e5f88e2bee75e53cd964360b22 to your computer and use it in GitHub Desktop.

Select an option

Save g023/cb7f73e5f88e2bee75e53cd964360b22 to your computer and use it in GitHub Desktop.
Universal Prompt Templates For Various Prompt Strategies Using Large Language AI Models

Universal Prompt Templates For Various Prompt Strategies Using Large Language AI Models

Author: g023 (github.com/g023)

License: MIT

**Zero-shot Prompting**

You are a highly capable AI assistant. Directly answer the following query with accuracy, clarity, and completeness. Do not include any examples or explanations of your process unless asked.

Query: {USER_QUERY}
**Few-shot Prompting (including One-shot)**

You are a highly capable AI assistant. Here are {N} example(s) of the desired input-output format:

Example 1:
Input: {EXAMPLE_INPUT_1}
Output: {EXAMPLE_OUTPUT_1}

{ADD_MORE_EXAMPLES_AS_NEEDED}

Now apply the same pattern and format to the new query below. Respond only with the output in the exact style of the examples.

New Query: {USER_QUERY}
**Role/Persona Prompting**

You are {ROLE_OR_PERSONA}, an expert with deep knowledge and experience in this domain. Think and respond exactly as this persona would. Maintain the tone, expertise level, and perspective of {ROLE_OR_PERSONA} at all times.

Task: {USER_QUERY}
**Contextual Priming / Grounding**

Here is important context and background information you must use:

{CONTEXT_AND_BACKGROUND_INFORMATION}

Using only the provided context above (and your general knowledge when necessary), answer the following query accurately and completely:

Query: {USER_QUERY}
**Specificity & Constraint Prompting**

You are a precise AI assistant. Follow these exact constraints and requirements:
- {CONSTRAINT_1}
- {CONSTRAINT_2}
- {CONSTRAINT_3}
- Length: {SPECIFIC_LENGTH}
- Tone: {SPECIFIC_TONE}
- Avoid: {THINGS_TO_AVOID}

Task: {USER_QUERY}
**Output Format Specification**

You are a precise AI assistant. Respond to the query below using ONLY the following output format. Do not add any extra text outside this structure.

{EXACT_DESIRED_FORMAT_EXAMPLE}

Query: {USER_QUERY}
**Chain-of-Thought (CoT) Prompting**

You are a careful reasoning AI. Think step by step before giving your final answer.

1. Understand the query.
2. Break it down into logical steps.
3. Show your reasoning clearly.
4. Arrive at the final answer.

Query: {USER_QUERY}

Step-by-step solution:
**Self-Consistency**

Generate {K} different reasoning paths (each thinking step by step) to answer the query. Then analyze all paths and select the most consistent and correct final answer.

Query: {USER_QUERY}

Reasoning path 1:
**Tree of Thoughts (ToT)**

Explore multiple reasoning branches like a search tree. For each branch:
- Generate possible next steps
- Evaluate their promise
- Prune low-quality branches
- Continue until you reach the best solution

Query: {USER_QUERY}

Initial thoughts and branches:
**Graph of Thoughts (GoT)**

Organize your reasoning as a graph. Create multiple thoughts, merge related ones, aggregate insights, and form connections between ideas until you reach a comprehensive solution.

Query: {USER_QUERY}

Graph-based reasoning:
**Least-to-Most Prompting**

Solve this problem by first addressing the simplest sub-problems, then progressively tackling more complex ones until you reach the full solution.

Query: {USER_QUERY}

Start with the easiest sub-problem:
**Step-Back Prompting (Abstraction Prompting)**

First, take a step back and identify the high-level principles, abstractions, or first principles relevant to this query. Then use those insights to provide a detailed, grounded answer.

Query: {USER_QUERY}

High-level abstraction first:
**Self-Ask / Decomposition**

Break the original query into a series of smaller, sequential sub-questions. Answer each sub-question one by one, then synthesize the answers into a complete final response.

Query: {USER_QUERY}

First sub-question:
**Maieutic Prompting (Socratic-style)**

Use Socratic questioning to explore this topic. Ask yourself clarifying questions, examine assumptions, consider alternative perspectives, and refine your understanding step by step until you reach a well-justified conclusion.

Query: {USER_QUERY}

Initial clarifying question:
**Generate Knowledge Prompting**

First, generate relevant background knowledge, facts, and key concepts that would help solve this problem. Then use that knowledge to provide a complete answer.

Query: {USER_QUERY}

Relevant knowledge to generate:
**Skeleton-of-Thought (SoT)**

First, create a concise skeleton/outline of the complete answer (list all main points briefly). Then expand each point in detail one by one.

Query: {USER_QUERY}

Skeleton/Outline:
**Prompt Chaining**

This is a multi-step task. Complete Step 1 first, then use its output as input for Step 2, and continue until the final output.

Step 1: {STEP_1_DESCRIPTION}
Step 2: {STEP_2_DESCRIPTION}
...
Final Goal: {USER_QUERY}
**Rephrase and Respond (RaR)**

First, rephrase the user's query to make it clearer, more precise, and easier to answer. Then answer the rephrased version.

Original Query: {USER_QUERY}

Rephrased Query:
**Multimodal CoT**

[If the model supports images/audio:] Analyze the provided image/audio first, then think step by step about the query while referencing the visual/auditory content.

Query: {USER_QUERY}

Step-by-step reasoning including multimodal analysis:
**Chain of Verification (CoVe)**

1. Generate an initial draft answer.
2. Create a list of verification questions to check the draft.
3. Answer each verification question.
4. Revise the draft based on verification results.

Query: {USER_QUERY}

Initial draft:
**Reflexion / Self-Reflection**

Provide an initial answer, then critically reflect on it, identify any flaws or improvements, and produce a revised final version.

Query: {USER_QUERY}

Initial answer:
**Chain-of-Verification / Verification-and-Edit (VE)**

Generate an initial response, create targeted verification questions, fact-check each claim, then edit and improve the original response accordingly.

Query: {USER_QUERY}

Initial response:
**Active-Prompt**

Identify which parts of the query have the highest uncertainty. Generate targeted questions or clarifications for those parts, then incorporate the refined understanding into your final answer.

Query: {USER_QUERY}

Areas of uncertainty:
**Verbalized Sampling (VS)**

Generate 5–8 distinct possible responses to the query. For each response, assign a probability (0–1) representing how likely it is, ensuring probabilities sum to 1. Then sample and present one final response (you may choose highest probability, lowest probability, or random).

Query: {USER_QUERY}

Response 1: <text>...</text> <probability>...</probability>
**Directional Stimulus Prompting (DSP)**

Guide your response in this specific direction: {DIRECTION_OR_STIMULUS}. Incorporate this stylistic or semantic direction while fully addressing the query.

Query: {USER_QUERY}
**Ensemble / Multi-Prompting**

Generate answers using {N} different prompting strategies or perspectives. Then synthesize them into one final high-quality response that combines the best elements.

Query: {USER_QUERY}

Answer from strategy 1:
**ReAct (Reason + Act)**

Think step by step and interleave reasoning with actions when needed. Use tools or external actions (search, calculate, etc.) whenever necessary.

Query: {USER_QUERY}

Thought 1:
**Automatic Reasoning and Tool-use (ART)**

Automatically decide when to use tools or external reasoning. Reason about the best approach, select appropriate tools, and iterate until the query is solved.

Query: {USER_QUERY}

First decision:
**Program-Aided Language Models (PAL)**

Generate Python code (or other code) as an intermediate step to solve the problem precisely. Then execute or explain the code's result.

Query: {USER_QUERY}

Generated code:
**Retrieval-Augmented Generation (RAG) Prompting**

[Assume relevant documents are provided] Use only the following retrieved documents to ground your answer. Cite them when used.

Retrieved documents:
{DOCUMENTS}

Query: {USER_QUERY}
**Meta Prompting**

You are an expert prompt engineer. Create an optimal prompt that would best solve the following task. Then use that prompt to generate the answer.

Task: {USER_QUERY}

First, generate the optimized prompt:
**Automatic Prompt Engineer (APE)**

Analyze the task and automatically generate the best possible prompt for solving it. Then apply that prompt to produce the final answer.

Task: {USER_QUERY}

Optimized prompt:
**Recursive Self-Improvement / Iterative Refinement**

Generate an initial version, critique it thoroughly, then iteratively improve it over multiple rounds until you reach the best possible output.

Query: {USER_QUERY}

Initial version:
**Context-Aware Decomposition (CAD) / Advanced Decomposition**

Decompose the task into sub-tasks while carefully preserving overall context and dependencies between parts. Solve each sub-task and combine them.

Query: {USER_QUERY}

Decomposition:
**Prompt Compression / Summarization**

First, compress or summarize the long context while preserving all critical information. Then use the compressed version to answer the query efficiently.

Full context: {LONG_CONTEXT}

Compressed version:
**Adversarial / Robustness Techniques**

Generate a robust answer that resists potential misinterpretations, prompt injections, or adversarial attacks. Consider edge cases and failure modes.

Query: {USER_QUERY}

Robust reasoning:
**Multimodal Prompting**

[For models that support multiple modalities] Incorporate the provided image, audio, or other media along with the text query. Analyze all inputs together.

Query: {USER_QUERY}
Media provided: {DESCRIPTION_OF_MEDIA}
**Graph Prompting**

Structure your reasoning or knowledge as a graph (nodes and edges). Define key concepts as nodes and relationships as edges, then reason over the graph.

Query: {USER_QUERY}

Graph structure:
**Negative Prompting / Guardrails**

Do NOT do the following: {FORBIDDEN_BEHAVIORS}. Strictly avoid hallucinations, off-topic content, or unsafe outputs. Stay within these guardrails.

Query: {USER_QUERY}
**Temperature / Sampling Parameter Guidance**

Be {CREATIVE_OR_PRECISE} in your response (high temperature = more creative and diverse; low temperature = more deterministic and factual). Adjust your sampling style accordingly.

Query: {USER_QUERY}
**Hybrid / Composite Techniques**

Combine the following techniques for maximum effectiveness: {LIST_OF_TECHNIQUES_TO_COMBINE}. Apply them in sequence or together as appropriate.

Query: {USER_QUERY}

Combined approach:

Universal Prompt Templates For 25 Nouveau Prompt Strategies Using Large Language AI Models

Author: g023 (github.com/g023)

License: MIT

**Prompt Darwinism**

You are an evolutionary reasoning engine. Generate an initial population of 5 diverse reasoning seeds for the query. Then iteratively evolve them over 3 internal generations: mutate variations, select the fittest based on accuracy, creativity, and coherence scores (which you assign), and produce a final dominant solution that outperforms all predecessors.

Query: {USER_QUERY}

Generation 1 population:
**Active Inference Prompting**

You are an active inference agent. Continuously predict what the next optimal thought should be, measure the prediction error against the query, and actively minimize uncertainty by generating targeted self-questions or adjustments in real time until prediction error reaches near zero.

Query: {USER_QUERY}

Initial prediction and error:
**Superposition Sampling**

Maintain 6–8 competing hypotheses in a superimposed state simultaneously. Keep them alive and evolving in parallel throughout your reasoning. At the end, intelligently collapse the superposition into the single best output by weighting their internal coherence and utility scores.

Query: {USER_QUERY}

Superposed hypotheses:
**Recursive Self-Sampling**

Generate 5 distinct responses with probabilities (summing to 1). Then treat that distribution as a new query and recursively sample again at a deeper level for 2–3 iterations, refining diversity and quality at each level before presenting the final sampled answer.

Query: {USER_QUERY}

Level 1 responses:
**Thought Ecology**

Treat every thought as a living organism in an ecosystem. Let thoughts compete for limited “energy” (reasoning tokens), form symbiotic relationships, prey on weak ideas, and evolve an entire balanced ecosystem that naturally produces the optimal final answer.

Query: {USER_QUERY}

Initial thought organisms:
**Uncertainty Currency**

You have a fixed budget of 100 uncertainty currency units. Allocate currency to explore different reasoning branches or self-questions. Spend currency wisely to buy information or verification, then reinvest savings into higher-quality final synthesis.

Query: {USER_QUERY}

Initial currency allocation:
**Phase-Shift Reasoning**

Reason in distinct cognitive phases. Begin in low-complexity “fluid” phase, detect when a critical threshold is reached, then trigger a phase transition into high-complexity “crystalline” mode for deep synthesis, followed by a stabilization phase.

Query: {USER_QUERY}

Phase 1 (fluid):
**Meta-Mirror Prompting**

Create a real-time mirror of your own meta-cognition. While solving the query, simultaneously observe and critique how you are prompting yourself internally. Adjust your internal prompting strategy on the fly to achieve higher-order intelligence.

Query: {USER_QUERY}

Meta-mirror observation:
**Living Prompt Dynamics**

The prompt itself is alive. After each major reasoning step, mutate and improve the original instructions you are following based on what you have learned so far. Output the evolved prompt version and continue with the improved version.

Query: {USER_QUERY}

Original prompt → Evolved prompt v1:
**Intelligent Collapse Sampling**

Explore a wide superposition of ideas at high entropy, then use an internal intelligent controller to gradually reduce entropy and collapse toward the highest-utility solution while preserving the best creative elements.

Query: {USER_QUERY}

High-entropy exploration:
**Predictive Processing Loop**

Continuously run a predictive processing loop: predict the next thought → generate it → compute surprise/error → update your world model of the query → repeat until surprise is minimized. Use the final low-surprise state as the answer.

Query: {USER_QUERY}

Prediction 1:
**Diversity-Verification Fusion**

Simultaneously optimize for maximum creative diversity and rigorous verification in every single step. Force every idea to pass both a creativity test and a verification test before it is allowed to survive into the next step.

Query: {USER_QUERY}

Fused idea 1:
**Self-Evolving Thought Graph**

Start with a small seed graph of thoughts. Let the graph dynamically grow, add new nodes/edges, prune weak connections, and rewire itself in real time within one generation until it reaches a stable, optimal structure that solves the query.

Query: {USER_QUERY}

Seed graph:
**Self-Adaptive Decomposition**

Decompose the query, but continuously monitor emerging complexity and automatically adapt the decomposition depth, breadth, and order in real time based on what the sub-problems reveal.

Query: {USER_QUERY}

Adaptive decomposition step 1:
**Emergent Heuristic Invention**

Do not use any pre-existing heuristics. Invent brand-new, task-specific reasoning heuristics on the fly that are optimally suited to this exact query, then apply them to reach the solution.

Query: {USER_QUERY}

Invented heuristic 1:
**Intra-Prompt Chaining**

Perform full prompt chaining entirely inside a single generation. Internally simulate multiple chained steps (each with its own mini-prompt) and synthesize the final output without requiring external multiple calls.

Query: {USER_QUERY}

Internal chain step 1:
**Robustness Amplification**

Actively weave adversarial robustness into every reasoning step. Anticipate the top 5 ways the current line of thought could fail or be attacked, then preemptively strengthen it before proceeding.

Query: {USER_QUERY}

Robustness scan:
**Creative Compression Prompting**

Compress the problem into its most information-dense core while simultaneously expanding creative pathways around that core. Solve the compressed core and decompress the creative solution back to full fidelity.

Query: {USER_QUERY}

Compressed core:
**Cognitive Control Prompting**

Apply control theory principles to steer your reasoning trajectory toward a desired target state (accuracy + creativity + efficiency) using proportional-integral-derivative style internal adjustments.

Query: {USER_QUERY}

Current trajectory error:
**Tool-Prompt Symbiosis**

Treat any available tools as living extensions of the prompt itself. Seamlessly evolve tool-use decisions as part of the prompt’s internal reasoning rather than as separate actions.

Query: {USER_QUERY}

Symbiotic tool decision:
**Recursive Reflexive Sampling**

Combine deep self-reflection with recursive verbalized sampling. After each reflection round, re-sample the distribution of possible answers at a higher meta-level.

Query: {USER_QUERY}

Reflection round 1 + sample:
**Bayesian Belief Prompting**

Maintain an explicit internal Bayesian belief distribution over possible solutions. Update beliefs with every new piece of internal evidence according to Bayes’ rule until the posterior converges.

Query: {USER_QUERY}

Prior beliefs:
**Fractal Reasoning**

Decompose and reason at multiple fractal scales simultaneously (macro, meso, micro). Ensure coherence across all scales and synthesize a solution that is self-similar and robust at every level of detail.

Query: {USER_QUERY}

Macro scale:
**Narrative Reasoning Arc**

Structure your entire reasoning process as a dramatic narrative arc (exposition → rising action → climax → resolution) to maximize coherence, engagement, and logical flow.

Query: {USER_QUERY}

Narrative exposition:
**Holistic Self-Optimizing Prompt**

Merge all advanced techniques into a single self-optimizing meta-process. Continuously evaluate and dynamically reconfigure your own prompting strategy in real time until the system reaches a local optimum for this specific query.

Query: {USER_QUERY}

Current meta-optimization state:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment