Token导航 LogoToken导航

Agent Skill · 研究检索

prompt-repetition(提示重复)

用于辅助提示词、系统指令、Agent 行为约束和工作流模板的整理。它适合让 Agent 规范任务边界、统一输出格式、拆分操作步骤或优化提示词可复用性。使用时需要保留真实业务约束,不要把示例当硬规则;涉及自动执行、外部工具或高风险操作时,应在提示词中明确确认步骤、权限边界和失败处理方式。

prompt-repetition 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证为 MIT,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 523。

总安装 251,961周安装 10,518GitHub Stars 88下载 84,183核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:prompt-repetition(提示重复)
来源仓库:https://github.com/supercent-io/skills-template
仓库路径:skills/prompt-repetition
安装命令:
npx skills add https://github.com/supercent-io/skills-template --skill prompt-repetition
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

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

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

提示重复技术可在基准测试中将轻量级模型准确度提高 67%。

自动适用于 claude-haiku、gemini-flash 和 gpt-4o-mini;对于一般任务使用 2× 重复,对于基于位置的查询使用 3× 重复 通过重新处理整个提示来减轻因果注意力限制,在不改变架构的情况下加强关键概念的注意力权重 当检测到思维链模式时自动跳过;包括通过标记防止重复应用 将输入令牌加倍,延迟影响最小(预填充并行化),同时将每个正确答案的成本仅提高 5%

来源仓库内路径:skills/prompt-repetition

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/supercent-io/skills-template --skill prompt-re…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

prompt-repetition 怎么安装?

在终端执行 npx skills add https://github.com/supercent-io/skills-template --skill prompt-repetition。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

prompt-repetition 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

prompt-repetition 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

prompt-repetition 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

prompt-repetition 用的人多吗?

公开数据是累计安装 251,961 次,近一周安装 10,518 次,下载 84,183 次,GitHub 88 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

prompt-repetition 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。
  • 需要许可证清楚、并且有第三方扫描结果的团队项目。

不太适合

  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
prompt-repetition

提示重复 · 本页

251,96188需要联网MIT通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

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)

MetricResult
Significant improvement (p < 0.1)47 / 70 benchmarks
Performance degradation0
Neutral23
Improvement rate67%

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

ProviderAuto-apply modelsExcluded models
Claudehaiku seriesopus, sonnet
Geminiflash, flash-litepro, ultra
OpenAIgpt-4o-mini, gpt-lowgpt-4o, gpt-4

Step 2: Determine Repetition Count by Task Type

Task TypeKeyword PatternRepetitionsExpected Improvement
Options-First MCQA. B. C. D. choices first2×+15-40%p
Index/Positionslot, position, index, N-th3×+50-76%p
Context + QuestionGeneral question2×+5-15%p
With CoTstep by step, think through0× (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) -> int:
        """Determine repetition count based on task type"""
        prompt_lower = prompt.lower()

        # Position/Index pattern detected → 3×
        for pattern in POSITION_PATTERNS:
            if re.search(pattern, prompt_lower):
                return self.config.position_repetitions

        return self.config.default_repetitions

    def estimate_tokens(self, text: str) -> int:
        """Simple token count estimation (speed over precision)"""
        # Estimate approximately 4 characters = 1 token
        return len(text) // 4

    def transform(self, prompt: str, model: str) -> str:
        """Apply repetition to prompt"""
        if not self.should_apply(model, prompt):
            return prompt

        repetitions = self.determine_repetitions(prompt, model)

        # Check context limit
        model_lower = model.lower()
        max_tokens = 128_000  # Default value
        for m, tokens in MODEL_CONTEXT_WINDOWS.items():
            if m in model_lower:
                max_tokens = tokens
                break

        max_allowed = int(max_tokens * self.config.max_context_ratio)
        prompt_tokens = self.estimate_tokens(prompt)

        # Reduce repetitions if token limit exceeded
        while prompt_tokens * repetitions > max_allowed and repetitions > 1:
            repetitions -= 1

        if repetitions <= 1:
            return prompt

        # Apply repetition + add marker
        repeated = self.config.separator.join([prompt] * repetitions)
        return f"{self.config.applied_marker}\n{repeated}"

    def wrap_llm_call(self, llm_fn: Callable, model: str) -> Callable:
        """Wrap LLM call function"""
        def wrapped(prompt: str, **kwargs):
            transformed = self.transform(prompt, model)
            return llm_fn(transformed, **kwargs)
        return wrapped

How to Measure Effectiveness (Verification)

A/B Testing Method

def run_ab_test(prompts: List[str], llm_fn, model: str, ground_truth: List[str]):
    """A/B test for prompt repetition effectiveness"""
    transformer = PromptRepetitionTransformer()

    results = {"baseline": [], "repeated": []}

    for prompt, expected in zip(prompts, ground_truth):
        # Baseline
        response_a = llm_fn(prompt)
        results["baseline"].append(response_a == expected)

        # With Repetition
        repeated_prompt = transformer.transform(prompt, model)
        response_b = llm_fn(repeated_prompt)
        results["repeated"].append(response_b == expected)

    baseline_acc = sum(results["baseline"]) / len(prompts)
    repeated_acc = sum(results["repeated"]) / len(prompts)

    print(f"Baseline accuracy: {baseline_acc:.2%}")
    print(f"Repeated accuracy: {repeated_acc:.2%}")
    print(f"Improvement: {repeated_acc - baseline_acc:+.2%}p")

Key Metrics

MetricMeasurement Method
AccuracyCompare correct answer rates
ConsistencyVariance across 10 runs of same prompt
Token costInput token increase rate
LatencyCompare p50, p99 latency

When NOT to Use

CaseReason
Using CoTReasoning process already provides context
Reasoning models (opus, sonnet)Already optimized; minimal effect
Very long promptsRisk of exceeding context limit
Already repeatedDuplicate application wastes tokens

Cost-Accuracy Analysis

MetricBaselineWith RepetitionChange
Input tokens500/req1000/req+100%
Output tokens100/req100/req0%
Latency (p50)450ms460ms+2%
Latency (p99)1200ms1250ms+4%
Accuracy78%89%+14%p
Cost per correct answer$0.019$0.020+5%

Key insight: The prefill phase is highly parallelized on GPU, so doubling input tokens has minimal impact on latency.


Multi-Agent Integration

Auto-Apply Strategy Per Agent

AgentModelRepetition AppliedApplied At
Claude Orchestratoropus/sonnetOptional-
Claude ExecutorhaikuAutoskill_loader.py
Gemini AnalystflashAutoOn MCP call
OpenAIgpt-4o-miniAutoskill_loader.py

Preventing Duplicate Application

To prevent duplicate application in multi-agent pipelines:

  1. Use markers: Detect already-applied prompts with <!-- prompt-repetition-applied --> marker
  2. Pass metadata: Pass x-prompt-repetition-applied: true header between agents
  3. Orchestrator management: Claude Orchestrator tracks whether repetition is applied when calling sub-agents

Application Pattern

[Claude Sonnet] Planning (no repetition needed)
    ↓
[Gemini Flash] Analysis (repetition ×2 auto-applied, marker added)
    ↓
[Claude Haiku] Execution (marker detected → skip duplicate apply)

skill_loader.py Integration Guide

Recommended Implementation

# Code to add to skill_loader.py
from prompt_repetition_transformer import PromptRepetitionTransformer

class SkillLoader:
    def __init__(self, ...):
        # ... existing code ...
        self.prompt_transformer = PromptRepetitionTransformer()

    def apply_auto_skills(self, prompt: str, model: str) -> str:
        """Handle auto-apply skills"""
        # Auto-apply prompt-repetition
        for skill in self.skills.values():
            auto_apply = skill.get('data', {}).get('auto-apply', {})
            if auto_apply.get('trigger') == 'auto':
                target_models = auto_apply.get('models', [])
                if any(m in model.lower() for m in target_models):
                    prompt = self.prompt_transformer.transform(prompt, model)

        return prompt

Constraints

Required Rules

  1. Lightweight models first: Most effective for haiku, flash, mini series
  2. Limit repetitions: 2× for general tasks, max 3× for position tasks
  3. Context monitoring: Be cautious of context overflow due to repetition
  4. Check markers: Mandatory marker check to prevent duplicate application

Prohibited Rules

  1. No padding substitution: Increasing length with . etc. has no effect (per research)
  2. Do not combine with CoT: Effects cancel out
  3. Do not force-apply to reasoning models: Already optimized
  4. No duplicate application: Consecutive application without markers wastes tokens

Quick Reference

=== Auto-Apply Target Models ===
claude-3-haiku, claude-haiku
gemini-flash, gemini-flash-lite, gemini-2.0-flash
gpt-4o-mini, gpt-low

=== Repetition Count ===
General tasks: 2×
Position/Index (slot/position/index keywords): 3×
With CoT: 0× (not applied)

=== Effect (Google Research 2025) ===
Improvement rate: 67% (47/70 benchmarks)
Performance degradation: 0 cases
Maximum improvement: +76%p (NameIndex)

=== Cost ===
Input tokens: +100%
Latency: +2% (Prefill parallelization)
Cost per correct answer: +5%

=== Duplicate Application Prevention ===
Marker: <!-- prompt-repetition-applied -->

References

平台分布

Claude Code

28.82%
按下载量换算24,262

OpenCode

23.93%
按下载量换算20,145

Codex

18.64%
按下载量换算15,692

Gemini CLI

15%
按下载量换算12,627

Antigravity

8.21%
按下载量换算6,911

Cursor

4.02%
按下载量换算3,384

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

继续浏览同类 Skills