prompt-repetition

supercent-io/skills-template · updated Apr 8, 2026

MDX-style export adds YAML metadata + attribution linking explainx.ai and this canonical listing URL.

$npx skills add https://github.com/supercent-io/skills-template --skill prompt-repetition
0 commentsdiscussion
summary

Prompt repetition technique that improves lightweight model accuracy by 67% across benchmarks.

  • Auto-applies to claude-haiku, gemini-flash, and gpt-4o-mini; uses 2× repetition for general tasks and 3× for position-based queries
  • Mitigates causal attention limitations by reprocessing the entire prompt, strengthening attention weights on key concepts without architectural changes
  • Skips automatically when Chain-of-Thought patterns detected; includes duplicate-application prevention via ma
skill.md

Prompt Repetition

Problem Being Solved

LLMs are trained as Causal Language Models, where each token attends only to previous tokens. This leads to:

  1. Context-Question Problem: The question is unknown when processing context
  2. Options-First MCQ Problem: Cannot fully understand the question context when viewing answer choices
  3. Position/Index Problem: Attention weights weaken for specific position information in long lists

Prompt repetition enables the second pass to reference the entire first pass, effectively mimicking some benefits of bidirectional attention.


When to use this skill

  • When using lightweight models: claude-haiku, gemini-flash, gpt-4o-mini, etc.
  • Options-First MCQ: Multiple choice where answer choices appear before the question
  • Context + Question: Searching for specific information in long contexts
  • Index/Position Tasks: Position-based queries in inventories or lists
  • NPC Dialogue: Maintaining consistency for game AI characters
  • Non-Reasoning Tasks: Tasks that do not use Chain-of-Thought

How It Works

Limitations of Causal Attention

[Context] → [Question]
Cannot reference Question content when processing Context tokens
Attention weights for Context are already finalized by the time Question tokens appear

How Prompt Repetition Solves This

[First Pass]                [Second Pass]
Context → Question    →    Context' → Question'
                              ↑         ↑
                          Can reference entire first pass

In the second repetition, the model reprocesses information across the entire first prompt and strengthens attention weights on key concepts, resulting in improved performance.

Note: This does not change the model architecture to bidirectional; it is a prompt engineering technique to mitigate the limitations of causal models.


Research Results (Google Research 2025)

Metric Result
Significant improvement (p < 0.1) 47 / 70 benchmarks
Performance degradation 0
Neutral 23
Improvement rate 67%

Most dramatic improvement: Gemini 2.0 Flash-Lite on NameIndex: 21.33% → 97.33% (+76%p)

Tested Models

  • Gemini 2.0 Flash / Flash Lite
  • GPT-4o / GPT-4o-mini
  • Claude 3.7 Sonnet / Claude 3 Haiku
  • Deepseek V3

Tested Benchmarks

  • ARC (Challenge) - Scientific reasoning
  • OpenBookQA - Open-domain QA
  • GSM8K - Math problems
  • MMLU-Pro - Multitask language understanding
  • MATH - Mathematical problem solving
  • NameIndex / MiddleMatch - Custom position tasks

Application Procedure

Step 1: Verify Auto-Apply Target Models

Provider Auto-apply models Excluded models
Claude haiku series opus, sonnet
Gemini flash, flash-lite pro, ultra
OpenAI gpt-4o-mini, gpt-low gpt-4o, gpt-4

Step 2: Determine Repetition Count by Task Type

Task Type Keyword Pattern Repetitions Expected Improvement
Options-First MCQ A. B. C. D. choices first +15-40%p
Index/Position slot, position, index, N-th +50-76%p
Context + Question General question +5-15%p
With CoT step by step, think through (not applied) ~0%

Step 3: Check Token Limits

# Check context before auto-apply
max_context = model_context_window * 0.8  # 80% safety margin
if len(prompt_tokens) * repetitions > max_context:
    repetitions = max(1, int(max_context / len(prompt_tokens)))

Step 4: Prompt Transformation

def apply_prompt_repetition(prompt: str, times: int = 2) -> str:
    """Repeat the prompt a specified number of times

    Args:
        prompt: Original prompt
        times: Number of repetitions (default 2)

    Returns:
        Repeated prompt
    """
    if times <= 1:
        return prompt
    return "\n\n".join([prompt] * times)

Practical Examples

Example 1: Options-First MCQ (Greatest Effect)

Before:

A. Paris
B. London
C. Berlin
D. Madrid

Which city is the capital of France?
Reply with one letter.

After (repetition ×2 applied):

A. Paris
B. London
C. Berlin
D. Madrid

Which city is the capital of France?
Reply with one letter.

A. Paris
B. London
C. Berlin
D. Madrid

Which city is the capital of France?
Reply with one letter.

Expected output:

A

Accuracy: original 78% → after repetition 93% (+15%p)


Example 2: Index/Position Tasks (Maximum Effect)

Before:

Inventory:
1. Iron Sword
2. Leather Armor
3. Health Potion (x5)
4. Magic Staff
...
25. Dragon Scale
...
50. Ancient Map

What item is in slot 25?

After (repetition ×3 applied): Prompt repeated 3 times

Expected output:

Dragon Scale

Accuracy: original 21% → after repetition 97% (+76%p)


Example 3: Tool Call Prompt Handling

Note: Prompts containing tool call instructions are also repeated in their entirety. The full-repetition approach was adopted for implementation simplicity and consistency.

Before:

Use the calculator tool to compute 234 * 567.
What is the result?

After (repetition ×2):

Use the calculator tool to compute 234 * 567.
What is the result?

Use the calculator tool to compute 234 * 567.
What is the result?

Research results show that full repetition including tool call sections is also effective.


Production-Ready Implementation

Auto-Apply Transformer

"""prompt_repetition_transformer.py"""
from dataclasses import dataclass, field
from typing import Optional, Callable, List
import re

# Context window per model (in tokens)
MODEL_CONTEXT_WINDOWS = {
    "claude-3-haiku": 200_000,
    "claude-haiku": 200_000,
    "gemini-flash": 1_000_000,
    "gemini-flash-lite": 1_000_000,
    "gemini-2.0-flash": 1_000_000,
    "gpt-4o-mini": 128_000,
    "gpt-low": 128_000,
}

# Models targeted for auto-apply
AUTO_APPLY_MODELS = list(MODEL_CONTEXT_WINDOWS.keys())

# CoT patterns (excluded from apply)
COT_PATTERNS = [
    r"step by step",
    r"think through",
    r"let's think",
    r"reasoning:",
    r"chain of thought",
]

# Position/Index patterns (3× repetition)
POSITION_PATTERNS = [
    r"slot \d+",
    r"position \d+",
    r"index \d+",
    r"\d+(st|nd|rd|th)",
    r"item \d+",
    r"row \d+",
    r"column \d+",
]

@dataclass
class PromptRepetitionConfig:
    """Prompt repetition configuration"""
    default_repetitions: int = 2
    position_repetitions: int = 3
    separator: str = "\n\n"
    max_context_ratio: float = 0.8
    applied_marker: str = "<!-- prompt-repetition-applied -->"

class PromptRepetitionTransformer:
    """Auto-apply prompt repetition transformer for lightweight models"""

    def __init__(self, config: Optional[PromptRepetitionConfig] = None):
        self.config = config or PromptRepetitionConfig()

    def should_apply(self, model: str, prompt: str) -> bool:
        """Determine whether to auto-apply"""
        # Skip if already applied
        if self.config.applied_marker in prompt:
            return False

        # Check target model
        model_lower = model.lower()
        if not any(m in model_lower for m in AUTO_APPLY_MODELS):
            return False

        # Skip when CoT pattern detected
        prompt_lower = prompt.lower()
        for pattern in COT_PATTERNS:
            if re.search(pattern, prompt_lower):
                return False

        return True

    def determine_repetitions(self, prompt: str, model: str) -<
how to use prompt-repetition

How to use prompt-repetition on Cursor

AI-first code editor with Composer

1

Prerequisites

Before installing skills in Cursor, ensure your development environment meets these requirements:

  • Cursor installed and configured on your development machine
  • Node.js version 16.0+ with npm package manager (verify with node --version)
  • Active project directory or workspace where you want to add prompt-repetition
2

Execute installation command

Execute the skills CLI command in your project's root directory to begin installation:

$npx skills add https://github.com/supercent-io/skills-template --skill prompt-repetition

The skills CLI fetches prompt-repetition from GitHub repository supercent-io/skills-template and configures it for Cursor.

3

Select Cursor when prompted

The CLI will show a list of available agents. Use arrow keys to navigate and space to select Cursor:

◆ Which agents do you want to install to?
│ ── Universal (.agents/skills) ── always included ────
│ • Amp
│ • Antigravity
│ • Cline
│ • Codex
│ ●Cursor(selected)
│ • Cursor
│ • Windsurf
4

Verify installation

Confirm successful installation by checking the skill directory location:

.cursor/skills/prompt-repetition

Reload or restart Cursor to activate prompt-repetition. Access the skill through slash commands (e.g., /prompt-repetition) or your agent's skill management interface.

Security & Verification Notice

We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.

Skills execute code in your development environment. Always verify the publisher's identity, review recent commits, and test in isolated environments before production deployment.

List & Monetize Your Skill

Submit your Claude Code skill and start earning

GET_STARTED →

Use Cases

User Story & Requirements Generation

Create detailed user stories, acceptance criteria, and feature specs

Example

Generate user stories for 'password reset feature' with acceptance criteria, edge cases, and test scenarios

Reduce spec writing time by 50%, ensure comprehensive coverage

Competitive Analysis

Research competitors, compare features, identify gaps

Example

Analyze 5 competitor products, create feature comparison matrix, suggest differentiation opportunities

Complete competitive research in 2 hours instead of 2 days

Roadmap Prioritization

Evaluate features using frameworks (RICE, ICE, Kano) and create prioritized backlogs

Example

Score 20 feature ideas using RICE framework, generate prioritized roadmap with rationale

Make data-driven prioritization decisions faster

Stakeholder Communication

Draft PRDs, status updates, and stakeholder presentations

Example

Create executive summary of Q3 roadmap, monthly progress report, feature launch announcement

Save 3-5 hours/week on communication overhead

Implementation Guide

Prerequisites

  • Claude Desktop or compatible AI client
  • Access to product documentation and roadmap tools (Jira, Notion, etc.)
  • Understanding of product management frameworks (RICE, Jobs-to-be-Done, etc.)
  • Stakeholder contact information and communication channels

Time Estimate

30-60 minutes to see productivity improvements

Installation Steps

  1. 1.Install product management skill
  2. 2.Start with user story generation for known feature
  3. 3.Progress to competitive analysis: research 2-3 competitors
  4. 4.Use for roadmap prioritization: apply RICE/ICE scoring
  5. 5.Draft stakeholder communications and refine based on feedback
  6. 6.Build template library for recurring PM tasks
  7. 7.Share effective prompts with product team

Common Pitfalls

  • Not validating competitive research—verify facts before sharing
  • Accepting user stories without involving engineering team
  • Over-relying on frameworks without qualitative judgment
  • Not customizing outputs to company culture and communication style
  • Skipping stakeholder validation of generated requirements

Best Practices

✓ Do

  • +Validate research and competitive analysis with real data
  • +Collaborate with engineering when generating technical requirements
  • +Customize frameworks and templates to your company context
  • +Use skill for first drafts, refine with stakeholder input
  • +Document successful prompt patterns for PM tasks
  • +Combine AI efficiency with human judgment and intuition

✗ Don't

  • Don't publish competitive analysis without fact-checking
  • Don't finalize user stories without engineering review
  • Don't make prioritization decisions solely on AI scoring
  • Don't skip customer validation of generated requirements
  • Don't ignore company-specific context and culture

💡 Pro Tips

  • Provide context: company goals, constraints, customer feedback
  • Ask for alternatives: 'Show 3 ways to prioritize this roadmap'
  • Request stakeholder-specific formatting: 'Executive summary vs. engineering spec'
  • Use skill for 70% generation + 30% customization to company needs

When to Use This

✓ Use When

Use for user story writing, competitive research, roadmap prioritization, stakeholder communication, and PRD drafting. Best for reducing repetitive documentation and research work.

✗ Avoid When

Avoid for strategic product vision (requires deep customer empathy), pricing decisions (needs market and financial expertise), or when face-to-face customer discovery is more valuable than speed.

Learning Path

  1. 1Basic: user stories, feature specs, status updates
  2. 2Intermediate: competitive analysis, prioritization frameworks, PRDs
  3. 3Advanced: product strategy, go-to-market planning, OKR setting
  4. 4Expert: product vision, market positioning, business model innovation

Discussion

Product Hunt–style comments (not star reviews)
  • No comments yet — start the thread.
general reviews

Ratings

4.775 reviews
  • Arjun Sharma· Dec 28, 2024

    Solid pick for teams standardizing on skills: prompt-repetition is focused, and the summary matches what you get after install.

  • Yuki Reddy· Dec 28, 2024

    prompt-repetition reduced setup friction for our internal harness; good balance of opinion and flexibility.

  • Anika Wang· Dec 28, 2024

    Useful defaults in prompt-repetition — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.

  • Anika Anderson· Dec 24, 2024

    Keeps context tight: prompt-repetition is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • Fatima Park· Dec 24, 2024

    prompt-repetition fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.

  • Arjun Reddy· Dec 20, 2024

    prompt-repetition has been reliable in day-to-day use. Documentation quality is above average for community skills.

  • Arjun Sethi· Dec 12, 2024

    We added prompt-repetition from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.

  • Aisha Rahman· Dec 8, 2024

    prompt-repetition is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.

  • Noah Choi· Nov 27, 2024

    Keeps context tight: prompt-repetition is the kind of skill you can hand to a new teammate without a long onboarding doc.

  • Tariq Bhatia· Nov 19, 2024

    Registry listing for prompt-repetition matched our evaluation — installs cleanly and behaves as described in the markdown.

showing 1-10 of 75

1 / 8