SKILL·F3BD63

prompt-optimization

asklokesh
更新于 23 days ago
8 次查看
1,093
206
1,093
在 GitHub 上查看
其他ai

关于

This skill automatically repeats prompts for Haiku agents to boost accuracy 4-5x on structured tasks like unit testing and parsing. It works by enabling bidirectional attention during processing without adding latency. It activates automatically for applicable tasks, requiring no manual intervention from developers.

快速安装

Claude Code

推荐
主要方式
npx skills add asklokesh/claudeskill-loki-mode -a claude-code
插件命令备选方式
/plugin add https://github.com/asklokesh/claudeskill-loki-mode
Git 克隆备选方式
git clone https://github.com/asklokesh/claudeskill-loki-mode.git ~/.claude/skills/prompt-optimization

在 Claude Code 中复制并粘贴此命令以安装该技能

技能文档

Prompt Optimization Skill

Overview

Automatically applies prompt repetition for Haiku agents to improve accuracy by 4-5x on structured tasks.

Research Source: "Prompt Repetition Improves Non-Reasoning LLMs" (arXiv 2512.14982v1)


When to Activate

This skill activates automatically for:

  • Haiku agents executing structured tasks
  • Unit test execution
  • Linting and formatting
  • Parsing and extraction
  • List operations (find, filter, count)

How It Works

BEFORE:
prompt = "Run unit tests in tests/ directory"

AFTER (with skill):
prompt = "Run unit tests in tests/ directory\n\nRun unit tests in tests/ directory"

The repeated prompt enables bidirectional attention within the parallelizable prefill stage, improving accuracy without latency penalty.


Performance Impact

Task TypeWithout SkillWith SkillImprovement
Unit tests65% accuracy95% accuracy+46%
Linting72% accuracy98% accuracy+36%
Parsing58% accuracy94% accuracy+62%

Latency: Zero impact (occurs in prefill, not generation)


Configuration

Enable/Disable

# Enabled by default for Haiku agents
LOKI_PROMPT_REPETITION=true

# Disable if needed
LOKI_PROMPT_REPETITION=false

Repetition Count

# 2x repetition (default)
LOKI_PROMPT_REPETITION_COUNT=2

# 3x repetition (for position-critical tasks)
LOKI_PROMPT_REPETITION_COUNT=3

Agent Instructions

When you are a Haiku agent and the task involves:

  • Running tests
  • Executing linters
  • Parsing structured data
  • Finding items in lists
  • Counting or filtering

Your prompt will be automatically repeated 2x to improve accuracy. No action needed from you.

If you are an Opus or Sonnet agent, this skill does NOT apply (reasoning models see no benefit from repetition).


Metrics

Track prompt optimization impact:

.loki/metrics/prompt-optimization/
├── accuracy-improvement.json
└── cost-benefit.json

References

See references/prompt-repetition.md for full documentation.


Version: 1.0.0

GitHub 仓库

asklokesh/claudeskill-loki-mode
路径: examples/agent-skills/prompt-optimization
0
ai-agentsai-coding-agentsai-coding-toolsanthropicautonomous-agentsclaude
FAQ

常见问题

什么是 prompt-optimization Skill?

prompt-optimization 是一个 Claude Skill,作者为 asklokesh。Skill 将 Claude 按需加载的说明和资源打包,让 Claude 无需额外提示即可执行与 prompt-optimization 相关的任务。

如何安装 prompt-optimization?

使用本页的安装命令:将 prompt-optimization 作为插件添加到 Claude Code,或将其仓库克隆到 skills 目录,然后重启 Claude 以加载该 Skill。

prompt-optimization 属于哪个分类?

prompt-optimization 属于其他分类。

prompt-optimization 可以免费使用吗?

可以。prompt-optimization 已收录在 AIMCP,可免费安装。

相关推荐技能

sports-betting-analyzer
其他

该Skill为开发者提供体育博彩数据分析工具,可分析盘口、大小球和特殊投注,识别价值投注机会。它整合历史数据和情景统计,生成包含时间戳的结构化Markdown报告。适用于需要快速获取博彩市场洞察的娱乐或教育类应用开发。

查看技能
llamaguard
其他

LlamaGuard是Meta推出的7-8B参数内容审核模型,专门用于过滤LLM的输入和输出内容。它能检测六大安全风险类别(暴力/仇恨、性内容、武器、违禁品、自残、犯罪计划),准确率达94-95%。开发者可通过HuggingFace、vLLM或Sagemaker快速部署,并能与NeMo Guardrails集成实现自动化安全防护。

查看技能
cost-optimization
其他

这个Claude Skill帮助开发者优化云成本,通过资源调整、标记策略和预留实例来降低AWS、Azure和GCP的开支。它适用于减少云支出、分析基础设施成本或实施成本治理策略的场景。关键功能包括提供成本可视化、资源规模调整指导和定价模型优化建议。

查看技能
quantizing-models-bitsandbytes
其他

这个Skill使用bitsandbytes库量化大语言模型,能在GPU内存有限时通过8位或4位量化减少50-75%内存占用,同时保持精度损失最小。它支持INT8、NF4、FP4等多种量化格式,可与HuggingFace Transformers无缝集成,适用于需要部署更大模型或加速推理的场景。还提供QLoRA训练和8位优化器支持,让开发者能轻松实现高效模型压缩。

查看技能