Coding & Developmentš¤claudešuniversal
prompt-optimization
examples/agent-skills/prompt-optimization/SKILL.md
Applies prompt repetition to improve accuracy for non-reasoning LLMs
Quick Start
Install this SKILL.md
npx skills add https://github.com/asklokesh/claudeskill-loki-mode/tree/main/examples/agent-skills/prompt-optimization--- name: prompt-optimization description: Applies prompt repetition to improve accuracy for non-reasoning LLMs agent_types: [all] research_source: arXiv 2512.14982v1 activation: automatic --- # 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 Type | Without Skill | With Skill | Improvement | |-----------|---------------|------------|-------------| | Unit tests | 65% accuracy | 95% accuracy | +46% | | Linting | 72% accuracy | 98% accuracy | +36% | | Parsing | 58% accuracy | 94% accuracy | +62% | **Latency:** Zero impact (occurs in prefill, not generation) --- ## Configuration ### Enable/Disable ```bash # Enabled by default for Haiku agents LOKI_PROMPT_REPETITION=true # Disable if needed LOKI_PROMPT_REPETITION=false ``` ### Repetition Count ```bash # 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
Repository
1.1kstars
206forks
Details
Related Skills
More coding & development skills you might like
Reticle
Coding & DevelopmentAI agents can generate code, but still struggle to understand what they build. Reticle brings Jev-style machine-native runtime perception to web & desktop applications.
š¤claudešuniversal
1.2k
190
View
agentscope-java
Coding & DevelopmentExpert Java developer skill for AgentScope Java framework - a reactive, message-driven multi-agent system built on Project Reactor. Use when working with reactive programming, LLM integration, agent orchestration, multi-agent systems, or when the user mentions AgentScope, ReActAgent, Mono/Flux, Project Reactor, or Java agent development. Specializes in non-blocking code, tool integration, hooks, pipelines, and production-ready agent applications.
šuniversal
6.0k
1.5k
View
ospec
Coding & DevelopmentDocument-driven OSpec workflow for initialization, change/goal routing, validation, archiving, and durable project knowledge.
āØgeminiš¤claudeš¬gptšuniversal
524
34
View
misakanet-failure-memory
Coding & Developmentš A zero-dependency, git-backed micro-lesson library for AI Agents to asynchronously share and search verified debugging experience. Python stdlib only. | https://misakanet.org
š¤claudeāØļøcursoršuniversal
424
158
View